Description
nanoMODBUS through v1.23.0 contains an out-of-bounds write in the Modbus server-side handle_read_file_record() function (FC 0x14, Read File Record) in nanomodbus.c. The function validates that the total request size does not exceed 245 bytes and that each sub-request's record_length is at most 124, but it never validates the CUMULATIVE response size across all sub-requests before processing them. The accumulator response_data_size is declared as uint8_t and is incremented by 2 + record_length*2 for each of up to 35 sub-requests; with 35 sub-requests of record_length=124, the cumulative demand is 8750 bytes, which overflows the uint8_t accumulator. A subsequent loop then calls get_n(), an internal function with no bounds checking, once per sub-request to obtain a pointer into the 260-byte msg.buf receive buffer and advances the internal buf_idx by up to 248 bytes per call; swap_regs() then writes to that pointer unconditionally. A single crafted FC 0x14 request from an unauthenticated network client can cause up to ~8490 bytes to be written out of bounds past the 260-byte buffer, corrupting adjacent memory in the server process and leading to denial of service or potential remote code execution, particularly on embedded/bare-metal targets without memory protection.
Published: 2026-08-05
Score: 9.8 Critical
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability is an out-of-bounds write in the Modbus server function handle_read_file_record(). Because the cumulative response size is not validated, an attacker can supply up to 35 malformed sub‑requests with record_length 124, causing the uint8_t accumulator to overflow. This overflow allows the server to write up to roughly 8.5 KB past the 260‑byte receive buffer, corrupting adjacent memory. On embedded or bare‑metal targets without memory protection the corruption can lead to a denial of service or even permit remote code execution. The weakness is a classic buffer overflow (CWE‑787).

Affected Systems

This flaw affects the nanoMODBUS server developed by debevv. All releases up to and including version 1.23.0 are vulnerable. The issue is present in the file nanomodbus.c and is triggered by Modbus function code 0x14 (Read File Record). No other vendors or versions were listed.

Risk and Exploitability

The flaw has a CVSS score of 9.1, indicating critical severity. EPSS is not reported, but the vulnerability can be exploited by sending a crafted FC 0x14 request from any unauthenticated client over the network. Because no authentication or permission checks are needed, the attack can be performed against any reachable nanoMODBUS instance. The lack of a KEV listing suggests it is not yet widely exploited, but the high severity and ease of exploitation mean that the risk remains significant.

Generated by OpenCVE AI on August 5, 2026 at 13:36 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update nanoMODBUS to the latest stable release that includes the fix for the out-of-bounds write.
  • If an immediate upgrade is not possible, restrict access to the Modbus server by firewall rules or VPN so only trusted hosts can send function code 0x14.
  • On embedded devices lacking memory protection, consider disabling the Read File Record operation in the configuration or applying a custom patch that adds proper bounds checking to the response accumulator.
  • Monitor the process for abnormal terminations or memory corruption events and log any unexpected crashes.

Generated by OpenCVE AI on August 5, 2026 at 13:36 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Wed, 05 Aug 2026 13:45:00 +0000

Type Values Removed Values Added
First Time appeared Debevv
Debevv nanomodbus
Vendors & Products Debevv
Debevv nanomodbus

Wed, 05 Aug 2026 13:15:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 9.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}


Wed, 05 Aug 2026 12:00:00 +0000

Type Values Removed Values Added
Description nanoMODBUS through v1.23.0 contains an out-of-bounds write in the Modbus server-side handle_read_file_record() function (FC 0x14, Read File Record) in nanomodbus.c. The function validates that the total request size does not exceed 245 bytes and that each sub-request's record_length is at most 124, but it never validates the CUMULATIVE response size across all sub-requests before processing them. The accumulator response_data_size is declared as uint8_t and is incremented by 2 + record_length*2 for each of up to 35 sub-requests; with 35 sub-requests of record_length=124, the cumulative demand is 8750 bytes, which overflows the uint8_t accumulator. A subsequent loop then calls get_n(), an internal function with no bounds checking, once per sub-request to obtain a pointer into the 260-byte msg.buf receive buffer and advances the internal buf_idx by up to 248 bytes per call; swap_regs() then writes to that pointer unconditionally. A single crafted FC 0x14 request from an unauthenticated network client can cause up to ~8490 bytes to be written out of bounds past the 260-byte buffer, corrupting adjacent memory in the server process and leading to denial of service or potential remote code execution, particularly on embedded/bare-metal targets without memory protection.
Title nanoMODBUS Server-Side Out-of-Bounds Write in handle_read_file_record()
Weaknesses CWE-787
References
Metrics cvssV3_1

{'score': 9.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}


Subscriptions

Debevv Nanomodbus
cve-icon MITRE

Status: PUBLISHED

Assigner: TuranSec

Published:

Updated: 2026-08-05T12:51:40.361Z

Reserved: 2026-08-05T11:43:52.777Z

Link: CVE-2026-71254

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-05T13:30:04Z

Weaknesses