SSRF漏洞的利用

SSRF的成因看具体的后端实现TCP请求的库:
比如curl、php里的file_get_contents、fsockopen、Java里的openStream,HttpClient类,URLConnection等
https://drops.org.cn/PENETRATION/SSRF-Gopher-Attack-NoteBook.html
发起请求的库不同,决定了可以发起什么样类型的请求。

利用gopher发起任意TCP请求(依赖curl)

gopher://127.0.0.1:70/_ + TCP/IP数据

默认是70端口,可以指定为其他端口
SSRF漏洞的利用_第1张图片
SSRF漏洞的利用_第2张图片

可以攻击Redis、抓包改包之后可以攻击mysql。

利用GoPher协议进行内网Redis和mysql的未授权操作(在服务端设置了未授权访问的情况下)

SSRF漏洞的利用_第3张图片

SSRF可以结合DNS重绑定
http://www.bendawang.site/2017/05/31/%E5%85%B3%E4%BA%8EDNS-rebinding%E7%9A%84%E6%80%BB%E7%BB%93/

对Redis进行DoS:

curl -v gopher://127.0.0.1:6379/_FLUSHALL --max-time 1

通过向Redis持续发送flushall命令,让它不能存储数据。

利用Gopher进行SSRF的局限性以及利用方式:
主要是利用发一次任意基于TCP协议的请求,进行利用,不能交互。
依赖后端实现TCP请求的库;
可能不支持302跳转;
可能不支持URLencode;

SSRF漏洞的利用_第4张图片

参考:

https://maxchadwick.xyz/blog/ssrf-exploits-against-redis
https://xz.aliyun.com/t/5844
https://drops.org.cn/PENETRATION/SSRF-Gopher-Attack-NoteBook.html
https://blog.szfszf.top/tech/%E5%88%A9%E7%94%A8gopher%E5%8D%8F%E8%AE%AE%E6%94%BB%E5%87%BB%E7%94%9F%E6%88%90gopher%E5%8D%8F%E8%AE%AEpayload/
https://k-ring.github.io/2019/05/31/%E5%AF%B9%E4%B8%87%E9%87%91%E6%B2%B9gopher%E5%8D%8F%E8%AE%AE%E7%9A%84%E7%90%86%E8%A7%A3%E4%B8%8E%E5%BA%94%E7%94%A8/
https://blog.chaitin.cn/gopher-attack-surfaces/
https://en.wikipedia.org/wiki/Gopher_(protocol)

你可能感兴趣的:(安全,Web)