Module lessons (2/4)
UNION Exfiltration from Search
Extract hidden API keys via UNION SELECT from a search helper, then lock down column access with bound parameters.
What you'll learn in this lesson
- Exploit a
UNION SELECTvulnerability inside dynamic catalog search to read unrelated vault tables (sec_api_secrets). - Align exact column count and PostgreSQL data types required for
UNIONqueries. - Remediate search endpoints with parameterized
ILIKE $1, then harden against LIKE wildcard abuse (%/_).
Overview
Whenever a query returns result rows back to the user — such as a product catalog search bar or report filter — and interpolates user text into SQL, attackers append a UNION SELECT clause to siphon confidential columns from completely unrelated tables into the HTTP response.
PostgreSQL enforces two strict rules on every UNION SELECT:
Sections covered in this lesson
- 11. UNION Type Rules & Wildcard Binding
- 22. Interactive SQL UNION & AST Visualizer
- 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
- 44. Checkpoints & Code Review
Unlock "UNION Exfiltration from Search" and the full Application & Web Security curriculum
Extract hidden API keys via UNION SELECT from a search helper, then lock down column access with bound parameters.
Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Application & Web Security plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.