SQL Injection¶
202305042013000 SQL Operations
SQL injection it is vulnerability that occurs when an attacker inserts in unsanitized user input some values which impact on database query execution.
Prevention¶
- parameterized queiries 2023050422584646 SQL Injection#^9d7a74
- input validation
How detect sql injection possibility¶
- Add single quotes and expect error
- Boundary Testing. Use "...ORDER BY < out count> ..." If we send count more than count in table errors would be returned
- Fuzzing
wfuzz -c -z file,/usr/share/wordlists/wfuzz/Injections/SQL.txt -d "db=mysql&id=FUZZ" -u http://sql-sandbox/api/intro
wfuzz -c -z file,/usr/share/wordlists/wfuzz/Injections/SQL.txt -d "db=mysql&name=s&sort=id&order=FUZZ" -u http://sql-sandbox/discovery/api/fuzzing
How exploit sql injection¶
- 202305051825099 SQL Injection Error based payloads
- 202305051829000 SQL Injection UNION-based Payloads
- 202305051829033 SQL Injection Stacked Queries
- 2023050518282929 SQL Injection Reading and Writing Files
- 2023050518285757 SQL Injection Remote Code Execution
- 202305091539011 SQL Map
References¶
- CheatSheets Series Team, 2021), https://cheatsheetseries.owasp.org/cheatsheets/Query_Parameterization_Cheat_Sheet.html ^9d7a74
- web200.SQL Injection.Introduction to SQL Injection
- web200.SQL Injection.Testing for SQL Injection