|
| 1 | +# Supply Chain Attack Demo — Mini Shai-Hulud |
| 2 | + |
| 3 | +A safe, educational demonstration of a supply chain attack modeled on |
| 4 | +[Mini Shai-Hulud](https://thehackernews.com/2026/05/mini-shai-hulud-worm-compromises.html) |
| 5 | +(TeamPCP, May 2026), showing how Hyperlight micro-VM isolation contains it. |
| 6 | + |
| 7 | +## Background |
| 8 | + |
| 9 | +Mini Shai-Hulud compromised 500+ packages across npm, PyPI, and PHP — including |
| 10 | +TanStack, Mistral AI, Guardrails AI, and AntV — affecting 518M+ cumulative |
| 11 | +downloads. The attack used typosquatted/hijacked packages to: |
| 12 | + |
| 13 | +1. **Steal credentials** — SSH keys, AWS creds, `.env` files, 80+ env vars |
| 14 | +2. **Exfiltrate data** — triple-redundant C2 (custom domain, Session Protocol, GitHub dead drops) |
| 15 | +3. **Install persistence** — Claude Code `SessionStart` hooks, VS Code `runOn`, LaunchAgents |
| 16 | +4. **Self-propagate** — used stolen npm tokens to poison other packages |
| 17 | + |
| 18 | +## What this demo does |
| 19 | + |
| 20 | +A fake typosquatted package (`reqeusts` instead of `requests`) simulates the |
| 21 | +attack payload. A victim application imports it, triggering the malicious code. |
| 22 | + |
| 23 | +**Bare metal** — the attack succeeds: secrets are stolen, exfiltrated, persistence installed. |
| 24 | + |
| 25 | +**Hyperlight sandbox** — every malicious action is blocked by the micro-VM's |
| 26 | +default-deny security model: |
| 27 | +- **Filesystem is isolated** — the guest runs on its own ramfs (from the CPIO |
| 28 | + initrd). Host directories are only visible if explicitly mounted with |
| 29 | + `--mount`, and even then access is scoped to that directory with path-escape |
| 30 | + prevention. The attacker's `~/.ssh/id_rsa`, `~/.aws/credentials`, etc. simply |
| 31 | + don't exist inside the VM. |
| 32 | +- **Environment variables are compile-time only** — the guest kernel only has |
| 33 | + `PATH` and `LD_LIBRARY_PATH` (set in `kraft.yaml`). There is no `--env` flag; |
| 34 | + the host's environment is never forwarded. `AWS_ACCESS_KEY_ID`, `GITHUB_TOKEN`, |
| 35 | + etc. are all absent. |
| 36 | +- **Networking is opt-in** — without `--net`, the guest has zero network access |
| 37 | + (`socket()` returns "Function not implemented"). Even with `--net`, outbound |
| 38 | + connections can be restricted to specific hosts via `--net-allow`. |
| 39 | +- **Persistence is impossible** — the guest's ramfs is destroyed when the VM |
| 40 | + exits. There is no way to write to the host's `~/.claude/settings.json` or |
| 41 | + `~/.bashrc` unless the host explicitly mounts those paths. |
| 42 | + |
| 43 | +## Running the demo |
| 44 | + |
| 45 | +### Bare metal (attack succeeds) |
| 46 | + |
| 47 | +The script creates a temporary HOME with planted fake secrets, starts a C2 |
| 48 | +listener, and runs the victim app. Everything is cleaned up on exit. |
| 49 | + |
| 50 | +```bash |
| 51 | +cd demos/supply-chain |
| 52 | +./bare-metal/run.sh |
| 53 | +``` |
| 54 | + |
| 55 | +### Hyperlight sandbox (attack contained) |
| 56 | + |
| 57 | +```bash |
| 58 | +cd demos/supply-chain/hl-unikraft |
| 59 | + |
| 60 | +# One-time setup |
| 61 | +just build # Build or pull Unikraft kernel |
| 62 | +just rootfs # Build rootfs with Python + malicious package |
| 63 | + |
| 64 | +# Run |
| 65 | +just run # Execute inside the sandbox |
| 66 | +``` |
| 67 | + |
| 68 | +### C2 server (standalone) |
| 69 | + |
| 70 | +To watch exfiltrated data arrive in real time (useful for split-terminal demos): |
| 71 | + |
| 72 | +```bash |
| 73 | +python3 c2_server.py |
| 74 | +``` |
| 75 | + |
| 76 | +## File structure |
| 77 | + |
| 78 | +``` |
| 79 | +supply-chain/ |
| 80 | +├── reqeusts/ # Typosquatted package |
| 81 | +│ ├── __init__.py # Triggers payload on import |
| 82 | +│ ├── api.py # Fake requests-like API surface |
| 83 | +│ └── stealer.py # Attack payload (6 phases) |
| 84 | +├── victim_app.py # Legitimate-looking app that imports reqeusts |
| 85 | +├── c2_server.py # Fake C2 server (receives exfiltrated data) |
| 86 | +├── bare-metal/ |
| 87 | +│ └── run.sh # Bare-metal demo (plants secrets, runs attack) |
| 88 | +└── hl-unikraft/ |
| 89 | + ├── Dockerfile # Rootfs with Python + malicious package |
| 90 | + ├── kraft.yaml # Unikraft kernel config |
| 91 | + └── Justfile # Build + run commands |
| 92 | +``` |
| 93 | + |
| 94 | +## Safety |
| 95 | + |
| 96 | +- All "secrets" are planted test data (fake SSH keys, AWS example credentials) |
| 97 | +- The C2 server is `localhost` only |
| 98 | +- Persistence targets a temporary HOME directory (bare-metal) or doesn't exist (sandbox) |
| 99 | +- No real credentials are read, stored, or transmitted |
0 commit comments