CVE-2016-9938 in Asteriskinfo

Summary

by MITRE

An issue was discovered in Asterisk Open Source 11.x before 11.25.1, 13.x before 13.13.1, and 14.x before 14.2.1 and Certified Asterisk 11.x before 11.6-cert16 and 13.x before 13.8-cert4. The chan_sip channel driver has a liberal definition for whitespace when attempting to strip the content between a SIP header name and a colon character. Rather than following RFC 3261 and stripping only spaces and horizontal tabs, Asterisk treats any non-printable ASCII character as if it were whitespace. This means that headers such as Contact\x01: will be seen as a valid Contact header. This mostly does not pose a problem until Asterisk is placed in tandem with an authenticating SIP proxy. In such a case, a crafty combination of valid and invalid To headers can cause a proxy to allow an INVITE request into Asterisk without authentication since it believes the request is an in-dialog request. However, because of the bug described above, the request will look like an out-of-dialog request to Asterisk. Asterisk will then process the request as a new call. The result is that Asterisk can process calls from unvetted sources without any authentication. If you do not use a proxy for authentication, then this issue does not affect you. If your proxy is dialog-aware (meaning that the proxy keeps track of what dialogs are currently valid), then this issue does not affect you. If you use chan_pjsip instead of chan_sip, then this issue does not affect you.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 10/05/2022

The vulnerability described in CVE-2016-9938 represents a critical flaw in the Asterisk telephony system's SIP channel driver implementation that exploits improper whitespace handling in SIP header parsing. This issue affects multiple versions of both Asterisk Open Source and Certified Asterisk, specifically targeting the chan_sip module that processes Session Initiation Protocol messages. The vulnerability stems from a deviation from the standardized RFC 3261 specification for SIP header parsing, where the implementation incorrectly treats any non-printable ASCII character as valid whitespace rather than restricting whitespace to only spaces and horizontal tabs as mandated by the protocol standard. This liberal interpretation of whitespace creates a parsing anomaly where malformed headers containing non-printable characters can be interpreted as valid SIP headers, fundamentally undermining the security mechanisms that rely on proper header validation.

The operational impact of this vulnerability becomes particularly severe when Asterisk operates in environments where authentication occurs through SIP proxies that maintain dialog state tracking. The flaw allows malicious actors to craft specially formatted SIP INVITE requests that exploit the inconsistent parsing behavior between the proxy and Asterisk. When an authenticating proxy receives a request with mixed valid and invalid header formats, it may incorrectly classify the request as an in-dialog message, thereby allowing the request to pass authentication filters. However, due to the buggy parsing logic in Asterisk's chan_sip driver, the same request is interpreted as an out-of-dialog message, causing Asterisk to treat it as a completely new call initiation rather than a continuation of an existing dialog. This creates a security bypass mechanism where unauthorized parties can establish new calls through the system without proper authentication, effectively circumventing the proxy's authentication controls and potentially leading to unauthorized access to telephony services.

This vulnerability directly maps to CWE-20, "Improper Input Validation," and CWE-22, "Improper Limitation of a Pathname to a Restricted Directory," as it involves improper handling of input data and can lead to unauthorized access through malformed header processing. From an ATT&CK framework perspective, this vulnerability aligns with T1190, "Exploit Public-Facing Application," and T1071.004, "Application Layer Protocol: DNS," as it exploits weaknesses in network protocol handling to gain unauthorized access to telephony services. The attack vector specifically targets the SIP protocol implementation within Asterisk, making it particularly dangerous for organizations relying on SIP-based communication systems for voice services. Organizations using authentication proxies that do not maintain dialog state awareness are particularly vulnerable, as are those still utilizing the older chan_sip module instead of the more secure chan_pjsip implementation. The vulnerability demonstrates how seemingly minor parsing inconsistencies can create significant security holes in telephony infrastructure, emphasizing the importance of strict adherence to established protocol standards in security-critical applications.

The recommended mitigations for this vulnerability include upgrading to patched versions of Asterisk where the whitespace handling has been corrected to comply with RFC 3261 specifications, transitioning from chan_sip to the more robust chan_pjsip channel driver, and implementing additional network-level security controls such as SIP firewalling and rate limiting to reduce the impact of potential exploitation attempts. Organizations should also review their SIP proxy configurations to ensure that dialog-aware authentication mechanisms are properly implemented and tested, while network administrators should monitor for unusual SIP traffic patterns that might indicate exploitation attempts. Given that the vulnerability primarily affects systems using the legacy chan_sip module in conjunction with authentication proxies, immediate remediation efforts should prioritize upgrading to supported versions of Asterisk and migrating to the newer pjsip channel driver implementation that properly enforces RFC 3261 compliance for header parsing operations.

Reservation

12/12/2016

Disclosure

12/12/2016

Moderation

accepted

Entry

VDB-93990

CPE

ready

EPSS

0.01419

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!