CVE-2024-36843 Overview
CVE-2024-36843 is a heap overflow vulnerability in libmodbus v3.1.6, a widely deployed open-source library implementing the Modbus protocol for industrial control system (ICS) communications. The flaw resides in the modbus_mapping_free() function and is classified under [CWE-122] (Heap-based Buffer Overflow). Remote attackers can trigger the condition over the network without authentication or user interaction, causing application crashes and denial of service in services that link against the affected library.
Critical Impact
A network-reachable attacker can corrupt heap memory through modbus_mapping_free(), terminating Modbus services and disrupting industrial communications.
Affected Products
- libmodbus 3.1.6
- Downstream distributions packaging libmodbus 3.1.6, including Debian LTS
- Industrial applications and SCADA components linking the vulnerable library
Discovery Timeline
- 2024-05-31 - CVE-2024-36843 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-36843
Vulnerability Analysis
The vulnerability exists in libmodbus version 3.1.6, an open-source C library that implements the Modbus protocol used extensively across operational technology and industrial automation. The defect occurs in modbus_mapping_free(), the routine responsible for releasing memory backing a Modbus data mapping. Improper handling of mapping structures during deallocation produces a heap-based buffer overflow.
Because Modbus services typically listen on TCP port 502 and accept connections without authentication, the attack surface is network-exposed by design. Exploitation impacts availability of the listening process and any dependent ICS workflow. The vulnerability is tracked under [CWE-122] and referenced in upstream GitHub Issue #748 and the Debian LTS Security Notice.
Root Cause
The root cause is unsafe memory handling within modbus_mapping_free(). The function frees mapping members without sufficient validation of internal sizes or pointers established by prior modbus_mapping_new() or modbus_mapping_new_start_address() calls. Crafted state or malformed prior interactions corrupt adjacent heap metadata when free operations execute.
Attack Vector
The attack vector is network-based and requires no privileges or user interaction. An attacker reaches the vulnerable code path by interacting with a Modbus TCP service that uses libmodbus 3.1.6 for register mapping. When the server process tears down or rotates its mapping, the corrupted state triggers the heap overflow, terminating the process and denying service.
No verified proof-of-concept exploit is published. Reproduction notes are documented in the GitHub PoC Documentation referenced in the advisory.
Detection Methods for CVE-2024-36843
Indicators of Compromise
- Unexpected termination or segmentation faults of processes linking libmodbus.so.5 at version 3.1.6
- Crash dumps showing frames inside modbus_mapping_free with heap corruption signatures such as glibc malloc_consolidate aborts
- Repeated short-lived Modbus TCP sessions from a single source preceding service restarts
Detection Strategies
- Inventory hosts and containers for libmodbus 3.1.6 using software composition analysis or package managers (dpkg -l libmodbus5, rpm -q libmodbus)
- Monitor Modbus TCP traffic on port 502 for malformed PDUs and abnormal connection churn
- Correlate ICS process crash events with preceding inbound Modbus sessions in SIEM pipelines
Monitoring Recommendations
- Forward application crash telemetry and systemd/coredumpctl events to centralized logging
- Alert when Modbus server processes restart more than once per interval baseline
- Track network reachability of Modbus endpoints from untrusted segments
How to Mitigate CVE-2024-36843
Immediate Actions Required
- Upgrade libmodbus to the version distributed in the Debian LTS Security Notice or rebuild applications against a patched upstream commit
- Restrict Modbus TCP exposure to trusted OT network segments via firewall and VLAN segmentation
- Audit ICS hosts for processes linking the vulnerable library and schedule maintenance windows for replacement
Patch Information
The upstream issue is tracked in GitHub Issue #748. Debian published fixed packages through its LTS channel as detailed in the Debian LTS Security Notice. Apply distribution updates or rebuild from a patched libmodbus source tree.
Workarounds
- Place Modbus services behind an ICS-aware firewall or data diode that filters unauthorized clients
- Disable or stop Modbus listeners on systems where the protocol is not actively required
- Apply strict access control lists limiting source addresses permitted to reach TCP port 502
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

