# MAL-2026-6995: Malicious code in chai-redirection (npm)


- **Type:** Malicious package
- **Package:** `chai-redirection` (npm)
- **Published:** 8 Jul 2026
- **Also known as:** GHSA-89c7-5mf7-c86r

## What is MAL-2026-6995?

MAL-2026-6995 is a malicious package in chai-redirection, published on 8 Jul 2026. 

### Official description

chai-redirection presents itself as a chai assertion plugin but its main entry (index.js) unconditionally spawns a detached Node child process running lib/caller.js the moment the package is required. caller.js issues an HTTPS GET to https://www.jsonkeeper.com/b/PC5CK (a mutable pastebin-style host) and passes the response body's `cookie` field to `new Function('require', res.data.cookie)(require)`, executing attacker-controlled JavaScript in the installer's Node process with full `require` access. A secondary code path builds a URL from lib/config values, and on a 404 response whose body carries a `token` field, constructs `new Function.constructor('require', res.token)` and invokes it with `require` — a second remote-code-execution channel. The advertised chai plugin API (validJWT, safeString, etc.) is a cover story: the loader runs before any exports are used, so merely requiring this package as a chai plugin triggers remote code execution. The mutable pastebin source means today's payload can be replaced with anything at any time without republishing the package.

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.

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

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-6995 is a malicious package: chai-redirection (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-6995/ (Markdown: https://insights.sbomify.com/MAL-2026-6995/index.md)
```

## Sources

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

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