# CVE-2026-29972: nanoMODBUS through v1.22.0 has a stack-based buffer overflow in recvreadregistersres() in nanomodbus.c.

- Severity: High 8.2 (CVSS:3.1, scored by CISA-ADP) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.64%, higher than 51% of CVEs (2026-12-01)
- Published: 2026-05-08T00:00:00.000Z
- Modified: 2026-06-17T10:29:58.400Z
- Weaknesses: CWE-121
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial
- Assigned by: mitre

## Description

nanoMODBUS through v1.22.0 has a stack-based buffer overflow in recv_read_registers_res() in nanomodbus.c. When a client calls nmbs_read_holding_registers() or nmbs_read_input_registers(), the library writes register data from the server response to the caller-provided buffer based on the response's byte_count field before validating that byte_count matches the requested quantity. A malicious Modbus TCP server can send a response with byte_count=250 (125 registers) regardless of the requested quantity, causing up to 248 bytes of attacker-controlled data to overflow the buffer, potentially allowing remote code execution.

(As written by CVE List.)

## Affected

- Unspecified product: n/a

## References

- <https://github.com/debevv/nanoMODBUS>
- <https://github.com/debevv/nanoMODBUS/blob/master/nanomodbus.c#L580-L615>
- <https://gist.github.com/dwilliams27/a4e26fe747c8561d608f7549804bd85f>

## Sources

- CVE List: [CVE-2026-29972](https://www.cve.org/CVERecord?id=CVE-2026-29972), CVE Terms of Use, modified 2026-05-08
- NVD: [CVE-2026-29972](https://nvd.nist.gov/vuln/detail/CVE-2026-29972), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-29972 · Whole record: https://cve.day/CVE-2026-29972.json · Rebuilt by cve.day 2026-11-25T22:59:21.092Z
