Skip to content

BluFi Example Memory Overflow Vulnerability

Moderate
mahavirj published GHSA-9w88-r2vm-qfc4 Aug 21, 2025

Package

BluFi Example (ESP-IDF)

Affected versions

NA

Patched versions

NA

Description

Software Component

The BluFi example bundled in ESP-IDF was vulnerable to memory overflows in two areas: Wi-Fi credential handling and Diffie–Hellman key exchange.

Impact

The BluFi example in ESP-IDF contained memory overflow vulnerabilities in two areas: Wi-Fi credential handling and Diffie–Hellman key exchange.

In the credential handling functions, strncpy was incorrectly used with the input length instead of the size of the destination buffer. This flaw allowed an attacker to overflow buffers located in global memory.

During the Diffie–Hellman key exchange, a fixed-size buffer was used to store the public key without validating its size against peer-supplied parameters. This could result in buffer overflows, leading to memory corruption or unexpected behavior.

Patches

The issues were addressed in the following commits:

Branch Commits
master abc18e93 & 3fc6c939
v5.4 f77da0d5 & 5f93ec3b
v5.3 12b7a9e6 & f40aa9c5
v5.2 e65cf7ea & bf50c0c1
v5.1 cb6929a2 & b1657d9d
v5.0 9cb7206d & cc00e9f2

Recommendations

  • Upgrade to a BluFi application version that includes the fix. If you prefer not to upgrade, then you can cherry-pick the relevant fixes.
  • The default encryption/decryption logic in this example is intended for demonstration purposes only. If you require a higher level of security, it is recommended to implement your own encryption, decryption, authentication, and checksum algorithms by customizing the security callbacks in the BluFi framework (see esp_blufi_api.c).

References

Credits

We would like to thank the NCC Group for reporting this vulnerability and following up on responsible disclosure.

Severity

Moderate

CVE ID

CVE-2025-55297

Weaknesses

Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. Learn more on MITRE.

Incorrect Calculation of Buffer Size

The product does not correctly calculate the size to be used when allocating a buffer, which could lead to a buffer overflow. Learn more on MITRE.