npm Bin Script Confusion Enables Command Hijacking; LavaMoat Adds Mitigation
Supply Chain Risk · 4 sources · Updated 22d ago · First seen Oct 19, 2022

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.


