当前位置:网站首页>SQL injection for Web Security (3)
SQL injection for Web Security (3)
2022-06-26 16:54:00 【Global variable Global】
The article explains in detail web Safety SQL Inject , Through more in-depth grasp of the content in the text SQL Principle and detection method of injection , So it can be better used in penetration test ; The content of the text is compiled by personal understanding , If there is any mistake , Bosses do not spray , Personal skills are not good ; Any technique mentioned in this article comes from range practice , For reference only , Do not use the related technology in the article to engage in illegal testing , If all the adverse consequences caused by this have nothing to do with the author of the article .
web Safety SQL Inject ( 3、 ... and )
Blind Injection
Database information is not displayed in the page , Generally, only right and wrong content will be displayed .
principle
Boolean blind injection is mainly through substring This function is used to judge , To get the library name 、 Table names and more sensitive data .
This function is mainly used for the number of digits of a value .
select substring('longwaer',1,4)

Here you can see that before taking out 4 The value of a , So in this position we can put MySQL The built-in functions of the , Data can also be obtained .
SELECT substring(database(),1,1)

Then we use the extracted value if Make a judgment , You can successfully obtain sensitive information .
select if(substring(database(),1,1)='d',1,0)
select if(substring(database(),1,1)='v',1,0)
It can be seen that when we get the correct data first in the database , Will return 1, When we get errors , Will return 0

So after we understand the principle , Then do code analysis .
The code analysis
Here I describe some mistakes in the picture , Is that the input parameter is greater than 0, And this value exists , Return to exist , The value entered does not exist , Return to nonexistence .
Through code analysis , If we use the previous statement to get the data , The page will not have any data returned .
Blind injection can be judged in two ways , Return to a different page , To judge , It is called Boolean blind injection ; Judge by delay , It is called delayed injection .
Boolean blind injection
In this way, we can also use the previous judgment method to judge whether there is injection on the page .
1' and '1'='1
1' and '1'='2
Judge by different prompts on the page .
Here we can also use if To judge .
1' and if(1=1,1,0)# 1' and if(1=2,1,0)#


Because using federated queries , Unable to get data , So we can use substring This function is used to judge . So as to obtain sensitive data .
1' and if(SUBSTRING(database(),1,1)='d',1,0)# 1' and if(SUBSTRING(database(),1,1)='v',1,0)#


In this way, we can get the library names in turn , Table name , And sensitive data such as account passwords . The speed of manual operation is slow , So we can use burp Or write a script to run out the data we need .
This is when we have echo , You can judge by the inconsistency of the prompt information on the page , But if we don't echo , You need to use delayed injection to test .
Delay Injection
When there is no prompt on the page , You need this way to test .
1' and sleep(5)#

When no information is echoed , We can obtain the database length by the following methods , Determine by the time of execution .
1' and if(length(database())<5,sleep(5),0)--

When such blind injection without echo is found , Compatible SQLMAP Tools to use together , So as to quickly obtain sensitive information .
边栏推荐
- Science | 红树林中发现的巨型细菌挑战传统无核膜观念
- 内存分区模型
- [Li Kou brush questions] 11 Container holding the most water //42 Rain water connection
- Research on natural transition dubbing processing scheme based on MATLAB
- QT 5.9.8 installation tutorial
- Leetcode 1169. Query invalid transactions (if the amount of data is small, this problem still needs to be solved by violent enumeration)
- 进军AR领域,这一次罗永浩能成吗?
- [learn FPGA programming from scratch -46]: Vision - development and technological progress of integrated circuits
- Interpretation of new plug-ins | how to enhance authentication capability with forward auth
- Teach you to learn dapr - 1 The era of net developers
猜你喜欢

Redis OM . Net redis object mapping framework

构造函数和析构函数
Scala 基础 (二):变量和数据类型

Vibrating liquid quantity detecting device

经典同步问题

NFT 交易市场社区所有化势不可挡

Cloud platform monitoring system based on stm32+ Huawei cloud IOT design
![[force deduction question] two point search: 4 Find the median of two positive arrays](/img/4f/43aa7e14344e7e1a2fb7c1d209d13b.png)
[force deduction question] two point search: 4 Find the median of two positive arrays

基于Kubebuilder开发Operator(入门使用)

r329(MAIX-II-A(M2A)资料汇总
随机推荐
Call the random function to generate 20 different integers and put them in the index group of institute a
Scala 基础 (二):变量和数据类型
Niuke programming problem -- dynamic programming of must brush 101 (a thorough understanding of dynamic programming)
最小二乘系统辨识课 中篇:递归最小二乘
进军AR领域,这一次罗永浩能成吗?
Decentralized NFT transaction protocol will defeat opensea
20:第三章:开发通行证服务:3:在程序中,打通redis服务器;(仅仅是打通redis服务器,不涉及具体的业务开发)
Toupper function
Natural language inference with attention and fine tuning Bert pytorch
Count the number of each vowel letter in the string
JS tutorial using electron JS build native desktop application ping pong game
[from deleting the database to running] the end of MySQL Foundation (the first step is to run.)
JS tutorial electron JS is a good tool for designing powerful multi platform desktop applications
[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)
Redis migration (recommended operation process)
Redis OM . Net redis object mapping framework
Pybullet robot simulation environment construction 5 Robot pose visualization
基於Kubebuilder開發Operator(入門使用)
Develop operator based on kubebuilder (for getting started)
Kubecon China 2021 Alibaba cloud special session is coming! These first day highlights should not be missed