SQL Injection, Explained — The 30-Year-Old Bug Still Hacking Websites
In 1998, someone figured out that a login form would believe whatever you typed — including database commands. Nearly thirty years later, SQL injection is still breaching websites.
Here’s the 30-second version. A website asks for your username. Behind the scenes it builds a database query like: find the user where name = ‘[what you typed]’. Now type this instead of your name: ‘ OR ‘1’=’1. The query becomes: find the user where name = ” OR ‘1’=’1′ — and since ‘1’=’1′ is always true, the database hands over the first account it finds. You’re logged in as someone else. No password needed.
Real attacks go further: stacked queries that dump entire tables, UNION tricks that pull data row by row. Some of the biggest breaches in history started with this exact trick.
The fix has existed the whole time: parameterized queries (prepared statements). Never glue user input into a SQL string. Every modern framework does this by default — the breaches happen in old custom code nobody updated.
If you’re learning web security, SQLi is lesson one for a reason: it teaches the golden rule everything else is built on — never trust user input. Practice it legally on intentionally-vulnerable labs like DVWA or PortSwigger’s Web Security Academy, never on real sites.



Comments
Post a Comment