Skip to main content

OpenSIPS: Denial of service in presence.handle_publish() from unchecked Content-Type state

High 8.7

Description

OpenSIPS published GHSA-h3ww-hchh-x2g9 for a configuration-dependent crash in modules/presence/publish.c:handle_publish(). The vulnerable path calls get_content_type(msg) while sphere checking is enabled, but can reach that call without safe Content-Type parser state.

Enable Security reproduced the crash on OpenSIPS 3.5.9 with both valid and missing Content-Type PUBLISH requests over UDP and TCP.

Technical details

The vulnerable route is in the OpenSIPS presence module when handle_publish() processes a body-bearing Event: presence PUBLISH and sphere checking is enabled.

The affected code path checks whether the request body is PIDF/XML by using get_content_type(msg). In the tested OpenSIPS path, a valid Content-Type: application/pidf+xml header was present but not parsed into msg->content_type->parsed before this dereference. A missing Content-Type header also caused a crash because msg->content_type was NULL.

This means both of the following cases were unsafe in testing:

  • valid Content-Type: application/pidf+xml
  • missing Content-Type

The crash occurs before the event-specific presence_xml handler can validate the body.

Configuration requirements

The verified crash path requires:

  • presence and presence_xml loaded
  • supporting XCAP configuration so the presence stack initializes
  • modparam("presence", "enable_sphere_check", 1) enabled
  • routing logic that calls handle_publish() on attacker-controlled PUBLISH requests
  • Event: presence and a non-empty body

Impact

An attacker who can send matching PUBLISH requests to an affected OpenSIPS route can crash a worker process, causing denial of service for presence publication handling. Production reachability depends on whether PUBLISH traffic is authenticated or otherwise restricted by the routing script.

Solutions and recommendations

Upgrade to a fixed OpenSIPS version. OpenSIPS lists fixes in the May 2026 release series, including:

  • OpenSIPS 3.6.6: de5071a48 and ec38f4f01
  • OpenSIPS 4.0.0-rc1: 73279c3fe and 91e13270e
  • master: 594913524 and a03b8a82e

If immediate patching is not possible, disable sphere checking if it is not required and restrict PUBLISH routes to trusted or authenticated clients.

References

About Enable Security

Enable Security provides quality penetration testing to help protect your real-time communications systems against attack.

Disclaimer

The information in the advisory is believed to be accurate at the time of publishing based on currently available information. Use of the information constitutes acceptance for use in an AS IS condition. There are no warranties with regard to this information. Neither the author nor the publisher accepts any liability for any direct, indirect, or consequential loss or damage arising from use of, or reliance on, this information.

Disclosure policy

This report is subject to Enable Security’s vulnerability disclosure policy which can be found at https://github.com/EnableSecurity/Vulnerability-Disclosure-Policy.