Skip to content

Out-of-bounds memory access in core STUN attribute parsing

High
andywolk published GHSA-9j6h-hc95-q926 Jun 3, 2026

Package

FreeSWITCH (C)

Affected versions

<= 1.10.12

Patched versions

>= 1.11.0

Description

Summary

switch_stun_packet_parse() validates that each attribute's declared length fits in the remaining buffer, then dispatches by attribute type and casts attr->value to a type-specific structure (switch_stun_ip_t for address attributes, uint32_t for CHANGE_REQUEST / LIFETIME / BANDWIDTH / OPTIONS / NETWORK_INFO / ERROR_CODE). The cast and the byteswap that follows (ip->port = ntohs(ip->port), *u = htonl(*u)) read and write through the pointer without checking that the attribute payload is large enough for the cast type. A STUN packet whose declared attribute length is shorter than the structure the parser casts to causes the parser to read and write past the end of the attribute, producing an out-of-bounds memory access on the per-leg media buffer.

Impact

  • Process crash on any ICE-enabled call leg that receives a crafted packet. The crash terminates the FreeSWITCH process, dropping every concurrent session.
  • A single UDP datagram is sufficient; no retry, fragmentation, or session state from the attacker is required.
  • The write primitive is constrained to the in-band ntohs / htonl byteswap of attacker-controlled bytes that happen to land at the OOB offset; remote code execution has not been demonstrated.

Affected configurations

Any deployment that negotiates ICE on a media leg. In practice that covers WebRTC profiles (mod_verto, Sofia wss/ws clients) and any Sofia profile where peers offer ICE. Non-ICE SIP/RTP legs are not in scope - the RTP read path only dispatches the datagram to the STUN parser after ICE credentials have been installed on the session.

Attack prerequisites

Network reach to the dynamically allocated UDP media port of an in-progress ICE-enabled call leg. STUN parsing runs before the STUN message integrity (HMAC) check, so the attacker needs neither the ICE password nor any prior interaction with the call; they only need to deliver a UDP datagram to the right port while the call is up. Port discovery is a routine UDP scan against the configured RTP port range.

Workarounds

No reliable in-process workaround - the parser runs unconditionally on any STUN-shaped datagram delivered to an ICE-enabled media socket. Operators who cannot upgrade should restrict the RTP port range to media peers reachable only over trusted transports (firewall, SBC in front, private interconnect). Disabling ICE is generally not viable: WebRTC requires it, and many SIP peers negotiate it by default.

Fix

Before each type-specific cast of attr->value, the parser now checks that the remaining buffer holds at least sizeof(switch_stun_ip_t) (for address attributes) or sizeof(uint32_t) (for the integer-valued attributes and ERROR_CODE). When the check fails the parser returns NULL, the caller logs Invalid STUN/ICE packet received and drops the datagram, and no dereference through the undersized attribute occurs.

Credit

zzoru(Jonghwan Kim) of LY Corporation

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
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
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:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2026-49475

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

Out-of-bounds Read

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

Out-of-bounds Write

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

Credits