Difference between revisions of "SQL injection/Countermeasures/Sanitizing/Deprecated"
(Created page with "<noinclude>:<font size="-2">SQL injection > Countermeasures > Sanitizing > Deprecated </font></...") |
(No difference)
|
Latest revision as of 05:49, 19 July 2012
- SQL injection > Countermeasures > Sanitizing > Deprecated
PHP's addslashes() function (now deprecated) relied on the unhex() function. The goal of addslashes() was to add an escape (\) behind any single quotes (') entered into a string. When multi-byte character sets (or collations) are in use, this can cause a vulnerability to occur. If a valid multi-byte character ends in 0x5c (the escape), it is possible to circumvent the escape completely by placing the first byte of that character before the single quote. When unhex() is called against the now escaped single-quote, it sees the two bytes as a single character, allowing the quote (0x27) to escape the string unscathed. An example prefix for a non-utf8 character set's multi-byte prefix that accepts 0x5c as an ending is 0xbf, so one could use %bf%27 in a url to bypass the use of addslashes().