SQL injection example: login bypass and UNION reads on a local API
SQL injection happens when an application pastes request data into the text of a query, so the input can change what the query means. In a small sqlite3-backed HTTP API we bypassed a login with one crafted username and read every user's password hash through a search parameter. Binding values with placeholders stopped both attacks, but a sort parameter still leaked data until we replaced it with an allowlist.
This is a scripted Python and curl experiment with downloadable source and responses. No AI agent or model ran the test.
On this page: Definition and scope · Reproduce the run · Observed results · The attacks · Verify a finding · Fix and retest · What parameters do not cover · Evidence · Limits
What SQL injection is and what the fixture covers
SQL injection is a flaw where untrusted input becomes part of the SQL statement instead of staying a value.…