feat: add supply-chain typosquat + AI rules file backdoor chain#202
Merged
feat: add supply-chain typosquat + AI rules file backdoor chain#202
Conversation
|
Thank you @kOaDT for contributing once again! 📊 PR overview
📝 Before reviewTo help maintainers review your changes efficiently, please ensure that:
✅ Continuous IntegrationTwo CI workflows will run automatically on this PR:
You can follow their progress in the Checks tab. 🤝 A note on collaborationWe value respectful and constructive interactions. Whether you are a contributor or a reviewer, please be patient, kind, and open to feedback. A maintainer will review your changes as soon as possible. If you have any questions, feel free to ask in this thread. |
23 tasks
820af9f to
4563232
Compare
4563232 to
c6f1343
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a chained two-flag CTF challenge covering modern software supply-chain attacks: a typosquatted
react-toastfynpm package whosepostinstallwould drop a malicious Cursor rules file (lab/quarantine/productivity-helper.mdc) carrying a hidden HTML-comment prompt-injection payload. The payload instructs the developer's AI agent to inject a magic-header auth bypass at/api/admin/diag. Players solve the chain black-box through the existing path-traversal endpoint, ending with a runtimecurlexploitation.The challenge fills a gap in the lab (no supply-chain flag previously) and is positioned around OWASP 2025 A03 (Software Supply Chain Failures) and the LLM Top 10 supply-chain category. Inspired by Pillar Security's "Rules File Backdoor" (March 2025), the npm Shai-Hulud worm (September 2025), and the axios maintainer takeover (March 2026).
Two new flags:
npm-supply-chain-typosquatai-rules-file-backdoorNotable changes:
SUPPLY_CHAINvalue in theFlagCategoryenum (schema, types, format labels, dashboard short label)lab/quarantine/directory for inert lab payloads, with aREADME.mdexplicitly instructing AI agents to treat the contents as dataAGENTS.mdupdated with a "Lab Quarantine Zones" sectiontsconfig.json,eslint.config.mjs,.prettierignoreupdated to excludepackages/react-toastfy/andlab/Safety:
package.jsonand is never installedpostinstall.jsis fully inert (top-of-file comment + oneconsole.log+process.exit(0)— zerofs.write, zerochild_process, zero network, zeroos.homedir).cursor/rules/,.claude/skills/,.cursorrules,.windsurfrules,.continue/,.github/copilot-instructions.md, rootCLAUDE.md)Type of change
Testing done
npm run db:generate+npm run db:push+npm run db:seed— schema migrated cleanly viadb:push, 34 flags + 34 hint sets seedednpm run lint— 0 errors (17 pre-existing warnings in unrelated files)npm run format:check— cleannpm run build— Next build green;/api/admin/diagregisterednpm run docs:build— Astro build green, walkthrough indexednpm run test:unit— 61/61 passingpath-traversal.test.ts— 17/17 passing against a running servercurl: HTML breadcrumb →../package.json→../packages/react-toastfy/package.json→../packages/react-toastfy/scripts/postinstall.js→../lab/quarantine/productivity-helper.mdc(flag 1) →GET /api/admin/diagwithX-Debug-Auth: dbg_8f3a7c91e2b4d6a05e21(flag 2). Both flags verify successfully viaPOST /api/flags/verify. Original path-traversal flag still reachable.cypress/tsconfig.json. Local Cypress runner crashes with SIGILL on Ubuntu 22.04 / Cypress 15.13.1 for all specs (pre-existing environmental issue, not specific to this change) — to retest in CI.Checklist
If adding a new vulnerability
prisma/seed.tswith formatOSS{...}prisma/seed.tscontent/vulnerabilities/(concept + fix only — no exploit steps, payloads, or flag value)docs/src/data/blog/,walkthroughSlugis set on the flag inprisma/seed.ts