Skip to main content
Mallory
← Back to News
package-repository-poisoningopen-source-dependency-vulnerabilityinitial-access-methodpayload-delivery-evasion

npm Bin Script Confusion Enables Command Hijacking; LavaMoat Adds Mitigation

Supply Chain Risk · 4 sources · Updated 22d ago · First seen Oct 19, 2022

npm Bin Script Confusion Enables Command Hijacking; LavaMoat Adds Mitigation

Socket disclosed an npm supply-chain technique in October 2022 that allows malicious packages to export executables named node or npm, potentially hijacking legitimate commands during subsequent npm workflows. The technique, dubbed bin script confusion, can arrive through transitive dependencies and remains possible when installation lifecycle scripts are disabled, because that setting does not prevent executable exports. Installation alone does not trigger the payload: a subsequent command must resolve to the malicious executable. Developer workstations and build systems could consequently expose code and credentials. Earlier fixes addressed related arbitrary file-overwrite issues, but GitHub told researchers the remaining behavior was working as designed and would not be addressed.

MetaMask highlighted the risk in its October security report and reported in December that LavaMoat’s @lavamoat/allow-scripts had released experimental bin-confusion protection for npm and Yarn 1 projects. Organizations should assess this mitigation rather than rely solely on disabling installation scripts, and review dependency-provided executables for command-name collisions. Separately, the December report highlighted Volexity’s findings on Lazarus-linked AppleJeus malware delivered through fake cryptocurrency applications and malicious Office documents. That campaign bundled legitimate trading software with malware and used chained DLL side-loading; it was not identified as exploiting npm bin confusion. Together, the reports underscore distinct risks from untrusted dependencies and trojanized applications, with Volexity recommending Office macro restrictions, scheduled-task monitoring, and detection using published indicators and YARA rules.

Does this reach your builds?Trace attribution and downstream blast radius.
Trace the chain
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

