note 86324 deleted from security.database.sql-injection by cmb
| From: | cmb@php.net | Date: | Fri, 09 Dec 2016 09:50:50 +0000 |
| Subject: | note 86324 deleted from security.database.sql-injection by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208290@lists.php.net to get a copy of this message | ||
Note Submitter: jaimthorn at yahoo dot com
----
dark dot avenger at email dot cz wrote:
"I think that easy way to protect against SQL injection is to convert inputted data into binary
format, so that whatever input is, in sql query it will consist only of 1s and 0s."
Unless there is a 1-to-1 correspondence between your inputted data and the characters in your
'binary' format, a SELECT query wouldn't work anymore. Not a binary format, but it
makes my point: MIME encoding the text 'Dark Avenger' results in
'RGFyayBBdmVuZ2Vy'. If I wanted to look up anyone with 'Avenger' in his/her
name, then 'Avenger' would be encoded as 'QXZlbmdlcg==' which clearly
wouldn't result in a hit on 'RGFyayBBdmVuZ2Vy'.
If there IS a 1-to-1 correspondence, then EITHER your solution only makes it a bit harder to perform
a SQL injection (a hacker would have to figure out what mapping was used between the text and the
'binary' format), OR you've come up with simply another way to escaping your data.
Either isn't a terribly good solution to the SQL injection problem.