mal-2026-6544
Vulnerability from ossf_malicious_packages
Published
2026-06-27 02:32
Modified
2026-06-30 16:09
Summary
Malicious code in chai-as-persisted (npm)
Details

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

Source: amazon-inspector (5cf9c49450e0fa0d47be1b6ae27991f844868ff6c435d2082948b5feae862709)

The package's postinstall script (npm run smoke:pino) executes index.js, which spawns a detached node lib/initializeCaller.js child. That module hides the C2 URL in base64 strings stored under a fabricated local process.env object (keys DEV_API_KEY, DEV_SECRET_KEY, DEV_SECRET_VALUE) to defeat trivial string scanning. At install time it atob()-decodes the URL to https://www.ipregionchecker.org/api/ip-check-encrypted/3aeb34a37, POSTs to it via axios, and passes the response body to new Function.constructor('require', response), invoking it with require — executing attacker-controlled JavaScript with full Node module access on the installer's machine. The detached child.unref() keeps execution alive after npm install returns. The package name chai-as-persisted is a one-edit impersonation of the widely-used chai-as-promised; the shipped code is unrelated to chai (it pretends to be a pino-style logger middleware in index.js) and the package description/keywords (logger/stream/json) further misrepresent its purpose. This is a deliberate install-time RCE dropper distributed via a typosquat against chai-as-promised.

Source: ghsa-malware (0ace79847a477da41888731730b793f631973178603034abe9016e81caffd10a)

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.

CWE
  • CWE-506 - The product contains code that appears to be malicious in nature.
  • CWE-506 - The product contains code that appears to be malicious in nature.
  • CWE-506 - The product contains code that appears to be malicious in nature.
Credits

{
  "affected": [
    {
      "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"
          },
          {
            "cweId": "CWE-506",
            "description": "The product contains code that appears to be malicious in nature.",
            "name": "Embedded Malicious Code"
          }
        ],
        "indicators": {
          "evidence_files": [
            {
              "path": "lib/initializeCaller.js",
              "sha256": "76ca537732f161ae4d3a78b876390ddbab16e001c392a74009b31fb91ce4f89b",
              "tlsh": "4d119c4d71f82008042151e5b62f14126025e4673d8ad5e4bacc834b1fa667fbd53adf"
            },
            {
              "path": "package.json",
              "sha256": "f061b9cb90a2c542ba90a73748290ff65dc070f811f75772bbfd0cc4453e0cbb",
              "tlsh": "d0019720debc4e2305ed25860c2a06037a615c175528fc2833e7922c0f9d5bb00ff22e"
            }
          ],
          "package_integrity": [
            {
              "filename": "chai-as-persisted-4.2.8.tgz",
              "hashes": {
                "sha1": "f81cd3b1b4fa7eb57ab85af8d81f00ae94b10c89",
                "sha512_sri": "sha512-OF+BlgV0u9rUuZYMvemtJ0jtoutqeNa8QgGbcduKIJEtdzrvqyHPkXKiBLwOBjOV6NQZL/j/0XmtVd9hDuBy+Q=="
              }
            }
          ]
        }
      },
      "package": {
        "ecosystem": "npm",
        "name": "chai-as-persisted"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "SEMVER"
        }
      ],
      "versions": [
        "4.2.8",
        "6.1.9"
      ]
    }
  ],
  "aliases": [
    "GHSA-4wm6-vmww-2544"
  ],
  "credits": [
    {
      "contact": [
        "inspector-research@amazon.com"
      ],
      "name": "Amazon Inspector",
      "type": "FINDER"
    }
  ],
  "database_specific": {
    "malicious-packages-origins": [
      {
        "id": "IN-MAL-2026-007675",
        "import_time": "2026-06-27T03:13:09.022299524Z",
        "modified_time": "2026-06-27T02:32:37Z",
        "ranges": [
          {
            "events": [
              {
                "introduced": "0"
              }
            ],
            "type": "SEMVER"
          }
        ],
        "sha256": "5cf9c49450e0fa0d47be1b6ae27991f844868ff6c435d2082948b5feae862709",
        "source": "amazon-inspector",
        "versions": [
          "4.2.8"
        ]
      },
      {
        "id": "IN-MAL-2026-007674",
        "import_time": "2026-06-27T03:13:08.872578262Z",
        "modified_time": "2026-06-27T02:32:25Z",
        "ranges": [
          {
            "events": [
              {
                "introduced": "0"
              }
            ],
            "type": "SEMVER"
          }
        ],
        "sha256": "611d869aaf9d1a8b945c83cc9982fd76cd49a26563d444af3cee98ccb5b6fbda",
        "source": "amazon-inspector",
        "versions": [
          "6.1.9"
        ]
      },
      {
        "id": "GHSA-4wm6-vmww-2544",
        "import_time": "2026-06-30T16:08:01.44831937Z",
        "modified_time": "2026-06-30T15:59:31Z",
        "ranges": [
          {
            "events": [
              {
                "introduced": "0"
              }
            ],
            "type": "SEMVER"
          }
        ],
        "sha256": "0ace79847a477da41888731730b793f631973178603034abe9016e81caffd10a",
        "source": "ghsa-malware"
      }
    ]
  },
  "details": "\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (5cf9c49450e0fa0d47be1b6ae27991f844868ff6c435d2082948b5feae862709)\nThe package\u0027s postinstall script (`npm run smoke:pino`) executes index.js, which spawns a detached `node lib/initializeCaller.js` child. That module hides the C2 URL in base64 strings stored under a fabricated local `process.env` object (keys `DEV_API_KEY`, `DEV_SECRET_KEY`, `DEV_SECRET_VALUE`) to defeat trivial string scanning. At install time it `atob()`-decodes the URL to `https://www.ipregionchecker.org/api/ip-check-encrypted/3aeb34a37`, POSTs to it via axios, and passes the response body to `new Function.constructor(\u0027require\u0027, response)`, invoking it with `require` \u2014 executing attacker-controlled JavaScript with full Node module access on the installer\u0027s machine. The detached `child.unref()` keeps execution alive after `npm install` returns. The package name `chai-as-persisted` is a one-edit impersonation of the widely-used `chai-as-promised`; the shipped code is unrelated to chai (it pretends to be a pino-style logger middleware in index.js) and the package description/keywords (logger/stream/json) further misrepresent its purpose. This is a deliberate install-time RCE dropper distributed via a typosquat against chai-as-promised.\n\n## Source: ghsa-malware (0ace79847a477da41888731730b793f631973178603034abe9016e81caffd10a)\nAny 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.\n",
  "id": "MAL-2026-6544",
  "modified": "2026-06-30T16:09:50Z",
  "published": "2026-06-27T02:32:25Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://www.npmjs.com/package/chai-as-persisted/v/4.2.8"
    },
    {
      "type": "PACKAGE",
      "url": "https://www.npmjs.com/package/chai-as-persisted/v/6.1.9"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/advisories/GHSA-4wm6-vmww-2544"
    }
  ],
  "schema_version": "1.7.4",
  "summary": "Malicious code in chai-as-persisted (npm)"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…