HIGH 8.6

CVE-2026-54410: nanoMODBUS Off-by-One Buffer Overflow

nanoMODBUS versions up to and including v1.23.0 contain a critical flaw in how the Modbus/TCP server processes incoming network messages. An attacker can send a specially crafted message that causes the application to write data one byte beyond the intended buffer boundary. On systems without memory protection—common in embedded and real-time environments—this overflow can crash the service, leak sensitive data, or allow unauthorized writes to device registers. No authentication is required; an attacker on the network can exploit this remotely.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.6 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H
Weaknesses (CWE)
CWE-193, CWE-787
Affected products
0 configuration(s)
Published / Modified
2026-06-14 / 2026-07-23

NVD description (verbatim)

nanoMODBUS through v1.23.0 contains an off-by-one buffer overflow in the recv_msg_header() function of the Modbus/TCP server that allows remote unauthenticated attackers to write one attacker-controlled byte past the end of the 260-byte receive buffer by sending a crafted MBAP frame whose Length field is set to 255. The overflow corrupts the adjacent buffer-index field of the nanoMODBUS state structure, resulting in denial of service through invalid memory accesses and, on bare-metal and RTOS targets without memory protection, one-byte information disclosure and writes to unintended register addresses on the Write Multiple Registers (FC16) handler path.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in the recv_msg_header() function, which processes MBAP (Modbus Application Protocol) frame headers. The function allocates a 260-byte receive buffer but fails to validate that the Length field in the incoming MBAP header respects buffer bounds. When an attacker sends a frame with Length set to 255, the function writes 261 bytes into the 260-byte buffer, overflowing by one byte. This overflow overwrites the adjacent buffer-index field in the nanoMODBUS state structure. On bare-metal and RTOS targets without memory protection (MMU/MPU), this corruption enables information disclosure via misaligned buffer reads and unintended register writes through the FC16 (Write Multiple Registers) function code handler. On systems with memory protection, denial of service via segmentation fault is the primary impact.

Business impact

Production deployments of nanoMODBUS—particularly in industrial control systems, smart grids, and other critical infrastructure—face service interruption risk. The ability to trigger crashes remotely with no authentication requirement elevates operational risk. In unprotected embedded environments, the potential for data leakage and unauthorized register modification could compromise device state or enable lateral movement within control system networks. Organizations relying on nanoMODBUS for time-sensitive operations should prioritize assessment and patching.

Affected systems

nanoMODBUS library versions through v1.23.0 are affected. The vulnerability applies to any deployment using the Modbus/TCP server component on network-accessible interfaces. Impact severity depends on the runtime environment: systems with memory protection (Linux, modern operating systems) experience denial of service; bare-metal and RTOS deployments (FreeRTOS, μCOS, Zephyr) may suffer data leakage and uncontrolled register writes. The vulnerability does not require special network positioning or authentication.

Exploitability

Exploitability is high. The attack requires only network connectivity to a Modbus/TCP server port (default 502) and no authentication credentials. Crafting the malicious MBAP frame is straightforward—a single byte field manipulation in a standard protocol frame. Public disclosure of the off-by-one logic makes reproduction and weaponization trivial. Attackers can achieve denial of service immediately; information disclosure and register corruption require knowledge of adjacent memory layout and target register addresses, making these secondary impacts more targeted but still feasible in reconnaissance scenarios.

Remediation

Upgrade nanoMODBUS to a patched version beyond v1.23.0 (verify against the vendor advisory for the exact minimum version). The fix requires bounds checking of the MBAP Length field before buffer write operations and likely includes validation that the frame length does not exceed the receive buffer capacity. Alternatively, if patching is delayed, restrict network access to Modbus/TCP ports (TCP 502) to trusted administrative hosts only, though this does not eliminate the vulnerability for permitted connections. Review adjacent memory allocations to understand exposure of the buffer-index field and any other sensitive data in the same memory region.

Patch guidance

