/

CVE-2026-49475

Severity:

HIGH RISK

(7.5)

STUN Attribute OOB Memory Access (CWE-787) in FreeSWITCH

CVE-2026-49475

Analyzed

Vulnerability type

Category:

Out-of-Bounds Memory Access

CWE:

CWE-20, CWE-125, CWE-787

Impact:

Denial of Service and Potential Code Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

FreeSWITCH versions prior to 1.11.0 contain an out-of-bounds memory access in the STUN packet parser when handling attributes with inconsistent length fields.

Malformed STUN attributes can cause reads and writes past allocated buffers, potentially leading to crashes, data corruption, or code execution when untrusted traffic reaches the media processing path.

Affected context

The vulnerability occurs in the STUN packet parsing logic used within FreeSWITCH's media handling path.

It is relevant when FreeSWITCH receives STUN traffic on media legs, typically in NAT traversal or signaling/media negotiation scenarios.

The issue manifests when a STUN attribute's declared length is shorter than the size of the internal structure the parser casts the buffer to, allowing operations that extend beyond the attribute's actual bounds.

Exploit preconditions

  • Attack surface: Network-accessible STUN processing on FreeSWITCH media endpoints.
  • Required access: Ability to send crafted STUN packets to a FreeSWITCH instance (e.g., as a SIP/WebRTC endpoint, or from a reachable network location).
  • Trigger point: Parsing of a malformed STUN attribute whose length field does not match the expected structure size.
  • Why exploitation is possible: The parser trusts the declared attribute type and directly casts the underlying buffer into a structure without validating that the provided length is large enough, enabling reads and writes past the end of the legitimate per-leg media buffer.

Why this happens

The core issue stems from insufficient input validation combined with unsafe memory handling in C.

When processing STUN attributes, the code assumes that the declared attribute length is consistent with the size of the structure it is cast into, failing to enforce a minimum length check before accessing fields.

This leads to CWE-787: Out-of-Bounds Write and CWE-125: Out-of-Bounds Read, driven by CWE-20: Improper Input Validation, because untrusted network data is used directly to control memory accesses on a per-leg media buffer.

The abstract pattern is: "trusting protocol length fields and casting raw buffers to typed structures without validating that there is sufficient data for the structure's full layout."

Potential impact

  • FreeSWITCH process crash, causing denial of service for affected calls or services.
  • Corruption of in-memory media state or control structures.
  • Potential information disclosure via out-of-bounds reads of adjacent memory.
  • In some environments, potential remote code execution if the memory corruption can be precisely controlled and exploited.

General mitigation guidance

Defenses generally focus on robust bounds checking and safer memory handling for protocol parsers.

Recommended patterns include:

  • Validating all protocol length fields against both the overall packet size and the minimum size required for target structures before casting or accessing fields.
  • Using defensive parsing techniques that treat network input as untrusted and operate on explicit offsets and lengths rather than direct structure casts.
  • Adding central helper routines for STUN attribute parsing that enforce common validation rules, instead of open-coded parsing per attribute.
  • Applying strict separation between parsing buffers and internal state, copying only validated portions into well-sized structures.
  • Running media processing components with least privilege and isolation (e.g., sandboxing, process separation) to limit blast radius if memory corruption occurs.

How teams detect issues like this

Detection efforts can combine code-centric and runtime-focused approaches:

  • Static analysis rules to flag direct structure casts from network buffers, pointer arithmetic based on untrusted length fields, and missing bounds checks on protocol attributes.
  • Code review checklists for protocol parsers that require verification of length field validation, minimum size checks, and avoidance of unsafe casts.
  • Fuzz testing of STUN and related media negotiation protocols, with coverage-guided fuzzers aimed at exercising attribute parsing paths and triggering memory safety issues.
  • Runtime protections (e.g., ASan in staging, hardened allocators, stack canaries) to surface out-of-bounds accesses early in testing.
  • Network monitoring or test harnesses that replay malformed STUN traffic to confirm patched behavior and absence of crashes.

Sources

SourceLink
github.comgithub.com/signalwire/freeswitch/releases/tag/v1.11.0
github.comgithub.com/signalwire/freeswitch/security/advisories/GHSA-9j6h-hc95-q926

Frequently asked

questions

Exploitability depends on exposure of FreeSWITCH's STUN/media interfaces to untrusted networks. In typical VoIP or WebRTC deployments where external endpoints can send STUN traffic, it may be remotely triggerable. Exploiting it beyond denial of service (e.g., to achieve code execution) would require sophisticated memory corruption techniques and is highly environment-dependent.

Not necessarily. If an attacker can send specially crafted STUN packets to a FreeSWITCH instance—such as by registering as a client, initiating calls, or reaching exposed media ports—they may be able to trigger the vulnerability without additional authentication.

The safest pattern is to treat all protocol inputs as untrusted, enforce strict bounds checking on every length and offset, and avoid direct casting of raw buffers to typed structures. Parsing should verify that the available data is at least as large as the structure being read before any access occurs, and gracefully reject or drop malformed attributes.

Prevention hinges on secure parser design: adopt a defensive parsing framework, mandate length and boundary validation in coding standards, and integrate static analysis plus fuzzing into the CI pipeline. Combined with memory-safe practices (or memory-safe languages where feasible) and sandboxing of media processing, this significantly reduces the likelihood and impact of out-of-bounds memory issues.

Find out what's already
exploitable in your codebase.