Skip to main content

nanoMODBUS CVE-2026-29972

| EUVDEUVD-2026-28785 HIGH
Stack-based Buffer Overflow (CWE-121)
2026-05-08 mitre GHSA-5hc8-p74q-47pp
8.2
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Deploy malicious Modbus TCP server
  2. Delivery
    Client connects and requests registers
  3. Exploit
    Send crafted response with byte_count=250
  4. Execution
    Trigger stack buffer overflow
  5. Persist
    Overwrite return address with shellcode location
  6. Impact
    Execute arbitrary code in client context

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Stack buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the vulnerable nanoMODBUS client application to initiate a connection to an attacker-controlled or compromised Modbus TCP server. The client must call nmbs_read_holding_registers() or nmbs_read_input_registers() with a requested quantity of registers smaller than 125, and must allocate a buffer sized to the requested quantity rather than the maximum possible response size. No authentication is required between client and server (Modbus TCP protocol default), and no user interaction is needed beyond the application's normal operational polling of Modbus devices. Exploitation is limited by network reachability - clients must be able to establish TCP connections to the malicious server, which in properly segmented OT environments may require prior compromise of network infrastructure or insider positioning. Default configurations of applications using nanoMODBUS are vulnerable unless they implement external buffer size validation.

Impact

Real-world risk assessment requires distinguishing deployment patterns: nanoMODBUS is a client library, so exploitation requires the victim application to connect to a malicious or compromised Modbus TCP server - this is NOT a vulnerability in Modbus servers themselves. The CVSS vector (AV:N/AC:L/PR:N/UI:N) indicates network-accessible exploitation with low complexity and no authentication, but this assumes the attacker controls or MitM's the server endpoint that the client connects to. SSVC assessment confirms automatable exploitation with partial technical impact (C:N/I:L/A:H in CVSS suggests availability impact dominates, though description claims RCE potential). The contradiction between CVSS Impact ratings (no confidentiality impact, low integrity) and the RCE claim in the description requires clarification - buffer overflows enabling RCE typically warrant C:H/I:H/A:H. Publicly available POC (GitHub gist reference) significantly lowers exploitation barrier. No CISA KEV listing suggests no widespread targeting of industrial control systems using this library, but the Modbus protocol's prevalence in OT/ICS environments elevates consequences if exploited. Priority depends on exposure: high priority for Internet-facing Modbus clients or those connecting to untrusted networks, lower for isolated OT networks with authenticated server infrastructure.

Exploit ScenarioDerived

An attacker operates or compromises a Modbus TCP server (e.g., industrial PLC, SCADA gateway, or honeypot service on port 502) that a victim's nanoMODBUS client connects to for legitimate monitoring or control operations. When the client requests a small number of holding registers (e.g., 1 register requiring a 2-byte buffer), the malicious server responds with a crafted Modbus frame containing byte_count=250, delivering 125 registers (250 bytes) of attacker-controlled data. The library writes this data to the client's stack without validation, overflowing the buffer by up to 248 bytes and overwriting the return address or function pointers. Publicly available POC code demonstrates feasibility. The attacker gains remote code execution in the context of the client application, potentially compromising HMI systems, SCADA historians, or edge gateways in industrial control environments.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
No patch listed yet 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 08, 2026

Stack-based buffer overflow in nanoMODBUS v1.22.0 and earlier allows malicious Modbus TCP servers to execute arbitrary code on clients via oversized responses. When client applications call nmbs_read_holding_registers() or nmbs_read_input_registers(), the library fails to validate byte_count before writing server data to the caller's buffer, enabling up to 248 bytes of controlled overflow. No active exploitation confirmed (not in CISA KEV), but proof-of-concept code is publicly available and the vulnerability is automatable (SSVC) with network attack vector (CVSS AV:N/AC:L/PR:N). EPSS data not provided, but the combination of public POC, low complexity, and RCE potential warrants immediate attention for systems using nanoMODBUS as a client.

RemediationAI

