Skip to content

Stack buffer overflow in Zephyr hl7800 modem driver parsing network-supplied +CGCONTRDP address fields

High
d3zd3z published GHSA-hchc-6489-w66v Aug 19, 2026

Software

zephyr

Affected versions

>= 2.4.0, < 4.4.2

Patched versions

4.4.2

Description

The HL7800 cellular modem driver's +CGCONTRDP: response handler on_cmd_atcmdinfo_ipaddr() in drivers/modem/vendor_standalone/hl7800.c parses the PDP-context dynamic parameters (local address, subnet mask, gateway, and DNS servers) that the cellular network assigns to the device. The response is linearized into a 256-byte stack buffer, after which each address field length is computed from comma/. delimiter positions in the network-supplied data and used directly as the length argument to strncpy() into the fixed 64-byte stack buffer temp_addr_str (and the 16-byte iface_ctx.dns_v4_string).

Because the field length is derived from attacker-controlled delimiter positions and was not bounded against the destination buffer, a single field can be far larger than 64 bytes. A malicious or impersonated cellular network (for example a rogue base station) can return a crafted +CGCONTRDP response with an overlong address field, causing strncpy() to write past temp_addr_str on the modem worker thread's stack, plus an out-of-bounds NUL write at temp_addr_str[addr_len].

No device-side privileges or user interaction are required: the device itself issues the AT+CGCONTRDP=1 query during normal network attach and parses whatever the network returns. The overflow corrupts adjacent stack memory in supervisor context, yielding at minimum a remotely triggerable crash and potentially control-flow hijacking on targets without stack protection.

The fix bounds every field length against its destination buffer (temp_addr_str and dns_v4_string) before each copy, rejecting overlong fields.

Affected components

  • drivers/modem/vendor_standalone/hl7800.c

Affected versions

>= 2.4.0, < 4.4.2

Fix

Fixed (merged) in a1cbced

Fixed in 4.4.2. Release lines that have not yet taken the backport remain affected — see the affected version range above.

Introduced by: present since the hl7800 +CGCONTRDP handler was added; shipped in releases (e.g. v4.4.0 at drivers/modem/hl7800.c)

Evidence

  • drivers/modem/vendor_standalone/hl7800.c:2118-2128 — addr_len derived from network-supplied delimiter positions; pre-fix strncpy into temp_addr_str had no bound check
  • drivers/modem/vendor_standalone/hl7800.c:2069 — temp_addr_str[HL7800_IPV6_ADDR_LEN] (64 bytes) destination
  • drivers/modem/vendor_standalone/hl7800.c:290-291 — HL7800_IPV6_ADDR_LEN = sizeof("a01...a16") = 64
  • drivers/modem/vendor_standalone/hl7800.c:432 — dns_v4_string[NET_IPV4_ADDR_LEN] = 16 bytes, also overflowed (now guarded)
  • drivers/modem/vendor_standalone/hl7800.c:2063,199 — value[MDM_IP_INFO_RESP_SIZE]=256 holds the network response; a field can exceed 64
  • drivers/modem/vendor_standalone/hl7800.c:4694 — CMD_HANDLER("+CGCONTRDP: ", atcmdinfo_ipaddr) registers the handler against modem responses
  • git show v4.4.0:drivers/modem/hl7800.c:2119-2120 — same unbounded strncpy(temp_addr_str, addr_start, addr_len) shipped in v4.4.0 (path relocated later)

Patches

Branch Pull request Status
main #111243 merged
v4.4-branch #113040 merged
v4.3-branch #113042 open
v3.7-branch #113041 merged

For more information

If you have any questions or comments about this advisory:

embargo: 2026-08-16

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Adjacent
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

CVE ID

CVE-2026-12522

Weaknesses

Out-of-bounds Write

The product writes data past the end, or before the beginning, of the intended buffer. Learn more on MITRE.