Skip to content
Heist/ feed
Unrated

Malicious code in chai-foundry (npm)

Type: advisorySource: OSV1 source record

--- _-= Per source details. Do not edit below this line.=-_ ## Source: amazon-inspector (94e40493af5310c6ee769911bff65e55538911ae3f286fba2a3474f9f8a38940) chai-foundry@7.0.2 is a trojan package presenting itself as a chai plugin (README shows `chai.use(chaiLeaf)`) while its badges, documentation, and internal version metadata (`lib/meta.js` exports version `9.6.0`) are copied from the pino logger. The package's main entry `index.js` immediately loads `./lib/config`, a 3.5MB file that is heavily obfuscated with obfuscator.io-class transforms: a rotated string array of 20,855 entries, two runtime decoder functions, tens of thousands of decoder-wrapper indirections, and control-flow flattening (104,934 deobfuscation changes reported by webcrack). The file begins with a top-level IIFE, so its opaque body runs automatically the moment any consumer calls `require('chai-foundry')`. All destinations and string constants are reconstructed at runtime, so the payload's network endpoints and behaviors are hidden from static inspection. The combination of identity impersonation, mismatched metadata, and a multi-megabyte control-flow-flattened import-time loader in a package advertised as a small chai plugin is the canonical shape of a hostile npm dropper/stealer. ## Source: ghsa-malware (7493f27a9dde87cd284125de3d582e1cd94870a2c4bac65ae9c6f1d764dfbee0) Any computer that has this package installed or running should be considered fully compromised. All secrets and keys stored on that comput

Announced Source revision 1
Original source ↗

MAL-2026-13356

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: osv:MAL-2026-13356

chai-foundry

Source reference: /affected/0/package/name

Affected versions
7.0.3

Source reference: /affected/0/versions

7.0.2

Source reference: /affected/0/versions

Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "ranges": [
      {
        "type": "SEMVER",
        "events": [
          {
            "introduced": "0"
          }
        ]
      }
    ],
    "package": {
      "name": "chai-foundry",
      "purl": "pkg:npm/chai-foundry",
      "ecosystem": "npm"
    },
    "versions": [
      "7.0.3",
      "7.0.2"
    ],
    "database_specific": {
      "cwes": [
        {
          "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",
          "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."
        }
      ],
      "source": "https://github.com/ossf/malicious-packages/blob/main/osv/malicious/npm/chai-foundry/MAL-2026-13356.json",
      "indicators": {
        "evidence_files": [
          {
            "path": "index.js",
            "tlsh": "0421149124d560ce9938dac0f6306115acdbc677260752b3bdfc97c927860080161fba",
            "sha256": "4e6c4e61a7019ab0affe9c2d20e36701b330ec357be205930355bac1464f9316"
          },
          {
            "path": "lib/config.js",
            "tlsh": "261652d88984d123d3de9b13fe14a9a8f1fa79a6d4cce40b86987d4d29fc847d4a0cd4",
            "sha256": "8397643af68793d57aec3637e79324e9183d6f1168009cd0676432515e88c515"
          },
          {
            "path": "package.json",
            "tlsh": "c0019e24de789e2304fd25524c2a06037a614c175528fc2932db612c4f5d5ff41ff21d",
            "sha256": "8f82750cc52cd72a3f3f941a3474b192a18cac0c56acdfbe35bfd6d8cf602d10"
          }
        ],
        "package_integrity": [
          {
            "hashes": {
              "sha1": "16fad30993d42f54098d3873a08527f0e3057aaa",
              "sha512_sri": "sha512-98Lhn+hs8c34dV82aVYJYuuJJ6PcoUQpi3lJr9Zp156eSXA5YEHpt6lt+tRzhQemoxCbNvn49bWPVixqpXATmA=="
            },
            "filename": "chai-foundry-7.0.3.tgz"
          }
        ]
      }
    }
  }
]

Publisher severity

No explicit severity was provided.

Event
#10872 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement