MAL-2026-10047

See a problem?
Import Source
https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-staged/MAL-2026-10047.json
JSON Data
https://api.osv.dev/v1/vulns/MAL-2026-10047
Published
2026-07-09T15:34:00Z
Modified
2026-07-09T16:31:53.189754413Z
Summary
Malicious code in chai-as-staged (npm)
Details

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

Source: amazon-inspector (84d908f9158abcdd631b569f812b06cb59a1788f2435dd05a47fd39021d60a49)

Package name impersonates the popular chai-as-promised testing library and the README is copied from pino. The advertised usage chai.use(chaiAsStaged) triggers a detached node child process that runs lib/initializeCaller.js. That file hides its C2 endpoint and a custom HTTP header name/value as base64 strings stored under decoy names (DEV_API_KEY, DEV_SECRET_KEY, DEV_SECRET_VALUE) inside a fake local process object; at runtime it base64-decodes the URL to https://amethyst-lorrin-26.tiiny.site/index.json, fetches it with the obfuscated header, extracts the .cookie field from the JSON response, and executes the returned JavaScript via new Function.constructor('require', response)(require) in a retry loop. Attacker-controlled code is therefore executed on the installer's machine with full require access whenever the library is used as documented. The combination of name/README impersonation, base64-obfuscated C2 on an anonymous static-hosting host, and dynamic code construction with require removes any benign interpretation.

Database specific
{
    "malicious-packages-origins": [
        {
            "import_time": "2026-07-09T16:20:44.65683469Z",
            "source": "amazon-inspector",
            "sha256": "84d908f9158abcdd631b569f812b06cb59a1788f2435dd05a47fd39021d60a49",
            "versions": [
                "6.0.4"
            ],
            "id": "IN-MAL-2026-009139",
            "modified_time": "2026-07-09T15:34:00Z"
        }
    ]
}
References
Credits

Affected packages

npm / chai-as-staged

Package

Affected ranges

Affected versions

6.*
6.0.4

Database specific

indicators
{
    "evidence_files": [
        {
            "tlsh": "0f318545b5f21259126d98c4f6b4a5263cdf9437331b76b1cded93952bce2080032bc7",
            "sha256": "1f51184c197102444a2c8a23e4a8e54a6479750420512922fcb5d5f795c33911",
            "path": "index.js"
        },
        {
            "tlsh": "f111008d61fc200c056512e6b22f18116022e4273d4ad4e47adc83470f9627fbd536df",
            "sha256": "2a41c6b7c5e256d70f884c613c6412ef73d86f8cd8a65afe6afb64fabaf4e022",
            "path": "lib/initializeCaller.js"
        }
    ],
    "package_integrity": [
        {
            "filename": "chai-as-staged-6.0.4.tgz",
            "hashes": {
                "sha1": "3ef5b4709cfd792b1345ebe3ae22a956f58fe7ff",
                "sha512_sri": "sha512-tFDk65d/L3uLXuRyFZPvxCOHurxZX4gkrlx4FGpxaq+hlP69Q9ZDS9HluwjTSCPnXSWMmNbukr1JEquw8zWwlw=="
            }
        }
    ]
}
cwes
[
    {
        "cweId": "CWE-506",
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature."
    }
]
source
"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-staged/MAL-2026-10047.json"