通过 addlashes() 进行 SQL 注入的示例? [英] Examples of SQL Injections through addslashes()?

查看:50
本文介绍了通过 addlashes() 进行 SQL 注入的示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 PHP 中,我知道 mysql_real_escape 比使用 addslashes 安全得多.但是,我找不到 addslashes 会导致 SQL 注入发生的示例.

In PHP, I know that mysql_real_escape is much safer than using addslashes. However, I could not find an example of a situation where addslashes would let an SQL Injection happen.

谁能举几个例子?

推荐答案

嗯,这是你想要的文章.

基本上,攻击的工作方式是让 addslashes() 将反斜杠放在多字节字符的中间,这样反斜杠就会因为成为有效多字节序列的一部分而失去意义.

Basically, the way the attack works is by getting addslashes() to put a backslash in the middle of a multibyte character such that the backslash loses its meaning by being part of a valid multibyte sequence.

文章中的一般警告:

这种类型的攻击对于任何字符编码都是可能的有一个以 0x5c 结尾的有效多字节字符,因为addslashes() 可以被欺骗来创建一个有效的多字节字符而不是转义后面的单引号.UTF-8 不适合这个描述.

This type of attack is possible with any character encoding where there is a valid multi-byte character that ends in 0x5c, because addslashes() can be tricked into creating a valid multi-byte character instead of escaping the single quote that follows. UTF-8 does not fit this description.

这篇关于通过 addlashes() 进行 SQL 注入的示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