Skip to content

Boundary check in imc module

Moderate
razvancrainea published GHSA-65mj-944f-fx48 Aug 5, 2026

Package

opensips (C)

Affected versions

<=4.1

Patched versions

<=4.1

Description

Summary

OpenSIPS's IMC module copies attacker-influenced URI data into three fixed
256-byte stack buffers inside the TM completion callback
imc_inv_callback() without any bounds check. The May 2026 IMC
buffer-overflow remediation fixed the global-buffer reply paths but missed
this callback, so the overflow remains exploitable in 3.6.7 and trunk.

Details

The callback (modules/imc/imc_cmd.c:1187-1293) builds an " is not
registered." notice:

  • body_buf[256]: memcpy(body_buf, member->uri.s+4, member->uri.len-4)
    then memcpy(+21) (lines 1244-1245) => writes member->uri.len-4+21
    bytes; overflows when member->uri.len > 239.
  • from_uri_buf[256]: strncpy(from_uri_buf, room->uri.s, room->uri.len)
    (line 1253).
  • to_uri_buf[256]: strncpy(to_uri_buf, inv_uri.s, inv_uri.len) (line
    1259).
    member->uri/inv_uri are "sip:"+invited_user+"@"+host, built from the
    attacker's #invite target by imc_handle_invite (line 376) via
    imc_add_member (imc_mng.c:289-344, no length cap). The invite path's only
    guard (line 476, >= IMC_BUF_SIZE = 1024) admits 240–986-byte URIs, which
    then overflow the 256-byte callback buffers.

PoC

  1. MESSAGE ... "#create r1" (attacker becomes room OWNER,
    imc_cmd.c:207-209).
  2. MESSAGE ... "#invite <~300 'A's>@unroutable.invalid".
  3. The IMC invite-notification MESSAGE fails -> TM fires imc_inv_callback
    with ps->code>=300 -> memcpy/strncpy overflow the 256-byte stack
    buffers -> worker crash.
    Guard-page harness reproducing the exact arithmetic (attached imc_guard.c):
    ./imc_guard 240 and ./imc_guard 300 fault (exit 138) at the 256-byte
    boundary; ./imc_guard 200 does not — matching member->uri.len > 239.

Impact

Remote DoS of the OpenSIPS worker; attacker-controlled out-of-bounds stack
write means memory-corruption impact beyond DoS cannot be excluded. Trigger
requires the imc module loaded and SIP-reachable; room-owner privilege is
self-obtained via #create.

Severity

Moderate

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
High
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:H/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2026-62339

Weaknesses

Trust Boundary Violation

The product mixes trusted and untrusted data in the same data structure or structured message. 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