CVE-2026-29972 Details
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.
A stack-based buffer overflow vulnerability has been identified in the nanoMODBUS library, specifically in versions through 1.22.0. The issue arises in the function recv_read_registers_res() within nanomodbus.c. When a client uses the library to read holding or input registers, the library writes the received register data into a user-provided buffer. This is done based on the byte_count field of the response, but without first verifying that the byte_count aligns with the amount of data requested. As a result, a malicious Modbus TCP server can exploit this by sending a response with a fabricated byte_count value, leading to an overflow of the buffer with attacker-controlled data. This vulnerability could potentially be exploited to execute remote code.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
Volerion
Assessed May 8, 2026CISA-ADP
Assessed May 8, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://gist.github.com/dwilliams27/a4e26fe747c8561d608f7549804bd85f | [email protected] | ExploitTechnical Description |
| https://github.com/debevv/nanoMODBUS | [email protected] | ProductVendor |
| https://github.com/debevv/nanoMODBUS/blob/master/nanomodbus.c#L580-L615 | [email protected] |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-121 | Stack-based Buffer Overflow | CISA-ADP |
Affected Products
| Product | Versions |
|---|---|
| debevv nanoMODBUS | All versions |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| May 8, 2026 | CVE Modified | CISA-ADP |
| May 8, 2026 | New CVE Received | [email protected] |
Volerion