HomeCybersecuritySQL Token Boundary Lab: Tokenizer, AST & Live Query Engine

SQL Token Boundary Lab: Tokenizer, AST & Live Query Engine

Interactive 2D SQL-injection lab: a real hand-written tokenizer and recursive-descent parser turns the actual query text into a token stream and an on-canvas AST tree, then a tiny in-memory relational engine evaluates it against sample tables — comparing a vulnerable concatenated query against a parameterized one, character by character.

Cybersecurity2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-sql-injection-protection ↗ Open standalone

SQL injection succeeds only when attacker-supplied text gets tokenized as if it were code the developer wrote. Instead of a decorative pipeline flythrough, this lab actually runs a hand-written tokenizer, recursive-descent parser and a tiny in-memory relational engine against real sample users and payments tables. Pick a canned attack string, choose vulnerable (string concatenation) or parameterized (bound placeholder) construction, and watch the real resulting token stream, the computed abstract syntax tree — laid out live from the actual parsed node count and depth, not a fixed diagram — and the literal rows the engine matches. AST node counts, rows returned and whether the payload was re-tokenized are all derived from genuinely executing the tokenizer/parser/evaluator pipeline on the exact query text each mode constructs, so the classic OR-bypass, stacked-query DROP and UNION-based exfiltration techniques all produce their real, distinct outcomes rather than a hardcoded number.

⚙ Under the hood

A real hand-written SQL tokenizer, recursive-descent parser and in-memory relational engine run on the actual query text: watch the token stream, the computed AST tree and the matched rows differ between a vulnerable concatenated query and a parameterized one, across the classic OR-bypass, stacked-query DROP and UNION exfiltration payloads.

sql injectionparameterized queriesprepared statementstokenizerabstract syntax treecybersecurityCWE-89

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)