Simulations
Interactive CPU simulations. Step through assembly programs and watch registers, memory, and flags update in real time.
CPU Basics
View lessonsAdd Two Numbers
Load two values into registers and add them together. The simplest possible program.
Understanding CPU Flags
Run several comparisons and watch how the CPU flags change. Equal values set the zero flag, smaller-than sets the negative flag - flags are how the CPU remembers comparison results.
Registers & Instruction Sets
View lessonsThe Stack & The Heap
View lessonsStack Push & Pop
Push values onto the stack and pop them off. See how the stack pointer moves and LIFO ordering works.
Function Call & Return
Call a function that doubles a value. See how CALL saves the return address and RET jumps back.
Nested Function Calls
Call a function that calls another function. Watch the stack grow with return addresses as calls nest, then unwind as each function returns.
Memory Fundamentals
View lessonsLogic Gates
View lessonsBinary & Number Systems
View lessonsAssembly Language
View lessonsAddresses & Pointers
View lessonsStack-Based Buffer Overflows
View lessonsSafe Buffer Write
A function writes exactly into its 3-slot buffer on the stack. The return address is untouched and RET works normally.
Buffer Overflow
Write one element too many into a 3-slot buffer. The fourth write clobbers the return address - the CPU would jump to the wrong place.
Controlled Overflow
An attacker deliberately overwrites the return address with a chosen value, redirecting execution to their target address.
Heap Vulnerabilities & Use-After-Free
View lessonsReturn-Oriented Programming
View lessonsGadget Identification
Three small instruction sequences (gadgets) each ending in RET. Call them individually to see each one perform its single operation.
ROP Chain
Place gadget addresses on the stack and let RET chain through them - no CALL instructions needed. This is the core ROP mechanism.
Integer Overflows & Type Confusion
View lessonsInteger Overflow Bypass
Watch an 8-bit register overflow from 15 to 1 when 2 is added. The wrapped value passes a size check it should have failed, demonstrating how overflow leads to security bypasses.
Type Confusion
Store a value intended as a 'pointer' (address 15), then read it back and use it as a loop counter. The same bits mean completely different things depending on interpretation.
Exploit Mitigations
View lessonsStack Canary Detection
Place a canary value between a buffer and return address. A simulated overflow corrupts the canary, and the check detects the corruption before the function returns.
DEP / NX Concept
Write instruction-like bytes to a stack area and jump there. In our simulator this executes, but a real CPU with DEP would fault and terminate the process.
Exploit Development & Real-World Impact
View lessonsFull Exploit Chain
Complete exploit: overflow a buffer to overwrite the return address, redirecting execution to attacker-controlled code that stores a marker value.
Finding the Offset
Write a unique pattern of bytes to consecutive memory addresses to determine which offset overwrites the return address. The pattern value at the return address location reveals the exact offset.
Concurrency & Race Conditions
View lessonsRace Condition: Lost Update
Two 'threads' increment a shared counter, but interleaving causes a lost update. Thread B reads the old value before Thread A finishes writing, so one increment is lost.
Atomic Increment: No Lost Update
The same two-thread counter scenario, but this time each thread completes its full LOAD-ADD-STORE sequence before the other begins. No interleaving means no lost updates.