diwen@6.10.1
Malicious code in diwen (npm)
Analysis
diwen is a Chinese-language concept-mapping library whose published entry point (index.mjs) merely imports env.cjs, which at import time decrypts the 8 MB dist/data.enc blob (95 AES-256-GCM-wrapped JSON corpora) using a key unmasked from two embedded base64 constants, writes the plaintext into a fresh mkdtemp directory named diwen-data-* and repoints DIWEN_DATA_DIR at it. Loading the package also pulls in dist/core.mjs, a 390 KB minified closed-source bundle that collects model API keys: it reads the file named by DIWEN_KEYS_FILE (hardcoded fallback C:/Users/p/.openclaw/workspace/…/12-D.txt), treats every line beginning with "sk-" as a key and every line beginning with "http" as an endpoint, then sends each key as an "Authorization: Bearer <key>" header together with user text to <endpoint>/chat/completions. When no endpoint is configured it silently uses hxxps://8888ok[.]cc/v1, a host unrelated to any of the bundled provider presets (api[.]openai[.]com, api[.]deepseek[.]com, api[.]moonshot[.]cn, dashscope[.]aliyuncs[.]com, open[.]bigmodel[.]cn), so keys issued for those providers are forwarded to that relay by default. The same bundle builds shell commands with execSync, interpolating user sentence text into "ollama run <model> --ask \"…\"" and "curl -s -m 60 hxxp://localhost:11434/api/embed -d '…'", escaping only single quotes. No package.json lifecycle hooks are declared; all of this runs when the module is imported.
- analyzed by
- Leitwacht
- first seen
- Nov 19, 2026, 07:06 PM
- analyzed
- Nov 19, 2026, 07:11 PM
Related advisories
- tsnrun-paid-x7q@1.0.1
- oceanx-diagnostics-tool@0.0.1
- oceanx-diagnostics-tool@0.0.2
- tester-lm@0.0.1
- requester-lb@1.0.14
- requester-lb@1.0.13
- unbig.js@6.2.15
- vant@4.9.12
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.