🔐SQL Injection
Also known as SQLi, SQL Injection Attack
An attack that hides database commands in a form. The app then runs them.
Think of it like
Think of it like a form that asks your name. You write your name, then add: and open the safe.
Example
Jack's search box builds its query by joining strings. Someone types a quote and a DROP TABLE command, and his products table is gone.
Why it matters
It is one of the oldest web attacks and still among the most damaging. One open query can leak every row.
Definition
Example code
sql
SELECT * FROM users
WHERE name = '' OR '1'='1';Common mistake
Key takeaways
- 1Input becomes code. That is the flaw.
- 2The whole database. Is at risk.
- 3Placeholders. Keep input as data.