r/netsec • u/nylithic • Dec 20 '17
SQL Injection Cheat Sheet
https://sqlwiki.netspi.com/13
u/Paratwa Dec 21 '17
Edit : nevermind I need to learn how to click apparently. I am leaving the below to remind myself I should learn to read.
Original : This was written like a power point and doesn’t describe how they are done technically. To me learning how one was actually done via examples really showed me where applications would be vulnerable and were far more useful
6
-4
Dec 21 '17 edited Dec 21 '17
still in 2017 people manually testing for SQLi?
12
3
Dec 21 '17
still in 2017 people
manuallytesting for SQLi?SQL injections shouldn't even be a major issue in 2017
0
0
0
Dec 21 '17
[deleted]
19
u/coinclink Dec 21 '17
You should not be escaping strings with custom code. That is exactly the wrong thing to do. You should use prepared statements for SQL. There are plenty of lightweight, well-maintained libraries out there that you can depend on. At a minimum, your language probably has built-in escape functions. It also certainly has built-in functions to verify input.
0
Dec 21 '17
[deleted]
26
u/coinclink Dec 21 '17
Your reasoning is exactly what creates insecure software. This isn't 1995 or even 2005, dependencies aren't a big deal. Use code that is peer reviewed and regularly patched. Be innovative in your product, not with security.
6
u/yawkat Dec 21 '17
Wouldn't you still want to escape even if you use a library? It won't know if you meant ' as part of a SQL statement or if it's literal.
No, that is not how prepared statements work. There is no escaping necessary at all when using prepared statements.
4
u/Idontremember99 Dec 21 '17
In addition to what the others said: The library you are using to connect to the database should already support everything you need to use prepared statements so no extra dependency is needed. If it doesnt support it, then it's time to replace it.
68
u/idunnomyusername Dec 21 '17
Don't forget https://github.com/minimaxir/big-list-of-naughty-strings