Upgrade to nanoMODBUS version greater than v1.22.0 once a patched release is available - no fix version is specified in the provided intelligence, and the GitHub repository reference points to vulnerable code rather than a patch commit. Monitor the official repository (https://github.com/debevv/nanoMODBUS) for security advisories and patch releases. Until a vendor patch is released, implement compensating controls: (1) Restrict nanoMODBUS client applications to connect only to authenticated and trusted Modbus TCP servers within isolated OT networks, using network segmentation and firewall rules to prevent connections to untrusted endpoints; (2) If feasible, implement application-level validation by wrapping nmbs_read_holding_registers() and nmbs_read_input_registers() calls with checks that allocate maximum-sized buffers (250 bytes) regardless of requested quantity, though this wastes memory and does not address the root cause; (3) Deploy exploit mitigations such as stack canaries (compile with -fstack-protector-strong), ASLR, and DEP/NX to increase exploitation difficulty, recognizing these are defense-in-depth measures that raise the bar but do not eliminate the vulnerability. The POC availability (https://gist.github.com/dwilliams27/a4e26fe747c8561d608f7549804bd85f) can help validate mitigations in lab environments.

Affected VersionsENISA

n/a n/a

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

nanoMODBUS is a lightweight Modbus RTU/TCP library implemented in C. The vulnerability resides in the recv_read_registers_res() function in nanomodbus.c (lines 580-615 per GitHub reference), which handles Modbus function codes 0x03 (Read Holding Registers) and 0x04 (Read Input Registers) responses. The CWE-121 (Stack-based Buffer Overflow) occurs because the library trusts the byte_count field from the server response before validating it against the originally requested quantity of registers. In Modbus protocol, each register is 2 bytes, so a malicious server sending byte_count=250 provides 125 registers worth of data. When the client allocated a buffer for fewer registers (e.g., 1 register = 2 bytes), the memcpy-equivalent operation writes 248 bytes beyond the allocated buffer on the stack, overwriting return addresses or other critical stack data. This is a classic integer-to-buffer mismatch where external input (untrusted server response) controls a memory operation size without proper bounds checking.

Know when N A 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

NVD PRIMARY 8.2 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H

Primary rating from NVD · only source for this CVE.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
High

Lifecycle Timeline

3
CVSS changed
May 08, 2026 - 17:22 NVD
8.2 (HIGH)
CVE Published
May 08, 2026 - 00:00 nvd
UNKNOWN (no severity yet)
CVE Published
May 08, 2026 - 00:00 nvd
HIGH 8.2

DescriptionCVE.org

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.

Executive ViewAI

Why It Matters

nanoMODBUS v1.22.0 and earlier contain a critical stack buffer overflow that allows unauthenticated attackers to execute arbitrary code on client systems by sending malicious Modbus TCP responses, potentially compromising any industrial control or IoT infrastructure relying on this library for device communication.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: (1) Restrict network access to Modbus TCP servers-implement firewall rules and VLANs to allow communication only from known, validated servers; (2) Monitor and log all nanoMODBUS client connections for anomalous server responses; (3) Deploy intrusion detection signatures to detect oversized Modbus responses exceeding protocol specifications; (4) Evaluate alternative Modbus libraries with current security patches as migration candidates pending vendor patch release.

Threat Intelligence Overview

EPSS Score
0.1%
Top 84% exploitable
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available No
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

41
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

A stack-based buffer overflow occurs when a program writes more data to a buffer located on the stack than it was allocated to hold.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

More in N A

View all
CVE-2024-51092 CRITICAL POC
9.1 May 08

LibreNMS before 24.10.0 allows a remote attacker to execute arbitrary code via OS command injection involving AboutContr

CVE-2025-15684 MEDIUM POC
5.5 Aug 12

Reachable assertion in Open5GS up to version 2.7.6 allows remote unauthenticated attackers to crash the Diameter CER han

CVE-2024-45257 HIGH POC
7.3 May 08

A Command Injection issue in the payload build page in BYOB (Build Your Own Botnet) 2.0 allows attackers to execute arbi

CVE-2025-15687 LOW POC
2.1 Aug 12

Denial of service in Open5GS 2.7.6 and earlier allows network-adjacent attackers with low-privilege Diameter Gx peer acc

CVE-2025-15686 LOW POC
2.1 Aug 12

Denial of service in Open5GS HSS (Home Subscriber Server) versions 2.7.0 through 2.7.6 is triggered remotely by manipula

CVE-2025-67888 HIGH POC
7.3 May 08

Remote command injection in Control Web Panel allows unauthenticated attackers to execute arbitrary OS commands as root

CVE-2024-53326 HIGH POC
7.3 May 08

LINQPad before 5.52.01 Pro edition is vulnerable to Unsafe Deserialization in LINQPad.AutoRefManager::PopulateFromCache(

CVE-2026-38360 CRITICAL POC
9.8 May 08

Remote code execution in dash-uploader (Python package for Plotly Dash) versions 0.1.0 through 0.7.0a2 allows unauthenti

CVE-2026-30623 CRITICAL POC
9.8 Jul 15

Command injection in LiteLLM 1.18.10 lets attackers who can configure MCP (Model Context Protocol) servers supply arbitr

CVE-2026-67917 CRITICAL POC
9.8 Aug 17

SQL injection in AzuraCast's backup restore flow (versions up to and including 0.23.7) lets an attacker achieve privileg

CVE-2026-75337 CRITICAL POC
9.8 Aug 27

Arbitrary file read in Yu AI Code Mother v4.3 lets anonymous, remote attackers retrieve files outside the intended previ

CVE-2026-31072 CRITICAL POC
9.8 May 19

Remote code execution in APScheduler (all versions through 3.10.x and 4.0.0a5) is achievable when applications deseriali

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy