CVE-2024-36843
NoneCVSS
—
EPSS
0.8%
Published
May 31, 2024
CISA due date
—
Cloudanix analysis
A flaw in a widely used communication library can let attackers crash or take over systems that talk to industrial devices, potentially interrupting operations until the software is updated.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Heap-based buffer overflow in modbus_mapping_free() allows out-of-bounds memory writes during structure deallocation, leading to memory corruption.
Why it matters to the business
Applications using the library for industrial or device communication can crash or allow remote code execution, causing downtime in control systems and potential unauthorized access to connected equipment.
How an attack unfolds
An attacker supplies a specially crafted Modbus mapping structure that triggers the overflow inside modbus_mapping_free when the library attempts to release associated memory.
How to fix it
Upgrade libmodbus to a version containing the fix for the heap overflow in modbus_mapping_free(). Rebuild and redeploy all dependent applications. If an immediate update is not possible, isolate affected services behind network controls that restrict untrusted Modbus traffic.
How to confirm the fix worked
Confirm the installed libmodbus version is newer than 3.1.6, run regression tests that exercise modbus_mapping allocation and free paths, and monitor for segmentation faults or heap sanitizer errors under load.
Typical attack path
- Locate a process or service linked against the vulnerable libmodbus library
- Send a maliciously formed request that populates a modbus_mapping structure
- Trigger modbus_mapping_free() via normal session teardown or error path
- Leverage the resulting heap corruption for code execution or denial of service
How to detect it
Search application and system logs for unexpected crashes or heap-related errors in processes that use libmodbus; correlate with Modbus session teardown events and review memory dumps for corruption artifacts around mapping structures.
What your security team should do
- Prioritize patching all instances of libmodbus to a fixed release
- Inventory software that statically or dynamically links the library
- Restrict exposure of Modbus endpoints to trusted networks only
- Add memory-safety instrumentation to development and CI pipelines for dependent projects
The record
libmodbus v3.1.6 was discovered to contain a heap overflow via the modbus_mapping_free() function.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | libmodbus | 0 | No fix |
| Debian:11 | libmodbus | 0 | 3.1.6-2+deb11u1 |
| Debian:12 | libmodbus | 0 | No fix |
| Debian:13 | libmodbus | 0 | No fix |
| Ubuntu:20.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:22.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:24.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:24.10 | libmodbus | 0 | No fix |
| Ubuntu:25.04 | libmodbus | 0 | No fix |
| Ubuntu:25.10 | libmodbus | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | libmodbus | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | libmodbus | 0 | No fix |
Related vulnerabilities
- CVE-2024-36844 libmodbus v3.1.6 was discovered to contain a use-after-free via the ctx->backend pointer. Also affects libmodbus
- CVE-2024-36845 An invalid pointer in the modbus_receive() function of libmodbus v3.1.6 allows attackers… Also affects libmodbus
- CVE-2024-34244 libmodbus v3.1.10 is vulnerable to Buffer Overflow via the modbus_write_bits function. Also affects libmodbus
- CVE-2023-26793 libmodbus v3.1.10 has a heap-based buffer overflow vulnerability in read_io_status… Also affects libmodbus