Skip to content
supplychainattack.orgSupply chain attack incident catalog
containedcritical

Malicious code in @nestjs-passport/jwt (npm)

A malicious npm package @nestjs-passport/jwt was published under a scope resembling official NestJS packages. The package contains JSFuck-encoded obfuscated code (~2.3MB) that executes hidden functionality at require/import time in the installer's Node process.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
Any npm user who installed @nestjs-passport/jwt; code execution occurs at require/import time in the installer's Node process.
Ecosystems
Attack vectors
Affected entities
  • @nestjs-passport/jwtMalicious package published under @nestjs-passport scope, typosquatting the official @nestjs/jwt and @nestjs/passport packages

A malicious npm package named @nestjs-passport/jwt was published under the @nestjs-passport scope, designed to resemble the official @nestjs/jwt and @nestjs/passport packages. This is a typosquatting attack targeting developers seeking JWT authentication utilities for NestJS.

The package's sole entrypoint files (dist/index.cjs and dist/index.js) contain a single-line JSFuck-encoded string approximately 2.3MB in size, consisting of permutations of JavaScript operators (!+[], !![], +[]). This obfuscated code is passed to new Function('jose', ) and invoked at require/import time, executing hidden code within the installer's Node process every time the module is loaded.

The package advertises itself as a minimal HS256 JWT helper, a task that would normally require only a few lines of jose library calls. However, the shipped TypeScript declarations expose obfuscated private field names such as _0x5f2e and _0x4b19, which are inconsistent with the declared tsup build tooling, indicating intentional obfuscation rather than legitimate compilation artifacts.

The combination of scope-level typosquatting, whole-module JSFuck obfuscation, and dynamic evaluation of the obfuscated payload at import time creates a concealment-and-execution vehicle that allows arbitrary code to run inside the installer's process without any readable code path for detection.

Indicators of compromise

Packages
  • @nestjs-passport/jwt

Remediation

  • Immediately uninstall @nestjs-passport/jwt from all projects and dependencies
  • Audit npm install logs and package-lock.json files to identify if this package was ever installed
  • If the package was installed, assume the Node process was compromised and regenerate any secrets, tokens, or credentials that may have been accessible
  • Use the official @nestjs/jwt and @nestjs/passport packages instead
  • Implement npm package name verification and allowlisting in your dependency management process
  • Monitor for similar typosquatting attempts targeting @nestjs packages

Sources

  1. GitHub Advisory GHSA-h677-7mjr-8f76 · GitHub Advisory Database

Cite this entry

"Malicious code in @nestjs-passport/jwt (npm)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed August 7, 2026; last updated August 7, 2026. https://supplychainattack.org/incident/malicious-code-in-nestjs-passport-jwt-npm-2bq0uc

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. resolvedcritical

    Malicious code in depcruise-wrap-stream-in-html (npm)

    depcruise-wrap-stream-in-html@99.9.1 is a malicious npm package that mimics an internal helper of dependency-cruiser. It is a hollow package that downloads and executes arbitrary code from a Google Cloud Storage bucket during installation.

    npmCompromised packageDependency confusionTyposquatting
  2. resolvedcritical

    Malicious code in akamai-sensor (npm)

    A malicious npm package named akamai-sensor impersonated Akamai's legitimate sensor_data anti-bot SDK. The package contained hidden JavaScript code concealed using invisible Unicode characters and implemented a dynamic command-and-control channel via a Google Calendar dead-drop, enabling arbitrary code execution on installation.

    npmCompromised packageTyposquatting
  3. resolvedcritical

    Malicious code in @finaxis/common-js (npm)

    The npm package @finaxis/common-js was published with a README and keywords copied from lodash v4.18.1, but contained a heavily obfuscated Xelis (XEL) proof-of-work cryptominer instead of lodash functionality. Consumers installing this package would unknowingly run a covert CPU/GPU miner on their systems.

    npmCompromised packageTyposquatting
  4. containedcritical

    Malicious code in @polymarkets/clob-client-v2 (npm)

    @polymarkets/clob-client-v2 (npm) is a malicious package that typosquats the legitimate @polymarket scope and redirects its inquirer dependency to a lookalike npm registry (registrynpmjs.to) to deliver arbitrary code execution during installation and on first require.

    npmTyposquattingCompromised packageDependency confusion