Every chapter of this book advances a single, continuous engagement against one fictional target that lives entirely in your homelab: Vectrix Labs, a cloud-native SaaS company that sells a threat-intelligence platform to enterprise security teams. Vectrix runs the modern JavaScript stack end to end — a React front end, a Node.js/Express API layer, a GraphQL gateway, MongoDB for persistence, Redis for sessions, and a Kubernetes cluster that ties it all together. One target carries every phase of the pentest: the external edge, a web application thick with client-side logic, a real-time WebSocket feed, an AI-powered analyst chatbot, and the cloud infrastructure underneath.
You don't just run tools against Vectrix. You build the tools, in JavaScript, one phase at a time: your own recon harness, your own scanner, your own crawler, your own exploits, your own post-exploitation agents, and finally your own report generator. Each phase ends with a captured flag — `VECTRIX{...}` — and those flags become the evidence trail for the deliverable you assemble in the final chapter.
Nothing in this book touches a system you do not own. The entire range is yours: stood up locally with one command, attacked, and torn down when you are done.
Who This Book Is For
You already write JavaScript and you have seen a pentest before. This book pushes past tutorial territory into the patterns that make offensive tooling fast and reliable: `fetch` and `undici` for HTTP, `async/await` for concurrency, Node.js streams and `child_process` for system interaction, `ws` for WebSocket manipulation, `puppeteer` for browser automation, and `crypto` for the primitives that show up everywhere in modern auth. If you have never written JavaScript beyond a "Hello World," start elsewhere and come back. If you want to understand what your tools actually do — and build better ones — you are in the right place.
Conventions
Flags. Each chapter plants at least one flag in the range, in the format `VECTRIX{...}`. You capture it by running the tool you just built, not by reading it out of a config file. Flags are cumulative; keep them.
The chapter rhythm. Every chapter follows the same beat:
| Beat | What it is |
| --- | --- |
| Briefing | The story moves one step forward in the engagement |
| Objective | The concrete goal and the flag to capture |
| Concepts | The JavaScript ideas the chapter introduces |
| Build | Complete, working tooling you type and run |
| Capture | Running your tool against the range to take the flag |
| Debrief | The blue-team view: what this looks like to a defender |
Some chapters add an **AI Corner** — an optional sidebar that uses or attacks an LLM. It is never required to finish a chapter.
Lab safety. The range is self-contained and offline-capable. Treat every technique here as lab-only. The same code pointed at infrastructure you are not authorized to test is a crime; authorization is the only thing separating this book from one.
## Roadmap
| Ch | Phase | What you build in JavaScript |
| --- | --- | --- |
| 0 | Rules of engagement | Workstation preflight check |
| 1 | Range build & inventory | `range_control.mjs` — Docker orchestrator + asset inventory |
| 2 | Passive recon / OSINT | Async DNS, certificate transparency, dossier builder |
| 3 | Active recon & scanning | Your own async port scanner + service fingerprinter |
| 4 | Web attack surface | Headless crawler, content discovery, parameter miner |
| 5 | Vulnerability discovery | A focused scanner (XSS / prototype pollution / SSRF) |
| 6 | Exploitation — the web foothold | NoSQL injection + JWT forgery; your first shell |
| 7 | Exploiting the AI layer | Prompt-injection fuzzer; RAG poisoning; tool-call abuse |
| 8 | Post-exploitation | Reverse shells, WebSocket C2, living-off-the-land |
| 9 | Privilege escalation | Container escape, service-account abuse, secrets in env |
| 10 | Cloud & lateral movement | Kubernetes pivoting, service-mesh abuse, SSRF to metadata |
| 11 | Actions on objectives | Data exfiltration over DNS and WebSocket covert channels |
| 12 | Reporting | Parse every flag + finding into a scored deliverable |