Test yourself on Technical Attacks with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Technical AttacksGet your flashcardsBuild my revision planTrack my progressDeep Dive: SQL Injection Explained
SQL injection exploits poorly coded websites that don't validate user input. Here's a step-by-step example:
Normal login process:
- User enters username:
alice - Website creates SQL query:
SELECT * FROM users WHERE username='alice' - Database checks if 'alice' exists and returns the user record
SQL injection attack:
- Attacker enters username:
' OR '1'='1 - Website creates SQL query:
SELECT * FROM users WHERE username='' OR '1'='1' - Since
'1'='1'is ALWAYS true, this returns ALL users - bypassing authentication! - Attacker gains unauthorized access without knowing any passwords
Prevention methods:
- Input validation: Check that inputs match expected format (e.g., usernames contain only letters/numbers)
- Input sanitization: Remove or escape special characters like quotes
- Parameterised queries: Separate SQL code from user data so injected code isn't executed
- Prepared statements: Pre-compile SQL queries so user input can't alter query structure
Make this stick
Signing in gives access to all PrepWise features.