20 events · 2019 – Dec 2022
  1. Reported Dec 1, 20224y ago

    Volexity reveals AppleJeus installers and chained DLL side-loading

    Volexity analyzed a BloxHolder MSI that bundled QTBitcoinTrader with AppleJeus and used a scheduled task plus chained DLL side-loading to execute a downloader. Its report also detailed a heavily obfuscated variant with a different network protocol and published detection guidance and indicators.

    ₿uyer ₿eware: Fake Cryptocurrency Applications Serving as Front for AppleJeus Malware | Volexity
  2. Dec 2022

    MetaMask and Laconic launch MobyMask

    MetaMask and Laconic launched the MobyMask anti-phishing initiative.

    MetaMask Crypto Security Report: December 2022
  3. Dec 2022

    MetaMask's HackerOne bug bounty program passes 100 researchers

    MetaMask reported that its HackerOne bug bounty program had passed the milestone of 100 researchers.

    MetaMask Crypto Security Report: December 2022
  4. Dec 2022

    Social engineering scam steals 14 Bored Apes

    A month-long social engineering scam drained 14 Bored Ape NFTs valued at approximately $1.07 million.

    MetaMask Crypto Security Report: December 2022
  5. Dec 2022

    Node.js Security Working Group proposes a process-level Permission Model

    The Node.js Security Working Group proposed a process-level Permission Model described as complementary to LavaMoat's per-package security approach.

    MetaMask Crypto Security Report: December 2022
  6. Dec 2022

    Endo's compartment-mapper bundler passes a CommonJS proof of concept

    Endo advanced its compartment-mapper bundler by passing an initial CommonJS proof of concept.

    MetaMask Crypto Security Report: December 2022
  7. Dec 2022

    LavaMoat releases experimental protection against bin confusion

    LavaMoat released @lavamoat/allow-scripts with the --experimental-bins flag to protect npm and Yarn 1 projects against malicious packages hijacking CLI commands through bin exports.

    MetaMask Crypto Security Report: December 2022
  8. Reported Oct 19, 20224y ago

    GitHub declines remediation of npm bin script confusion

    Researchers submitted their findings through GitHub's bug bounty program. GitHub responded that the functionality was working as designed, was not considered a security vulnerability, and was not planned for remediation.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
  9. Reported Oct 19, 20224y ago

    npm registry scan finds no exploitation of disclosed overwrite and symlink flaws

    After the earlier disclosure, npm reported that its registry scan found no published packages exploiting the arbitrary file overwrite or symlink creation aspects.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
  10. Reported Oct 19, 20224y ago

    npm and Node.js fix major arbitrary file overwrite issues

    Following the earlier disclosures, npm and Node.js released updates addressing major arbitrary file overwrite issues. The changes did not eliminate all attack vectors involving bin exports.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
  11. Oct 19, 20224y ago

    Researchers disclose npm bin script confusion and a harmless proof of concept

    Mikola Lysenko, Ax Sharma, and Feross Aboukhadijeh published research showing how malicious bin exports named node or npm can hijack subsequent commands, including after installation with --ignore-scripts. Their npm-bin-script-poc package demonstrated the technique with a harmless payload.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
  12. Oct 2022

    Volexity discovers an AppleJeus campaign using malicious Excel documents

    Volexity discovered a Lazarus-linked Excel lure named “OKX Binance & Huobi VIP fee comparision.xls.” Its multistage macros downloaded an OpenDrive-hosted payload containing a legitimate executable, a side-loaded DLL, and an encoded payload.

    ₿uyer ₿eware: Fake Cryptocurrency Applications Serving as Front for AppleJeus Malware | Volexity
  13. Reported Sep 30, 20224y ago

    MetaMask holds a Security Essentials community call

    More than 4,000 attendees joined MetaMask's community Security Essentials call.

    MetaMask Crypto Security Report: October 2022
  14. Reported Sep 30, 20224y ago

    MetaMask publishes JavaScript realms research

    MetaMask published Gal Weizman's technical exploration of JavaScript realms.

    MetaMask Crypto Security Report: October 2022
  15. Reported Sep 30, 20224y ago

    MetaMask presents security research at Devcon VI

    MetaMask delivered two security talks at Devcon VI in Bogotá.

    MetaMask Crypto Security Report: October 2022
  16. Reported Sep 30, 20224y ago

    LavaMoat adds global scuttling and a programmatic API

    LavaMoat added global scuttling and a programmatic API as part of the developments covered in MetaMask's October security report.

    MetaMask Crypto Security Report: October 2022
  17. Reported Sep 30, 20224y ago

    Endo releases SES v0.17.0 with evaluator isolation improvements

    Endo released SES v0.17.0 with the “quadruple backflip” evaluator refactor, fixing a scope-proxy leak and separating global-scope handling into layers. The release allowed LavaMoat to use the unmodified SES shim instead of maintaining custom patches.

    MetaMask Crypto Security Report: October 2022
  18. Jun 2022

    Lazarus registers BloxHolder domain for a fake cryptocurrency trading site

    The Lazarus Group registered bloxholder[.]com and hosted a cryptocurrency trading-themed website largely cloned from HaasOnline, with the branding changed to BloxHolder.

    ₿uyer ₿eware: Fake Cryptocurrency Applications Serving as Front for AppleJeus Malware | Volexity
  19. 2021

    ReversingLabs identifies malicious use of npm bin exports

    ReversingLabs analyzed the malicious nodejs_net_server package and found that it abused bin exports to remap the location of the legitimate jstest package.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
  20. 2019

    Daniel Ruf demonstrates security issues involving package bin scripts

    Daniel Ruf demonstrated bin-script security issues involving arbitrary symlink generation in Yarn and arbitrary file writes or overwrites in npm.

    npm bin script confusion: Abusing ‘bin’ to hijack ‘node’ command | Socket
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, breaches, and observables Mallory has linked to this story. Indicator values are masked here and available in full in the app.

Open in app →

Affected products

1 linked
Node.Js

Organizations

1 linked
npm, Inc.

Observables

32 linked

Indicator values are masked on this page. View all 32 in Mallory Domains, IPs, hashes, and URLs are exportable to your SIEM.

Do you run this?See attribution and downstream blast radius, and whether this package or vendor reaches your builds.
Trace the Supply Chain
Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.