Skip to content

Vulnerability in the Content-Length Parser

High
liviuchircu published GHSA-c6j5-f4h4-2xrq Mar 15, 2023

Package

opensips (OpenSIPS Core)

Affected versions

<= 3.2.5, <= 3.1.8

Patched versions

3.1.9, 3.2.6

Description

Impact

A malformed SIP message containing a large Content-Length value and a specially crafted Request-URI
causes a segmentation fault in OpenSIPS. This issue occurs when a large amount of shared memory using
the -m flag was allocated to OpenSIPS, such as 10 GB of RAM. On the test system, this issue occurred
when shared memory was set to 2362 or higher.

Issue Description

The problem occurred in the following code block:

while (p<end && *p>='0' && *p<='9') {
    number = number*10 + (*p)-'0';
    if (number<0) {
        LM_ERR("number overflow at pos %d in len number [%.*s]\n",
            (int)(p-buffer),(int)(end-buffer), buffer);
        return 0;
    }
    size ++;
    p++;
}

This code block incorrectly assumes that an integer overflow of the variable number is detected by
checking if the value is less than zero. However, it was observed that this check returned false when
compiled with optimizations, even though the value overflowed to a negative number.

Workarounds

The only workaround is to guarantee that the Content-Length value of input messages is never larger than 2147483647.

Solutions and Recommendations

This issue was fixed in commit 7cab422, which was tested and found to address the issue. For more info, refer to the Audit Document section 3.1.

For more information

If you have any questions or comments about this advisory:

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-2023-28097

Weaknesses

No CWEs

Credits