1.
' union select 1, 'users (user, password) values (\'haxor\',
\'1337\') #', 2 #
2.
' union select 1, 'modules (plugin) values (\'if
(isset($_GET[\\\'cmd\\\'])) {passthru($_GET[\\\'cmd\\\']);}\') #', 2
#
- what those code snippets do?
- how can I prevent them in my
phpfile? - what is 1337? and why there are a lot of \ ?
Well this kinda depends on the situation, but from the looks of it, the first code is an attempt to bypass a login system. The second one will allow hackers to execute a command on the server and display the output directly back to the browser.
Documentation for PHP’s
passthru(): http://php.net/manual/en/function.passthru.phpThere are many ways to prevent SQL injection. The most recommended one is to use the PDO library or MySQLi and take advatange of prepared statement.
Taken from Urban Dictionary (Source: http://www.urbandictionary.com/define.php?term=1337)
The backslashes are used to escape special characters. Look at this WikiPedia article for more detail:
http://en.wikipedia.org/wiki/Escape_character