当前位置:网站首页>SQL injection file read / write
SQL injection file read / write
2022-06-28 08:53:00 【Always a teenager】
Today, let's continue to introduce the relevant knowledge of penetration testing , The main content of this paper is SQL Injected file read / write .
disclaimer :
The content introduced in this article is only for learning and communication , It is strictly prohibited to use the technology in the text for illegal acts , Otherwise, you will bear all serious consequences !
Again : It is forbidden to perform penetration tests on unauthorized equipment !
One 、SQL Inject file read / write functions
The reason why we can make use of SQL Inject vulnerabilities to read and write files , Because MySQL There are functions related to file reading and writing in the database .
load_file() Function can read files ,into outfile and into dumpfile You can write files , for example :
perform SQL command :
select load_file("D:\\123.txt")
Can read D:\123.txt Contents of the file .
And execute orders :
select "test" into outfile "D:\\234.txt"
You can create D:\234.txt file ( The command requires that the file does not exist ), And write test.
The execution results of relevant commands are as follows :
Two 、SQL Injection file read / write secure_file_priv Parameters
Above SQL Execution of statements , Must depend on the database secure_file_priv Parameters , This parameter specifies the safe path for database import and export .
This parameter can have three types , If this parameter is a directory , The prerequisite for us to execute the above command is that the file is in the directory specified by this parameter ; If the parameter is NULL, Then none of the above commands can be executed ; If the parameter is empty , Then the above commands can be executed without restriction .
Be careful , The parameter is NULL And empty are two completely different concepts , When this parameter is empty, it is as follows :
The parameter is NULL when , As shown below :
About null and NULL The difference between , If there is any doubt , You can refer to :MySQL Precautions for use ( One )
3、 ... and 、SQL Injection file path acquisition
When we take advantage of SQL Injection to read the contents of the file , You need to know the path and file name of the target file , So how do we get the file path and file name , There are the following ways :
1、 Display according to the web page error .
Sometimes , Website construction is not rigorous , We can make mistakes on purpose , Guide the website to display the relevant path .
2、 Site legacy files .
Inject pipinfo Such web site legacy files will expose the path information of the web site .
3、 Loopholes report errors .
There are some CMS Or other middleware , Because of its own loopholes , There is a vulnerability in this burst path .
4、 Platform profile .
When we run the website service , There will be a configuration file , If we can get the information of the configuration file , We can get the directory of the website .
5、 Blast .
In case of failure of the above methods , Only by brute force , To guess the website path .
Four 、SQL Magic boot switch for injecting file reading and writing
When we use SQL Injection for file reading and writing , Attention is also needed , At the PHP Whether... Is used in the setting magic_quotes_gpc Magic boot switch , This parameter is set to single quotation marks 、 Double quotes 、 Backslashes and empty characters are filtered .
such , When we use MySQL Read and write files , When you want to enter the destination site path , It will be limited . For that , We can use 16 Binary encoding to bypass .
Originality is not easy. , Reprint please explain the source :https://blog.csdn.net/weixin_40228200
边栏推荐
- Case tool
- [big case] Xuecheng online website
- 【.NET6】gRPC服务端和客户端开发案例,以及minimal API服务、gRPC服务和传统webapi服务的访问效率大对决
- DELL R730服务器开机报错:[XXX] usb 1-1-port4: disabled by hub (EMI?), re-enabling...
- Is it safe to open an account for online stock speculation?
- [go ~ 0 to 1] the next day, June 25, switch statement, array declaration and traversal
- 我想网上注册股票开户,如何操作?在线开户安全么?
- Basic operation of PMP from applying for the exam to obtaining the certificate, a must see for understanding PMP
- How do people over 40 allocate annuity insurance? Which product is more suitable?
- 【Go ~ 0到1 】 第一天 6月24 变量,条件判断 循环语句
猜你喜欢

DB

Quelle est la largeur de bande du serveur de bavardage sonore pour des centaines de millions de personnes en même temps?

Loggerfactory uses log4j Parameter introduction of properties

Idea related issues

Operating principle of Rogowski coil

用Pytorch搭建第一個神經網絡且進行優化

High rise building fire prevention
![[untitled]](/img/bb/213f213c695795daecb81a4cf2adcd.jpg)
[untitled]
![[.Net6] GRP server and client development cases, as well as the access efficiency duel between the minimum API service, GRP service and traditional webapi service](/img/19/296f124becb87461accf8b73b0a8bc.png)
[.Net6] GRP server and client development cases, as well as the access efficiency duel between the minimum API service, GRP service and traditional webapi service

APICloud携手三六零天御,助力企业守好App安全“第一关”
随机推荐
temple
Ffmpeg (I) AV_ register_ all()
如何抑制SiC MOSFET Crosstalk(串扰)?
DEJA_VU3D - Cesium功能集 之 051-地形开挖完美实现
nuxt3入门
It only takes two steps to find the right PMP organization, one check and two questions
VMware Workstation related issues
抖音服務器帶寬有多大,才能供上億人同時刷?
SQL注入之文件读写
Where is CentOS mysql5.5 configuration file
Idea related issues
The Falling Leaves
爱分析发布《2022爱分析 · IT运维厂商全景报告》 安超云强势入选!
Implement global double finger long press to return to the desktop
AVFrame内存管理api
用Pytorch搭建第一个神经网络且进行优化
[big case] Xuecheng online website
Application of energy management system in iron and steel enterprises
Container adapter - stack: stack queue: queue priority_ Queue: priority queue
Discussion on the improvement and application of the prepayment system in the management of electricity charge and price