今天在练习DVWA的SQL注入模块时,使用联合注入的时候,遇到报错:
Illegal mix of collations for operation 'UNION'
网上查了一下,原因是union两端的字段的collatie(排序规则)不同,
关于collatieMYSQL中的COLLATE是什么? - 腾讯云开发者 - 博客园 (cnblogs.com)
解决方案:
打开DVWA安装目录里的MySQL.php文件。
E:\phpstudy_pro\WWW\DVWA\dvwa\includes\DBMS

用编辑器打开搜索 $create_db ,第一个就是

在 $create_db 这个变量的赋值语句里加上一小段:
COLLATE utf8_general_ci
一定要注意空格,在 } 和COLLATE之间有一个空格,如果不加上就会出错。
如下图

保存以后回到dvwa靶场,在Setup / Reset DB页面重新建立DVWA数据库

重置成功

再次尝试联合注入

成功
Comments 2 条评论
I’m not sure what Area 52 has to do with any of this?
It is the best time to make a few plans for the long run and it’s time to be happy.
I have learn this post and if I may just I want to recommend you some fascinating
things or advice. Perhaps you can write subsequent articles regarding this article.
I wish to read more issues about it!