[Home]

Summary:ASTERISK-28402: res_pjsip_registrar: SEGV in registrar_find_contact
Reporter:Ross Beer (rossbeer)Labels:pjsip
Date Opened:2019-05-01 08:09:29Date Closed:2019-05-03 09:17:45
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_pjsip_registrar
Versions:13.26.0 GIT Frequency of
Occurrence
One Time
Related
Issues:
Environment:CentOS 7Attachments:
Description:Multiple Asterisk instances all crashed when receiving a register from an endpoint with the same contact_uri:

{noformat}
contact_uri = 0x7fc601192540 "sip:<user>@<IP ADDRESS>:18278;transport=TCP;app-id=929724111839;pn-type=firebase;pn-tok=dm50F_axqHM:APA91bEcOCDKDjzqSaKJycnjVtunl7fV8tsf5ERUFxB6KWvppJNh-bN3NYhMVhrDgVyXy4Kf_bsasntpuKgJmIWyNMK0IEzd"...
{noformat}

This contact somehow leads to a null pointer being compared which causes an Asterisk segfault:

{noformat}
#0  0x00007fc8061bc189 in pjsip_url_compare (context=PJSIP_URI_IN_CONTACT_HDR, url1=0x7fc71fada0c8, url2=0x0) at ../src/pjsip/sip_uri.c:400
{noformat}

I
Comments:By: Asterisk Team (asteriskteam) 2019-05-01 08:09:31.399-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Asterisk Team (asteriskteam) 2019-05-01 08:09:32.864-0500

This issue has been automatically restricted and set to a blocker due to being a security type issue. If this is not a security vulnerability issue it will be moved to the appropriate issue type when triaged.

By: George Joseph (gjoseph) 2019-05-02 13:26:44.242-0500

We can't reproduce this but the backtraces confirm that the return from pjsip_parse_uri was NULL even though the uri being parsed was perfectly valid.  Since we weren't checking for the NULL, the call to pjsip_uri_cmp SEGVd.

Patch to check the return is in progress.




By: Friendly Automation (friendly-automation) 2019-05-03 09:17:47.403-0500

Change 11335 merged by Friendly Automation:
res_pjsip:  Check return from pjsip_parse_uri calls

[https://gerrit.asterisk.org/c/asterisk/+/11335|https://gerrit.asterisk.org/c/asterisk/+/11335]

By: Friendly Automation (friendly-automation) 2019-05-03 09:20:49.330-0500

Change 11333 merged by Friendly Automation:
res_pjsip:  Check return from pjsip_parse_uri calls

[https://gerrit.asterisk.org/c/asterisk/+/11333|https://gerrit.asterisk.org/c/asterisk/+/11333]

By: Friendly Automation (friendly-automation) 2019-05-03 09:23:03.401-0500

Change 11334 merged by Friendly Automation:
res_pjsip:  Check return from pjsip_parse_uri calls

[https://gerrit.asterisk.org/c/asterisk/+/11334|https://gerrit.asterisk.org/c/asterisk/+/11334]