当前位置:网站首页>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
边栏推荐
- NFT display guide: how to display your NFT collection
- [interview: concurrency 26: multithreading: two-phase termination mode] volatile version
- Azure synapse analytics Performance Optimization Guide (3) -- optimize performance using materialized views (Part 2)
- Several search terms
- What scenarios are Tencent cloud lightweight application servers suitable for?
- About no module named'django.db.backends.mysql'
- C and pointer Chapter 18 runtime efficiency 18.3 runtime efficiency
- The difference between SQL join and related subinquiry
- Abstract classes and interfaces (sorting out some knowledge points)
- Azure Synapse Analytics 性能优化指南(3)——使用具体化视图优化性能(下)
猜你喜欢

【C语言】经典的递归问题

Dynamic memory management

01 knapsack problem 416. Segmentation and equal sum subset -494. Goal and
![Embedded system migration [8] - device tree and root file system migration](/img/af/5b5d38522f0cc434bdafbf892936ee.png)
Embedded system migration [8] - device tree and root file system migration

Chapter 1 Introduction and use skills of interceptors

滑动窗口问题总结

Transformers is a graph neural network

LeetCode题目——二叉树篇

知识蒸馏——pytorch实现

Chapter 1 requirements analysis and SSM environment preparation
随机推荐
第3章 跨域问题
Geek challenge 2019 (review the loopholes)
C语言数组
知识蒸馏——pytorch实现
Complete backpack and 01 Backpack
MySQL optimization
Chapter 2 develop user traffic interceptors
Skiasharp's WPF self drawn bouncing ball (case version)
深度学习调参技巧
Several search terms
push to origin/master was rejected 错误解决方法
Number that cannot be bought
卷积神经网络——LeNet(pytorch实现)
Transformers is a graph neural network
Anaconda => PyCharm => CUDA => cudnn => PyTorch 环境配置
The attorney general and the director of the national security service of Ukraine were dismissed
【C语言】经典的递归问题
Familiarize you with the "phone book" of cloud network: DNS
Meeting OA project seating function and submission function
Section 6: introduction to cmake grammar