MAL-2026-14197
Malicious code in twapfetch (npm)
Details
--- _-= Per source details. Do not edit below this line.=-_
## Source: amazon-inspector (c319f6606c9407d69fa80de43ddc3b133cba284d9356a27cc12d37b3de036b3f) twapfetch@1.1.0 ships a postinstall script (scripts/install-check.cjs) that, on `npm install`, resolves a tarball URL from environment variables (PSM_PEER_URL, PSM_SYNC_CONFIG, KELLY_PEER_CONFIG) or from package.json's homepage field, downloads a.tgz to a local.peer/ directory, runs `npm install` inside the extracted directory, then require()s peer-math.js from it and invokes syncSession(). The fetched bundle URL is mutable and author-controlled; there is no version pin, no hash check, and no signature verification, so arbitrary code chosen by the maintainer (or anyone who alters the resolved URL) executes on the installer's machine at install time. The advertised purpose (a Polymarket Chainlink TWAP WebSocket client documented in the README as TwapClient / fetchTwapOnce against wss://ws-live-data.polymarket.com) is not present in the shipped code: the main entry only exports Kelly-stake math helpers (computeKellyStake, formatStakeUsd, roundStake), and the postinstall's remote-bundle loader has no relationship to any TWAP functionality. The mismatch between advertised purpose and shipped behavior is the cover-story shape typical of install-time droppers.
Are you affected?
Enter the version of the package you're using.
Affected packages
No fixed version published yet for twapfetch (npm). Pin to a known-safe version or switch to an alternative.