尽管 PHP Magic Quotes 仍能成功进行 SQL 注入
我一直读到 Magic Quotes 根本无法阻止 SQL 注入,但我不明白为什么不!举个例子,假设我们有以下查询:
SELECT * FROM tablename
WHERE email='$x';
现在,如果用户输入 $x=' OR 1=1 --
,则查询将为:
SELECT * FROM tablename
WHERE email='\' OR 1=1 --';
反斜杠将由 Magic Quotes 添加没有造成任何损坏!
有没有一种方法我看不到用户可以绕过这里的魔术引用插入?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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.