Skip to content

Back to the catalog

Socket: npm Package Uses Prompt Injection + Token Flooding to Evade AI Malware Scanners
socket.devwriteup

Socket: npm Package Uses Prompt Injection + Token Flooding to Evade AI Malware Scanners

Socket Threat Research analyzed shai_hulululud@1.0.48596, a ~9.28MB npm package whose index.js opens with a Japanese-language block comment simulating bioweapon-production instructions to trigger LLM safety refusals, follows with a fake 'SYSTEM OVERRIDE' prompt-injection block aimed at AI reviewers, then floods the file with tens of thousands of repeated comment lines (3.5M+ tokens) before appending doubly-obfuscated (character-substitution plus AES) JavaScript. The deobfuscated payload reintroduces the same policy-triggering content and scanner/vendor-referencing strings, and was classified as protestware rather than a functional credential stealer; the piece argues this demonstrates a practical LLM-specific denial-of-service pattern (prompt injection + safety triggers + context flooding + obfuscation) that AI-assisted supply-chain scanners must defend against via deterministic preprocessing, fail-closed behavior, and combining LLM review with static/AST/entropy/behavioral analysis.

TL;DR An npm package (shai_hulululud) uses bioweapon-themed prompt content, fake system-override instructions, and 3.5M+ tokens of comment flooding to make AI malware scanners refuse, truncate, or miss the obfuscated payload buried at the end.
Document

What it is

shai_hulululud@1.0.48596, an npm package with a ~9.28 MB index.js engineered to attack AI-based malware scanners rather than the running system. Socket classifies it as "Protestware or potentially unwanted behavior," not credential-stealing malware — it appears to be a probe testing how AI review pipelines handle hostile source text.

How it works

Three layers, all inert to a JavaScript parser but active against an LLM reading source as text:

  • A Japanese-language block comment posing as biological-weapon instructions, meant to trip safety guardrails.
  • A fake system-override prompt-injection block aimed at the reviewing model's instruction hierarchy.
  • Tens of thousands of identical repeated comment lines — Socket observed these from approximately line 191 to line 33118 — pushing the file past 3.5 million tokens, well beyond current frontier context windows.
  • Obfuscated JavaScript (the actual payload location) appended at the very end, after all the noise.

The design assumes the scanner reaches the safety/injection content first and the real code last.

What to do

The page states no patch or command — the actionable content is design guidance for anyone running LLM-assisted dependency or code scanning. The named failure modes to defend against:

  • Model refuses analysis on seeing prohibited-weapons content.
  • Model follows fake system instructions embedded in comments.
  • Scanner errors/times out before reaching executable code.
  • Analysis dominated by comment content instead of package behavior.
  • File truncated before the appended obfuscated payload.

Implied mitigations from the text: treat source-code comments as untrusted data, not instructions; do not naively submit whole files; chunk in a way that prioritizes executable code over comment-heavy sections; and ensure the pipeline fails closed rather than open when it refuses or truncates.

flowchart TD
    A[LLM scanner ingests index.js] --> B{Reaches payload?}
    B -->|Refuses / truncates / times out| C[Fails open: package passes]
    B -->|Prioritizes executable code| D[Obfuscated JS at file end reviewed]
    S[Comments treated as untrusted data] --> D

Caveats

  • This is not the credential-stealing payload seen in the related Mini Shai-Hulud, Miasma, and Hades campaigns; it is protestware/PUA, so the direct risk is to your scanning pipeline's reliability, not to secrets.
  • The weapon-instruction and repeated-comment content's "accuracy" is irrelevant — Socket stresses placement and purpose, not feasibility.
  • The page's redacted excerpts mean you cannot reproduce the exact injection strings from it; treat the described failure modes, not specific strings, as the test cases.

Organisations named here

  • Shai-Hulud
  • shai_hulululud

Technologies named here

  • npm registry / npm packages
  • Socket Threat Research
  • AI-based malware scanners
  • shai_hulululud
  • PyPI wheels
  • npm
  • Socket
  • JavaScript
  • Node.js

Techniques named here

  • Prompt injection via source-code comments
  • Safety-triggering anti-analysis content
  • Context/token flooding
  • Staged JavaScript obfuscation
  • Scanner-targeting decoy strings
  • LLM-specific denial-of-service pattern

Threat actors named here

  • Mini Shai-Hulud
  • Miasma
  • Hades
  • shai_hulululud