Successful SQL Injection despite PHP Magic Quotes

我怕爱的太早我们不能终老 提交于 2019-11-26 20:56:58

问题


I have always read that Magic Quotes do not stop SQL Injections at all but I am not able to understand why not! As an example, let's say we have the following query:

SELECT * FROM tablename
  WHERE email='$x';

Now, if the user input makes $x=' OR 1=1 --, the query would be:

SELECT * FROM tablename
  WHERE email='\' OR 1=1 --';

The backslash will be added by Magic Quotes with no damage done whatsoever!

Is there a way that I am not seeing where the user can bypass the Magic Quote insertions here?


回答1:


The trick is usually to pass a binary value so that the backslash would become a part of valid multibyte character. Here is a blog post about it.



来源:https://stackoverflow.com/questions/2735749/successful-sql-injection-despite-php-magic-quotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!