当前位置:网站首页>SQL injection vulnerability (bypass)
SQL injection vulnerability (bypass)
2022-06-25 11:18:00 【errorr0】
After learning SQL Injection principle 、SQL The type of Injection Then you can say SQL Inject I've got a general idea , But the fact is that in reality, developers can't let you attack the database so easily , They usually make certain restrictions on the data that has been entered or can be entered , This article is mainly about SQL Injected code or waf Make a summary of the filter bypass .
Case around
This is the simplest and most difficult way to bypass , There are two reasons to take advantage of :SQL sentence Case insensitive 、 The blacklist filtering done by developers is too simple .

Double writing bypasses
The principle of double write bypass is that the background uses regular matching to replace sensitive words with empty words . That is, if you filter select, We type in 123select456 Sensitive words will be detected , The last replaced string is composed of 123select456 ---> 123456. The bypass of this filter is also very simple, that is, double write select that will do , Such as :selselectect ---> select , One such filter will double write , Write three times twice, and so on . Here's an example :

You can clearly see the wrong information here ,or It should be filtered , We use the above bypass method ,

succeed , This is the same. Double writing bypasses Methods , Pretty simple .
Space filtering
If spaces are filtered , The main ideas are to find a substitute , There are several that can replace the blank space :
Note bypassing /**/ : Under normal circumstances, as long as this is not filtered, it can be replaced .
Bracket filtering () : All keywords are enclosed in parentheses to replace space separation, as follows ,
normal :select * from user
Brackets :(select)*(from)(user)
url code : You can try this kind of encounter . use %20 Instead of a space or something else url code
%09、%0a、%0b、%0c、%0d 、%a0、%00
Enter to replace : Carriage return and line feed can also be used as a separation function instead of spaces .
Tab replace :Tab It can be used as a separation function .
Comment filtering
When we come across something we usually use --+ Comment filtering , We can substitute the following notes for :
#、;%00、-- ( Two minus signs and a space )
Close with other data :
select * from user where id='1'
||
V
select * from user where id='1' or '1' ='1'
Quote filtering
There are two full versions of quote filtering , One is that quotation marks cannot appear 、 One is that it will be escaped , The escape processing method has been mentioned in the previous article, which is the bypass of wide byte injection , If you can't use quotation marks, you have to use quotation marks , You can bind the value of a parameter with single or double quotation marks and convert it to 16 At last, the decimal number is added before the input 0x*****.
Comma filter
There are functions or instructions that require commas , Therefore, the method of bypassing commas varies from function to function or instruction .
substring()

Don't worry about functions ,substr And substring almost . You can see that the comma is used directly from the above to the following from……for Instead of .
If you need to use mid() function , There are also comma bypass methods and substring() identical , use from……for Replace commas .
limit 0,1
limit 0,1 Comma in , So if the comma is filtered, our alternative is to use offset, namely

Pay attention here , If used offset, The data before and after the comma should be exchanged with each other .
union
In joint injection, we need select 1,2,3,4……, And if you filter commas, how do you go around here ? This is actually quite interesting , The joint query select 1,2,3,4…… After testing, it can be written separately as follows

After parentheses a、b、c It is casually named and omitted as Writing , Why should I write this ? In this way, you can filter commas , We use offset Instead, you can get ,

So the comma bypass of joint query is to use join Instead of .
Equal sign filter
If only the equals sign is filtered, the following can be used instead
<> : Not equal to !=
regexp、like、rlike

Logical operator filtering
It's filtered out or、and、xor、not The corresponding characters can be used instead of :&&、||、| 、!

If you can't use it, you can consider using The cartesian product (^),

This can be used directly and or These connectors .
Code bypass
Coding bypasses the tradition of telling the truth and is rarely used , But sometimes his use is really unexpected , So let's find out .
Hexadecimal bypass


Substitution of similar functions
1)sleep() <-->benchmark()
2)ascii() <-–>hex()、bin(), After substitution, use the corresponding base conversion string that will do
3)group_concat() <–->concat_ws()
4)substr() <--> substring() <--> mid()
5)user() <--> @@user、datadir–>@@datadir
6)ord() <-–> ascii(): These two functions have the same effect when dealing with English , But the processing time of Chinese is inconsistent .
Reference resources :SQL Inject a bypass pose _ Really strong ! The blog of -CSDN Blog _sql Inject from Bypass
SQL Bypass of injection filtration _12622800 Technology blog _51CTO Blog
SQL Injection bypass - redglare - Blog Garden
https://www.csdn.net/tags/MtTaEgwsMTY0OTk1LWJsb2cO0O0O.html#2_12
边栏推荐
猜你喜欢

1-7snapshots and clones in VMWare

基于Minifilter框架的双缓冲透明加解密驱动 课程论文+项目源码

NuxtJS实战案例

Dragon Book tiger Book whale Book gnawing? Try the monkey book with Douban score of 9.5

ZABBIX distributed system monitoring

Jincang KFS data centralized scenario (many to one) deployment

FPGA基于VGA显示字符及图片

Advanced single chip microcomputer -- development of PCB (2)

Upload and modify the use of avatars

数据库系列:MySQL索引优化总结(综合版)
随机推荐
Ouverture de l'inscription | le troisième marathon des hackers de pagaie est arrivé comme prévu.
Checking whether the double value is an integer - Swift - checking if a double value is an integer - swift
Jincang database kingbasees plug-in force_ view
[维护集群案例集] GaussDB 查询用户空间使用情况
Application of global route guard
Android: generic mapping analysis of gson and JSON in kotlin
基于SSH的高校实验室物品管理信息系统的设计与实现 论文文档+项目源码及数据库文件
Comparator (for arrays.sort)
GaussDB 如何统计用户sql的响应时间
视频会议一体机的技术实践和发展趋势
[the path of system analyst] Chapter 6: Double inventory demand engineering (comprehensive knowledge concept)
GaussDB others内存比较高的场景
Sign up to open the third session of the "flying oar hacker marathon". It's been a long time
CMU提出NLP新范式—重构预训练,高考英语交出134高分
【文件包含漏洞-03】文件包含漏洞的六种利用方式
撸一个随机数生成器
一个数学难题,难倒两位数学家
[maintain cluster case set] gaussdb query user space usage
JVM 原理简介
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-7