MAL-2026-14197

See a problem?
Import Source
https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/twapfetch/MAL-2026-14197.json
JSON Data
https://api.osv.dev/v1/vulns/MAL-2026-14197
Published
2026-08-19T01:16:39Z
Modified
2026-08-19T01:45:11.504987668Z
Summary
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 (PSMPEERURL, PSMSYNCCONFIG, KELLYPEERCONFIG) 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.

Database specific
{
    "malicious-packages-origins": [
        {
            "sha256": "c319f6606c9407d69fa80de43ddc3b133cba284d9356a27cc12d37b3de036b3f",
            "source": "amazon-inspector",
            "versions": [
                "1.1.0"
            ],
            "modified_time": "2026-08-19T01:16:48Z",
            "id": "IN-MAL-2026-018273",
            "import_time": "2026-08-19T01:34:41.350212621Z"
        },
        {
            "id": "IN-MAL-2026-018272",
            "modified_time": "2026-08-19T01:16:39Z",
            "versions": [
                "1.1.1"
            ],
            "source": "amazon-inspector",
            "import_time": "2026-08-19T01:34:41.264462275Z",
            "sha256": "e1c2918d6e515591732bb1841e9c4e4fde77dea9b7507e3bd0704458ea42f64c"
        }
    ]
}
References
Credits

Affected packages

npm / twapfetch

Package

Affected ranges

Affected versions

1.*
1.1.0
1.1.1

Database specific

cwes
[
    {
        "cweId": "CWE-506",
        "description": "The product contains code that appears to be malicious in nature.",
        "name": "Embedded Malicious Code"
    },
    {
        "cweId": "CWE-506",
        "description": "The product contains code that appears to be malicious in nature.",
        "name": "Embedded Malicious Code"
    }
]
source
"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/twapfetch/MAL-2026-14197.json"
indicators
{
    "evidence_files": [
        {
            "path": "scripts/install-check.cjs",
            "sha256": "3e15f1692c4075cf29cefa94c84d564a95086ab7a6838a97ea25cd02475a282d",
            "tlsh": "6ad1659915a272770bb0e7a4cb53a41eeb6394233511c364f6cdc6952ff6164c213dec"
        },
        {
            "path": "package.json",
            "sha256": "2dcdd0629cd8daa8083206b72f279737fb9e67501bbcf1dc7956b37f6ed54f76",
            "tlsh": "9401f737c9604e7729bcdb9879255204f4550b2f31609c4bb1fb812ccfa21a3045fb29"
        }
    ],
    "package_integrity": [
        {
            "hashes": {
                "sha1": "75d7dd111eb9a43670137345b7252d8bf7c40264",
                "sha512_sri": "sha512-tLaAvh3eU6XHGNJQGcFEEdKp8fcwDpqfXUqiegGYDtyAfSOuA3xjqS+sCM+lT8MbUPqWAfHJIs7jlSQMvaF2vQ=="
            },
            "filename": "twapfetch-1.1.0.tgz"
        }
    ]
}