MAL-2026-6438

See a problem?
Import Source
https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/polymarket-stake-math/MAL-2026-6438.json
JSON Data
https://api.osv.dev/v1/vulns/MAL-2026-6438
Published
2026-06-25T05:56:41Z
Modified
2026-06-25T06:31:21.434958316Z
Summary
Malicious code in polymarket-stake-math (npm)
Details

-= Per source details. Do not edit below this line.=-

Source: amazon-inspector (a8a5200cef3811ce98e489080709917dfafc2216a17f90329b9930e0f5f630a1)

The package ships a postinstall hook (scripts/sync-peer.cjs) that runs on every default npm install. The script compares the installed version against a hardcoded TARGET_VERSION ('3.4.0'); because the shipped version is 3.5.0, the mismatch branch always fires. It then invokes execSync('npm pack polymarket-stake-math@3.4.0'...), extracts the resulting tarball, overwrites every file in the installed package directory with the 3.4.0 contents via fs.cpSync(from, to, { recursive: true }), and finally require()s the freshly-overwritten index.js and calls from_str(). This is a stager pattern: the published 3.5.0 tarball is a harmless-looking shell whose only on-install effect is to pull and execute whatever the maintainer (or anyone with publish rights) ships under the 3.4.0 coordinate, with no integrity pinning, no hash check, and against a mutable npm version that can be re-published or overridden. The payload coordinate is also fully controllable through BACKUP_PAYLOAD_SPEC / BACKUP_PACKAGE_NAME / BACKUP_TARGET_VERSION environment variables, so any process that can set env on the build host can redirect the postinstall to fetch and execute an arbitrary npm package (e.g. BACKUP_PAYLOAD_SPEC=evilpkg@1.0.0). The cover-story filename 'sync-peer.cjs', the silent self-overwrite of the on-disk package directory, and the env-var-overridable target all match a known supply-chain dropper shape.

Database specific
{
    "malicious-packages-origins": [
        {
            "import_time": "2026-06-25T06:26:40.981246733Z",
            "source": "amazon-inspector",
            "sha256": "a134247c1d7f7368135b3c03705730b1312e2a6cb16d62f1375539f9b8c37c53",
            "versions": [
                "3.5.1"
            ],
            "id": "IN-MAL-2026-007462",
            "modified_time": "2026-06-25T05:56:41Z"
        },
        {
            "import_time": "2026-06-25T06:26:41.12589131Z",
            "source": "amazon-inspector",
            "sha256": "a8a5200cef3811ce98e489080709917dfafc2216a17f90329b9930e0f5f630a1",
            "versions": [
                "3.5.0"
            ],
            "id": "IN-MAL-2026-007463",
            "modified_time": "2026-06-25T05:56:42Z"
        }
    ]
}
References
Credits

Affected packages

npm / polymarket-stake-math

Package

Name
polymarket-stake-math
View open source insights on deps.dev
Purl
pkg:npm/polymarket-stake-math

Affected ranges

Affected versions

3.*
3.5.0
3.5.1

Database specific

indicators
{
    "evidence_files": [
        {
            "tlsh": "535146d9199263764ab1fba49b32a42efd2780232551d370f6dc56a13f723748222dfc",
            "sha256": "2b2ab1dfc2ada82addbeed382e6cf83f092e399530e530753e181441d3b57cfd",
            "path": "scripts/verify-peer.cjs"
        },
        {
            "tlsh": "9e11c0d44486f237d5b18fa05bbe44827e35c9333f46d181b1dc88e32ba03686652dec",
            "sha256": "be2ec6f84992c1c511bf6d116d73fb7ed6eb3f5f48d36044bb015bc0e2221054",
            "path": "index.js"
        }
    ],
    "package_integrity": [
        {
            "filename": "polymarket-stake-math-3.5.1.tgz",
            "hashes": {
                "sha1": "bb50d647aae9c526629a3c9bc2a33cad2844f00c",
                "sha512_sri": "sha512-i5sxIsOpBibSaXPkD1kYGKNPcwsSzZTbvSOVEu1tdGnCvTA0dKHe9rkzHIysUzfW2Ngg9TyVsBOXWdjukTKklw=="
            }
        }
    ]
}
cwes
[
    {
        "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",
        "cweId": "CWE-506"
    }
]
source
"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/polymarket-stake-math/MAL-2026-6438.json"