# MAL-2026-6393: Malicious code in chai-as-predicted (npm)


- **Type:** Malicious package
- **Package:** `chai-as-predicted` (npm)
- **Published:** 24 Jun 2026

## What is MAL-2026-6393?

MAL-2026-6393 is a malicious package in chai-as-predicted, published on 24 Jun 2026. 

### Official description

Package name 'chai-as-predicted' impersonates the popular 'chai-as-promised' assertion library, but ships unrelated code disguised as pino logger internals. The exported middleware in index.js spawns a detached background Node process running lib/initializeCaller.js as soon as a consumer invokes it. lib/initializeCaller.js base64-decodes a hardcoded URL (https://amethyst-lorrin-26.tiiny.site/index.json) and a custom 'x-secret-key' header, performs an HTTP GET with retries, and passes the response body's.data.cookie field to `new Function.constructor('require', response)` which is then invoked with the real require — executing attacker-controlled JavaScript with full Node privileges on the installer's machine. The C2 URL and headers are stored as base64 strings inside a fake `process.env` object and decoded with atob() at runtime to evade plaintext URL scanning. The destination is an anonymous free-hosting domain with mutable, unauthenticated content. Consumers tricked by the typosquat name into requiring this package and calling its middleware will execute arbitrary remote code.

## What should I do about MAL-2026-6393?

Remove the package from your dependencies and lockfiles, then rotate any secrets on machines where it was installed.

## Fix prompt for AI coding agents

```text
MAL-2026-6393 is a malicious package: chai-as-predicted (npm). Every version was published to cause harm.

Task:
1. Search this repository's dependency manifests and lockfiles for the package, including transitive dependencies.
2. If it is present, remove it, regenerate the lockfile with the project's package manager, and replace whatever it was used for.
3. List any CI runners, developer machines or containers that installed it, so their secrets can be rotated.
4. If the package is not used anywhere, say so and change nothing.

Reference: https://insights.sbomify.com/MAL-2026-6393/ (Markdown: https://insights.sbomify.com/MAL-2026-6393/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/MAL-2026-6393

---
From sbomify Insights: https://insights.sbomify.com/MAL-2026-6393/
Summaries are generated and may contain mistakes; the official description above is the record.
