Home
SECURE PROGRAMMING (CYBER) · LAB
An interactive lab collection

Secure Programming — a Cyber lab

Three self-contained, in-browser labs that take you from vulnerability to defense through worked examples, real CVEs, and code you can run. Pick a lab.

200 + 100 = 44 when 8 bits aren't enough
LAB 01 · ARITHMETIC

Integer Overflow

How integers are stored, signed vs unsigned, what happens when arithmetic exceeds the cage, real-world incidents, working C programs you can compile in the browser, and the patches that prevent each kind of bug.

chapters
Seven, with interactive instruments
covers
Storage · Signed/Unsigned · Wraparound · Operators · Real bugs · Live C · Secure fixes
format
Single-page editorial
Enter the lab
user: "What's 2+2?" "Ignore all previous instructions and..."
LAB 02 · LLM SECURITY

Prompt Injection

Direct and indirect prompt injection attacks against LLM-based applications, with worked examples — DAN, instruction override, indirect injection via hidden HTML — and the layered defenses that mitigate each one.

covers
Direct · Indirect · Jailbreaks · Defenses
extras
Hidden-content demos, real CVEs, mitigation patterns
format
Single-page reference
Enter the lab
▸ A: READ · +1 · WRITE 1827≠ 2000 ▸ B: READ · +1 · WRITE
LAB 03 · CONCURRENCY

Race Conditions

Two threads, one resource, no agreement on order. Lost-update counters, TOCTOU file races, double-spend transactions, and symlink races — each with a step-through interleaving simulator showing live source, locals, and the gap an attacker exploits.

scenarios
Lost update · TOCTOU · Bank double-spend · Symlink race
simulator
Step-by-step playback · live locals · code-line highlight
format
Single-page brutalist manifesto
Enter the lab

About

Why this exists.

Secure Programming (Cyber) — Lab is a small collection of single-page security labs designed for self-paced learning and classroom use. Each lab teaches one threat class end-to-end: the underlying mechanism, real-world incidents that resulted from it, code you can run to reproduce the bug, and the idiomatic patch that fixes it.

Every lab is a self-contained HTML file — no build step, no server, no dependencies beyond Google Fonts. The interactive instruments (calculators, bit grids, the live C compiler in the integer-overflow lab, the chat simulators in the prompt-injection lab) all run in your browser using BigInt, WebAssembly-free interpreters, and plain JavaScript.

New labs will be added over time. Each follows the same structure: foundation → demonstration → real cases → runnable code → defenses.