PJSIP DNS Compression Pointer Heap Out-of-Bounds Read (CVE-2026-32945)
by JohannesLks · 2026-07-05
- Severity
- Medium
- CVE
- CVE-2026-32945
- Category
- network
- Affected product
- pjproject (PJSIP library) — used by Asterisk, FreeSWITCH, and other SIP applications
- Affected versions
- <= 2.16 (fixed in 2.17, commit 5311aee)
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | JohannesLks |
| CVE / Advisory | CVE-2026-32945 |
| Category | network |
| Severity | Medium |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | pjsip, pjproject, dns, heap-oob-read, denial-of-service, asterisk, freeswitch, sip |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | pjproject (PJSIP library) — used by Asterisk, FreeSWITCH, and other SIP applications |
| Versions Affected | <= 2.16 (fixed in 2.17, commit 5311aee) |
| Language / Platform | Python 3 (stdlib only) rogue-DNS PoC; C target library |
| Authentication Required | No |
| Network Access Required | Yes (attacker must control or spoof the DNS server the target resolves through) |
Summary
get_name_len() and get_name() in pjproject’s pjlib-util/src/pjlib-util/dns.c read a 2-byte DNS message-compression pointer via pj_memcpy(&offset, p, 2) without verifying that both bytes fall within the received packet buffer. If the compression-pointer marker byte (0xC0) is the very last byte of a DNS response, this read goes one byte past the end of the heap allocation. Any PJSIP-based application (e.g. Asterisk, FreeSWITCH) that resolves a domain through an attacker-controlled or on-path DNS server can be crashed by a single crafted 20-byte DNS response. This is the third DNS-parser vulnerability found in this file since 2022, and the earlier CVE-2022-24793 fix added length checks elsewhere in the parser but missed this specific compression-pointer path.
Vulnerability Details
Root Cause
get_name_len()/get_name() copy 2 bytes for a DNS compression pointer without bounds-checking that the second byte is still inside the packet buffer, causing a 1-byte heap-buffer-overflow read when the pointer marker is the last byte of the packet.
Attack Vector
- Attacker stands up a rogue/malicious DNS server (or achieves on-path DNS spoofing) that the target PJSIP application will query.
- Attacker crafts a minimal 20-byte DNS response whose answer record name ends in a bare
0xC0compression-pointer marker byte at the very end of the packet. - The target PJSIP application (e.g. via
pjsuaor an embedding application like Asterisk/FreeSWITCH) performs a DNS lookup routed through the rogue server. - PJSIP’s
get_name_len()reads 2 bytes at the marker position, running 1 byte past the heap buffer boundary and crashing the process (confirmed via AddressSanitizer as a heap-buffer-overflow read).
Impact
Remote, unauthenticated denial of service against any PJSIP-based SIP application that resolves domains through a network path the attacker can influence.
Environment / Lab Setup
Target: pjproject <= 2.16 (standalone ASan harness, or a real PJSIP app such as pjsua pointed at the rogue DNS server)
Attacker: Python 3 (stdlib only) for the network PoC; gcc with AddressSanitizer for the standalone harness
Proof of Concept
PoC Script
See
poc.pyin this folder.
| |
poc.py runs a rogue DNS server that answers any incoming query with the crafted 20-byte DNS response ending in a truncated compression pointer, triggering the 1-byte heap OOB read in any PJSIP client that resolves through it.
Detection & Indicators of Compromise
Signs of compromise:
- PJSIP-based SIP service (Asterisk/FreeSWITCH) crashing immediately after a DNS resolution attempt
- DNS responses containing exactly 20 bytes with a trailing bare
0xC0compression-pointer byte - Unexpected or unauthorized DNS servers configured/observed in SIP application resolver settings
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to pjproject 2.17 or later (fix commit 5311aee) |
| Interim mitigation | Ensure PJSIP-based applications only resolve DNS through trusted, authenticated resolvers; deploy DNSSEC/DoT/DoH where possible to prevent DNS spoofing |
References
Notes
Mirrored from https://github.com/JohannesLks/CVE-2026-32945 on 2026-07-05.
| |