Check the nanoMODBUS project repository or vendor advisories for version numbers containing the fix. Apply patches systematically, beginning with development and test environments. Verify that patched versions resolve the bounds-checking issue in recv_msg_header(). For embedded deployments using nanoMODBUS as a library, regenerate and retest firmware builds after updating the library. Monitor for any integration issues with existing Modbus/TCP clients; the fix should not alter protocol compliance for well-formed frames.

Detection guidance

Network-based detection is limited because the malicious MBAP frame follows valid Modbus/TCP framing—only the Length field value is anomalous. Inspect network traffic for MBAP frames with Length field values that exceed typical message sizes for your deployment; however, this alone is not conclusive. Host-based detection is more effective: monitor nanoMODBUS process behavior for unexpected crashes or segmentation faults correlated with inbound Modbus/TCP traffic. On RTOS and bare-metal systems, enable exception handling and logging to capture buffer overflow attempts. Consider protocol analyzers that validate MBAP header fields against reasonable bounds for your application context.

Why prioritize this

The CVSS 3.1 score of 8.6 (HIGH) reflects high attack complexity, network accessibility, and no authentication requirement. The ability to cause denial of service, combined with secondary impacts of information disclosure and unintended register writes on unprotected systems, makes this a priority for organizations running industrial control or critical embedded systems. The trivial exploit complexity and the prevalence of nanoMODBUS in constrained environments compound the risk. Although KEV status is not currently assigned, the straightforward exploit path and public disclosure suggest rapid weaponization is probable.

Risk score, explained

The CVSS score of 8.6 reflects: (1) Network Attack Vector—no physical access required; (2) Low Attack Complexity—straightforward frame crafting; (3) No Privileges Required—unauthenticated exploitation; (4) No User Interaction—direct network-triggered; (5) Unchanged Scope—impact limited to the nanoMODBUS service itself; (6) Low Confidentiality Impact—information disclosure possible on unprotected systems; (7) Low Integrity Impact—register writes possible on unprotected systems; (8) High Availability Impact—reliable denial of service. The 'HIGH' severity band (8.0–8.9) reflects the combination of easy exploitation and significant operational disruption, balanced against limited scope in protected environments.

Frequently asked questions

Is nanoMODBUS still maintained, and where should I check for patches?

Check the official nanoMODBUS project repository and release notes for patch availability. Maintenance status varies; if the project is inactive, consider evaluating alternative Modbus/TCP library implementations or applying a patch manually if source code is available. Verify patch version numbers directly from the vendor or maintainer before deployment.

Does this vulnerability affect Modbus RTU or only Modbus/TCP?

The vulnerability is specific to the Modbus/TCP server component (recv_msg_header function). Modbus RTU implementations are not affected, as they use a different frame format without the MBAP header that triggers this overflow.

What is the practical risk if my Modbus/TCP server is behind a firewall?

Network segmentation significantly reduces risk by limiting attacker access to trusted internal networks. However, a compromised internal host or rogue employee can still exploit the vulnerability. Apply patches regardless of network architecture, as defense-in-depth practice.

Can information disclosure from this vulnerability be exploited to break authentication elsewhere?

On bare-metal or RTOS systems without memory protection, the one-byte information leak is small and depends on adjacent memory contents. In practice, this is unlikely to directly compromise authentication mechanisms, but it could disclose device state or firmware addresses that enable further reconnaissance. Treat it as a potential stepping stone in multi-stage attacks.

This analysis is provided for informational purposes and does not constitute professional security advice. CVSS scores and vulnerability details reflect published information as of the modification date (2026-07-23). Patch version numbers and remediation steps should be verified against official vendor advisories and release notes before implementation. SEC.co makes no warranty regarding the accuracy or completeness of this information. Organizations should conduct their own risk assessment and testing in isolated environments before applying patches to production systems. References to memory protection, RTOS environments, and bare-metal systems are based on general vulnerability mechanics; actual impact depends on deployment-specific configurations and hardware capabilities. Source: NVD (public-domain), retrieved 2026-07-24. Analysis generated by SEC.co (claude-haiku-4-5).