当前位置:网站首页>SSRF (server side request forgery) -- Principle & bypass & Defense
SSRF (server side request forgery) -- Principle & bypass & Defense
2022-07-27 00:15:00 【Song dock】
Catalog
file The protocol reads intranet files
utilize Gopher The protocol expands the attack surface
0/1 Preface
principle
SSRF The main principle of vulnerability formation : The interface provided by the port provided by the server contains parameters that users can request , It is not filtered , The server will execute parameters .
In short : The attacker forges the request of the server to launch an attack , The attacker uses the server as a springboard to attack the target system .
Since it's a springboard , That is to say, the attacker cannot directly access the target service , In order to better understand the process , I drew a picture

The intranet server here contains some databases , Direct information of the host
testing
SSRF Verification method :
1. Analyze whether the sent request is sent by the server through packet capturing , If it is a request sent by the server , It is very likely to exist SSRF Loophole
2. Find the resource address in the source code of the page , If the resource address type is www.baidu.com/xxx.php?xxx=( Address ) It's possible that SSRF Loophole
3.dnslog Wait for tools to test , See if they're being interviewed
4. Straight back Banner、title、content Etc
0/2 Exploit
Bypass
Draw a foundation here
http://[email protected]Andhttp://127.0.0.1The request is the same , The content of this request is 127.0.0.1 The content of , This bypass is also in URL Jump around applies .The principle of using is , utilize URL The rule problem of parsing .
In general, use URL Parsing results in SSRF Filtering is bypassed, basically Because the back-end uses an incorrect regular expression to URL It's parsed .
utilize URL The rule problem of parsing , You can also construct different URL Visit the same website resources
Symbol replacement
In the browser, you can use different segmentation symbols to replace the
.Division , have access to.、。、.Instead ofwww.baidu.com
www
。baidu。comwww
.baidu.comabove URl You can visit Baidu directly
Local return address
127.0.0.1, Often referred to as a local loopback address , Some expressions are as follows (ipv6 Your address uses http Access needs to add
[])The distinction here is , stay linux Next ,127.0.0.1 and 0.0.0.0 It's all about yourself .
http://127.0.0.1
http://localhost
http://127.255.255.254
127.0.0.1 - 127.255.255.254
http://[::1]
http://[::ffff:7f00:1]
http://[::ffff:127.0.0.1]
http://127.1
http://127.0.1
http://0:80
Use the website to shorten
There are many websites on the Internet that convert URLs to non short URLs .
•https://www.985.so/
•https://www.urlc.cn/
Here you can bypass a short URL
xip.io Bypass
Just give an example to understand
http://xxx.192.168.0.1.xip.io/ == 192.168.0.1 (xxx arbitrarily )
Point to any ip Domain name of :xip.io(37signals Customization of development implementation DNS service )
It will resolve the following domain names to specific addresses
Such bypassing and dns Bypassing is a truth
Attack posture
Intranet port scan
ssrf.php?url=127.0.0.1:3306 # Detect the presence of MySQL service
file The protocol reads intranet files
ssrf.php?url=file:///etc/passwd # Read passwd file
utilize Gopher The protocol expands the attack surface
Here you can refer to the article of Changting , Very nice, nice
utilize Gopher The protocol expands the attack surface
0/3 SSRF defense
• prohibit 302 Jump , Or check whether the destination address is an intranet address or a legal address every time you jump .
• Filter the return information , Verify the return result of the request from the remote server , Is it legal .
• Disable high-risk protocols , for example :gopher、dict、ftp、file etc. , Only http/https
• Set up URL White list or restricted intranet IP
• The port limiting requests is http Common ports for , Or open the port of remote calling service according to business needs
•catch error message , Do unified error messages , Prevent hackers from judging the service corresponding to the port through error information
边栏推荐
- MySQL transaction, phantom reading, current reading, snapshot reading related notes
- [interview: concurrent Article 27: multithreading: hesitation mode]
- Pytorch data pipeline standardized code template
- Force deduction 155 questions, minimum stack
- 07 design of ponding monitoring system based on 51 single chip microcomputer
- LeetCode——哈希表篇
- [literature reading] an investigation on hardware aware vision transformer scaling
- Chapter 3 cross domain issues
- JUnit、JMockit、Mockito、PowerMockito
- Azure Synapse Analytics 性能优化指南(4)——使用结果集缓存优化性能
猜你喜欢

Add an article ----- scanf usage

04 traditional synchronized lock

Azure Synapse Analytics 性能优化指南(4)——使用结果集缓存优化性能

Chapter 1 Introduction and use skills of interceptors

NFT display guide: how to display your NFT collection

Arthas quick start

Pytorch学习记录(二):张量

Upload files to the server

嵌入式系统移植【8】——设备树和根文件系统移植

Azure Synapse Analytics 性能优化指南(3)——使用具体化视图优化性能(下)
随机推荐
Design of vision protector based on 51 single chip microcomputer
04 traditional synchronized lock
uni-app学习(二)
数据库:MySQL基础+CRUD基本操作
Pytorch data pipeline standardized code template
LeetCode——哈希表篇
10_ Name Case - Calculation attribute
卷积神经网络——LeNet(pytorch实现)
C and pointer Chapter 18 runtime efficiency 18.3 runtime efficiency
3 esp8266 nodemcu network server
Bid farewell to wide tables and achieve a new generation of Bi with DQL
Codeforces B. Orac and Models (dp)
In depth interpretation of the investment logic of the consortium's participation in the privatization of Twitter
Meeting OA my meeting
Chapter 1 Introduction and use skills of interceptors
Codeforces D. Buying Shovels
Relationship between limit, continuity, partial derivative and total differential of multivariate function (learning notes)
Relationship between Unicode and UTF-8
Chapter 1 requirements analysis and SSM environment preparation
关于可穿戴式NFT你应该知道的一切!