Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconAttacker controls rogue Modbus server
-
DeliveryClient initiates FC 0x2B Device Identification request
-
ExploitServer sends crafted PDU with object_length >= buffers_length
-
Installstrncpy copies data within buffers_length bound safely
-
C2Unconditional NUL write overflows buffer at object_length index
-
ExecuteAdjacent heap or stack memory corrupted
-
ImpactClient process crash or potential code execution
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, write limits
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Three conditions must hold simultaneously: (1) the victim application is built against nanoMODBUS through v1.23.0 and actively calls the Read Device Identification client function (FC 0x2B/MEI 0x0E) - applications that never invoke this function are not exposed regardless of library version; (2) the attacker controls the Modbus server the client connects to, either by operating a rogue server the client is directed to contact or by intercepting an existing Modbus session via ARP spoofing, VLAN hopping, or device compromise on a flat OT segment; and (3) the attacker crafts a response PDU where the object_length field is greater than or equal to the buffers_length value the calling application supplies - knowledge of the client's buffer allocation is helpful but the maximum protocol value of 246 will trigger the flaw against any caller using a buffer smaller than 247 bytes. Exploitation is specifically limited by the server-control prerequisite - a passive network observer cannot trigger the bug, and a client restricted to connecting only to known-good, hardened servers is not practically exposed despite the AV:N rating. |
| Impact | The CVSS 3.1 score of 8.6 with vector AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H is broadly defensible but warrants qualification. AV:N and PR:N are correct in that the attacker operates their own server infrastructure and requires no privileges on the victim client. However, AC:L deserves scrutiny: the client must actively call the FC 0x2B function, and the attacker must achieve server-side control - either by running a rogue server that the client is configured to contact, or by executing a man-in-the-middle attack on an existing Modbus session. In flat, unauthenticated OT/ICS network segments this prerequisite is often easily satisfied, but it is not zero-effort opportunistic exploitation. EPSS data was not provided, so quantitative exploitation probability is unconfirmed. KEV status is negative and no public exploit code exists, making this a high-theoretical-severity but currently unexploited issue. A:H is well-supported - writing a NUL byte past a buffer boundary reliably corrupts memory, causing process crash at minimum; C:L and I:L reflect the secondary risk of adjacent-memory exposure or partial corruption depending on allocator layout. In OT environments where this library runs on safety-critical embedded controllers, the availability impact carries operational weight beyond a typical server-side crash. |
| Exploit ScenarioDerived | An attacker who has compromised a Modbus device on the same flat OT network segment, or who operates a rogue server that the target client is misconfigured to contact, waits for the nanoMODBUS-based client to issue a Read Device Identification request during normal polling. The attacker's server responds with a crafted PDU setting object_length to a value equal to or greater than the client application's buffers_length parameter, causing recv_read_device_identification_res() to write a NUL byte past the end of the caller's buffer and corrupting adjacent heap or stack memory - at minimum crashing the client process and potentially enabling further exploitation depending on memory layout. No public proof-of-concept exploit has been identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Aug 05, 2026
Memory corruption in nanoMODBUS through v1.23.0 allows a malicious or compromised Modbus server to crash or potentially execute arbitrary code on connecting clients by sending a crafted Read Device Identification response (FC 0x2B/MEI 0x0E) that triggers an out-of-bounds NUL byte write in recv_read_device_identification_res(). Any application embedding this library and invoking the Device Identification client function is exposed when connecting to an attacker-controlled server. No public exploit code or active exploitation (CISA KEV) has been identified at time of analysis, though the off-by-one NUL write primitive into adjacent heap or stack memory represents a realistic path to both denial of service and, depending on allocator layout, code execution.
Earlier versions of this analysis (1)
Out-of-bounds write in nanoMODBUS through v1.23.0 enables a malicious or compromised Modbus server to corrupt client-side stack or heap memory by sending a crafted Read Device Identification (FC 0x2B/MEI 0x0E) response. The client library fails to cross-validate the server-supplied object_length against the caller-provided buffers_length before writing an unconditional NUL terminator, allowing the write to land past the end of the allocated buffer. No public exploit has been identified at time of analysis, but the flaw affects embedded and OT/ICS Modbus deployments where server authenticity is rarely enforced, making client-side memory corruption a credible risk in adversarial network environments.
RemediationAI
No vendor-released patched version has been confirmed in the available references; the upstream repository at https://github.com/debevv/nanoMODBUS should be monitored for a fix. The correct code-level remedy is to replace the unconditional NUL write at buffers_out[buf_index][object_length] with a write at buffers_out[buf_index][min(object_length, buffers_length - 1)], ensuring the terminator never exceeds the caller-provided boundary. As an interim compensating control, callers can pass a buffers_length value of at least 247 bytes (the maximum protocol object_length of 246 plus one NUL) to eliminate the overflow window - though this does not fix the underlying missing check and may not be practical on memory-constrained targets. If Read Device Identification is not operationally required, disabling or removing calls to the affected function entirely eliminates exposure with no side effects. At the network layer, restricting Modbus client connections to allowlisted trusted server IP addresses and segmenting OT networks to prevent lateral movement reduces the attacker's ability to position a malicious server; note that Modbus itself has no authentication, so network-level controls are the primary mitigation boundary.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
nanoMODBUS (CPE: cpe:2.3:a:debevv:nanomodbus:*:*:*:*:*:*:*:*) is a lightweight, single-file C library implementing both Modbus RTU and TCP for embedded and IoT targets, maintained at https://github.com/debevv/nanoMODBUS. The affected code path in nanomodbus.c processes FC 0x2B/MEI 0x0E Read Device Identification responses, which return vendor and product metadata as variable-length ASCII objects. The root cause is CWE-787 (Out-of-Bounds Write): after correctly limiting the data copy with strncpy(buffers_out[buf_index], str, buffers_length), the code unconditionally writes a NUL terminator at buffers_out[buf_index][object_length] using the server-controlled object_length value instead of buffers_length - 1. The server-supplied object_length (valid range 0-246 per protocol spec) is checked only against the remaining PDU window res_size_left, never against the caller-supplied buffers_length parameter. Any response where object_length is greater than or equal to buffers_length results in a single NUL byte written past the end of the caller-provided buffer, corrupting adjacent stack or heap memory on the client.
Know when Nanomodbus gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H
AV:N because client contacts attacker's server over network; PR:N as attacker needs no privileges on the victim client; A:H for reliable memory corruption; C:L and I:L for secondary adjacent-memory impact.
Primary rating from Vendor (TuranSec).
CVSS VectorVendor: TuranSec
Lifecycle Timeline
3DescriptionCVE.org
nanoMODBUS through v1.23.0 contains an out-of-bounds write in the Modbus client-side recv_read_device_identification_res() function (FC 0x2B/MEI 0x0E, Read Device Identification) in nanomodbus.c. The server-supplied object_length field (0-246) is validated only against the remaining PDU size (res_size_left) and is never validated against the caller-supplied buffers_length parameter. After copying data with strncpy(buffers_out[buf_index], str, buffers_length), the code unconditionally writes a NUL terminator at buffers_out[buf_index][object_length]. When a malicious or compromised Modbus server sends a response with object_length greater than or equal to the client's buffers_length, this NUL write lands past the end of the caller-provided buffer, corrupting adjacent stack or heap memory on the client.
Executive ViewAI
nanoMODBUS library versions 1.23.0 and earlier contain a memory corruption vulnerability allowing attackers who control a Modbus server to crash or compromise connecting client applications. Organizations deploying embedded systems, industrial controllers, or IoT devices relying on this library face significant operational disruption and potential unauthorized access risks. The vulnerability affects any application invoking the Device Identification function when establishing connections to an attacker-controlled Modbus server.
No vendor-released patch identified at time of analysis. Interim mitigations: (1) Enforce strict network segmentation to restrict client applications to connections with pre-authorized Modbus servers only; (2) Implement network-level access controls and detailed monitoring on Modbus protocol traffic to detect anomalous server responses; (3) Deploy vulnerable applications in isolated network zones with minimal privilege levels and restricted outbound connectivity; (4) Enable comprehensive application logging and monitoring to detect crashes or unexpected terminations that may indicate exploitation attempts.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.
More in Nanomodbus
View allOut-of-bounds heap/stack write in nanoMODBUS through v1.23.0 lets an unauthenticated network client corrupt memory in th
Arbitrary-address memory write in the nanoMODBUS Modbus client library (through v1.23.0) allows a malicious or compromis
Off-by-one buffer overflow in nanoMODBUS through v1.23.0 lets remote unauthenticated attackers write one attacker-contro
EUVD-2026-53332
GHSA-9rfp-q4v5-653h
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB