Skip to content

ESP-NOW Integer Underflow Vulnerability Advisory

Moderate
mahavirj published GHSA-hqhh-cp47-fv5g Jun 24, 2025

Package

ESP-NOW (ESP-IDF)

Affected versions

v5.4.1
v5.3.3
v5.2.5
v5.1.6

Patched versions

v5.4.2 (yet-to-release)
v5.3.4 (yet-to-release)
v5.2.6 (yet-to-release)
v5.1.7 (yet-to-release)

Description

Software component

Impact

An integer underflow vulnerability has been identified in the ESP-NOW protocol implementation within the ESP Wi-Fi component of the ESP-IDF framework. This issue stems from insufficient validation of user-supplied data length in the packet receive function. Under certain conditions, this may lead to out-of-bounds memory access and may allow arbitrary memory write operations. On systems without a memory protection scheme, this behavior could potentially be used to achieve remote code execution (RCE) on the target device.

Patches

To address the aforementioned issues, ESP-NOW has added more comprehensive validation logic on user-supplied data length during packet reception to prevent integer underflow caused by negative value calculations.

Patched versions of ESP-IDF Framework are listed below:

Branch Commit
master <edc227c>
release/v5.5 <b1a379d>
release/v5.4 <d4dafbd>
release/v5.3 <d6ec5a5>
release/v5.2 <df7757d>
release/v5.1 <c5fc819>

Workarounds

The ESP-IDF Wi-Fi library has been updated to include more robust length checks for received ESP-NOW data payloads. We recommend upgrading your ESP-IDF baseline to benefit from this fix.

  • For ESP-IDF v5.3 and earlier, if upgrading is not feasible, a workaround can be applied by validating that the data_len parameter received in the RX callback (registered via esp_now_register_recv_cb()) is a positive value before further processing.
  • For ESP-IDF v5.4 and later, no application-level workaround is available. Users are advised to upgrade to a patched version of ESP-IDF to take advantage of the built-in mitigation.

Credits

We would like to thank Xiaobye (@xiaobye_tw) of DEVCORE Research Team for reporting this vulnerability and following up on responsible disclosure.

Severity

Moderate

CVE ID

CVE-2025-52471

Weaknesses

Integer Underflow (Wrap or Wraparound)

The product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result. Learn more on MITRE.

Credits