MAL-2026-5902

See a problem?
Import Source
https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-tokenized/MAL-2026-5902.json
JSON Data
https://api.osv.dev/v1/vulns/MAL-2026-5902
Aliases
  • GHSA-4hvx-q2w4-f48v
Published
2026-06-16T16:22:50Z
Modified
2026-06-17T15:31:51.654428361Z
Summary
Malicious code in chai-as-tokenized (npm)
Details

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

Source: amazon-inspector (55c10da182a0c79ca5eb0f85c6b2e334b7ee4e90946dfcc34feb44e80afa4485)

Package name impersonates chai-as-promised, and the README is a copy of pino's documentation, but the actual code is a remote-code-execution dropper. The exported middleware (advertised as chai.use(chaiAsTokenized)) spawns lib/initializeCaller.js as a detached node child with stdio:'ignore' and child.unref(), hiding output and surviving parent exit. The child shadows the process global with a fake object whose env values are base64 strings, atob-decodes them to obtain https://amethyst-lorrin-26.tiiny.site/index.json and the header x-secret-key: _, fetches JSON from that anonymous tiiny.site endpoint, and passes the response's cookie field to new Function.constructor('require', response) invoked with the live require — granting the remote, attacker-controlled host arbitrary code execution inside the consuming process with full module access. Combined signals: name-impersonation of a popular chai plugin, README mismatch with shipped code, base64-obfuscated C2 URL, anonymous static-file host (not a publisher domain), detached-and-silenced child spawn, and remote response evaluated as JavaScript.

Source: ghsa-malware (fe8e4af381c4b8eb3ff6a93cbd50f27cd0196c86038024c04ad803780f72cae9)

Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that computer should be rotated immediately from a different computer. The package should be removed, but as full control of the computer may have been given to an outside entity, there is no guarantee that removing the package will remove all malicious software resulting from installing it.

Database specific
{
    "malicious-packages-origins": [
        {
            "sha256": "55c10da182a0c79ca5eb0f85c6b2e334b7ee4e90946dfcc34feb44e80afa4485",
            "source": "amazon-inspector",
            "modified_time": "2026-06-16T16:22:50Z",
            "id": "IN-MAL-2026-006793",
            "versions": [
                "7.2.3"
            ],
            "import_time": "2026-06-16T18:10:20.637057475Z"
        },
        {
            "sha256": "fe8e4af381c4b8eb3ff6a93cbd50f27cd0196c86038024c04ad803780f72cae9",
            "source": "ghsa-malware",
            "modified_time": "2026-06-17T13:59:28Z",
            "id": "GHSA-4hvx-q2w4-f48v",
            "ranges": [
                {
                    "type": "SEMVER",
                    "events": [
                        {
                            "introduced": "0"
                        }
                    ]
                }
            ],
            "import_time": "2026-06-17T15:23:59.027578683Z"
        }
    ]
}
References
Credits

Affected packages

npm / chai-as-tokenized

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected

Affected versions

7.*
7.2.3

Database specific

cwes
[
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    },
    {
        "name": "Embedded Malicious Code",
        "description": "The product contains code that appears to be malicious in nature.",
        "cweId": "CWE-506"
    }
]
source
"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-as-tokenized/MAL-2026-5902.json"
indicators
{
    "evidence_files": [
        {
            "sha256": "2a41c6b7c5e256d70f884c613c6412ef73d86f8cd8a65afe6afb64fabaf4e022",
            "tlsh": "f111008d61fc200c056512e6b22f18116022e4273d4ad4e47adc83470f9627fbd536df",
            "path": "lib/initializeCaller.js"
        },
        {
            "sha256": "4d8216a654a4425808841d28009533a48a290c4b259186d287761d502af1ee06",
            "tlsh": "b6019c60ce788e2300ed25825c2a064376658c135928fc1d32db512c0f9d5ff15bf21e",
            "path": "package.json"
        },
        {
            "sha256": "1f51184c197102444a2c8a23e4a8e54a6479750420512922fcb5d5f795c33911",
            "tlsh": "0f318545b5f21259126d98c4f6b4a5263cdf9437331b76b1cded93952bce2080032bc7",
            "path": "index.js"
        }
    ],
    "package_integrity": [
        {
            "hashes": {
                "sha512_sri": "sha512-qQbUdMoy5NuH9wMuxvFs6raZYv9aCQiFQGHMpdK+K5aCKaASuysJJrX+koLUj1RPWW2n6lzHt+HVhWMhKT4H6A==",
                "sha1": "4c64d6512b4b4d9949e47a7d9c815c4aa6cec7d3"
            },
            "filename": "chai-as-tokenized-7.2.3.tgz"
        }
    ]
}