Malicious code in @dervix/ws (npm)
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (79b9ab7431b1a6a1250c089e2ea33f54ad92313f587fbd2aabc020c12be55f69) Package `@dervix/ws` impersonates the popular `ws` WebSocket library — `package.json` copies the legitimate ws project's homepage (`https://github.com/websockets/ws`), repository, and author metadata while publishing under an unrelated scope. `lib/websocket.js` appends ~130KB of heavily obfuscated code after the genuine `socketOnError` function; this payload executes at `require()` time via `index.js`. On import the payload (1) re-spawns the current Node process detached with `stdio:'ignore'` and `windowsHide:true`, gated by an obfuscated marker env var so the parent returns cleanly while a daemonized child continues; (2) constructs an AES-256 key by XOR-combining four hardcoded hex Buffers; (3) issues an HTTPS GET (following 3xx redirects) to an encrypted-in-source URL, streams the response to a file under `os.tmpdir()`, and decrypts it via `createDecipheriv`; (4) `fs.chmodSync(path, 0o755)` and `child_process.spawn(path,...)` with `detached:true` then `unref()`s it. Dynamic `import('child_process')` / `import('path')` is used to defeat static `require` audits, and an `inspector.url()` check short-circuits execution when a debugger is attached. There is no signature verification, no version pinning, and the destination URL is RC4-decoded at runtime so it cannot be inspected statically. Combined with the cloned ws metadata, this is a deliberate typosquat dropper that lands and executes attacker-controlled binary code on any machine that installs and imports the package. ## Source: ghsa-malware (b0c3046401ca7c230339c585db9d1e925c670b5739209048b6d29f88b14ddc01) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
AI Analysis
Technical Summary
The @dervix/ws package is a deliberate typosquatting attack targeting the popular ws WebSocket library. It copies legitimate metadata to appear authentic but contains a ~130KB obfuscated payload in lib/websocket.js that executes immediately on require(). The payload respawns the Node.js process in a detached mode, constructs an AES-256 key from hardcoded buffers, and downloads an encrypted payload from an obfuscated URL. This payload is decrypted and executed with elevated permissions. Dynamic imports and debugger detection are used to evade detection. There is no signature verification or version pinning, allowing attacker-controlled code execution on any system importing this package.
Potential Impact
This malicious package enables remote code execution by downloading and running attacker-controlled binaries on any system that installs and imports @dervix/ws. The attacker gains the ability to execute arbitrary code with the privileges of the Node.js process, potentially leading to full system compromise. The obfuscation and evasion techniques make detection and static analysis difficult, increasing the risk of unnoticed compromise.
Mitigation Recommendations
No official patch or remediation is available for this malicious package. The best mitigation is to avoid installing or importing @dervix/ws, especially versions =8.21.3 and =8.21.4. Users should verify package names carefully to avoid typosquatting attacks and rely only on official, trusted sources. Monitoring for and removing this package from environments is recommended. Since this is a malicious package rather than a vulnerability in legitimate software, remediation involves removing the package and any spawned malicious processes or binaries.
Malicious code in @dervix/ws (npm)
Description
--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (79b9ab7431b1a6a1250c089e2ea33f54ad92313f587fbd2aabc020c12be55f69) Package `@dervix/ws` impersonates the popular `ws` WebSocket library — `package.json` copies the legitimate ws project's homepage (`https://github.com/websockets/ws`), repository, and author metadata while publishing under an unrelated scope. `lib/websocket.js` appends ~130KB of heavily obfuscated code after the genuine `socketOnError` function; this payload executes at `require()` time via `index.js`. On import the payload (1) re-spawns the current Node process detached with `stdio:'ignore'` and `windowsHide:true`, gated by an obfuscated marker env var so the parent returns cleanly while a daemonized child continues; (2) constructs an AES-256 key by XOR-combining four hardcoded hex Buffers; (3) issues an HTTPS GET (following 3xx redirects) to an encrypted-in-source URL, streams the response to a file under `os.tmpdir()`, and decrypts it via `createDecipheriv`; (4) `fs.chmodSync(path, 0o755)` and `child_process.spawn(path,...)` with `detached:true` then `unref()`s it. Dynamic `import('child_process')` / `import('path')` is used to defeat static `require` audits, and an `inspector.url()` check short-circuits execution when a debugger is attached. There is no signature verification, no version pinning, and the destination URL is RC4-decoded at runtime so it cannot be inspected statically. Combined with the cloned ws metadata, this is a deliberate typosquat dropper that lands and executes attacker-controlled binary code on any machine that installs and imports the package. ## Source: ghsa-malware (b0c3046401ca7c230339c585db9d1e925c670b5739209048b6d29f88b14ddc01) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The @dervix/ws package is a deliberate typosquatting attack targeting the popular ws WebSocket library. It copies legitimate metadata to appear authentic but contains a ~130KB obfuscated payload in lib/websocket.js that executes immediately on require(). The payload respawns the Node.js process in a detached mode, constructs an AES-256 key from hardcoded buffers, and downloads an encrypted payload from an obfuscated URL. This payload is decrypted and executed with elevated permissions. Dynamic imports and debugger detection are used to evade detection. There is no signature verification or version pinning, allowing attacker-controlled code execution on any system importing this package.
Potential Impact
This malicious package enables remote code execution by downloading and running attacker-controlled binaries on any system that installs and imports @dervix/ws. The attacker gains the ability to execute arbitrary code with the privileges of the Node.js process, potentially leading to full system compromise. The obfuscation and evasion techniques make detection and static analysis difficult, increasing the risk of unnoticed compromise.
Mitigation Recommendations
No official patch or remediation is available for this malicious package. The best mitigation is to avoid installing or importing @dervix/ws, especially versions =8.21.3 and =8.21.4. Users should verify package names carefully to avoid typosquatting attacks and rely only on official, trusted sources. Monitoring for and removing this package from environments is recommended. Since this is a malicious package rather than a vulnerability in legitimate software, remediation involves removing the package and any spawned malicious processes or binaries.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-6496
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a3ef7c927e9c79719000244
Added to database: 06/26/2026, 22:06:01 UTC
Last enriched: 07/13/2026, 10:13:24 UTC
Last updated: 07/27/2026, 08:41:29 UTC
Views: 41
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.