[Home]

Summary:ASTERISK-28978: acl: named_acl rule misconfiguration results in segfault on reading rule from realtime
Reporter:Andrew Yager (andrewyager)Labels:patch
Date Opened:2020-07-04 03:57:57Date Closed:2020-07-20 09:59:48
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/ACL
Versions:16.11.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) 0001-acl-Coerce-a-NULL-pointer-into-the-empty-string.patch
Description:If an ACL is misconfigured in the realtime database (for instance, the "rule" is blank) and Asterisk attempts to read the ACL, asterisk will segfault during reading the rule and crash. For some reason it doesn't seem to produce a coredump, however I haven't verified that this isn't because my system is incorrectly configured.

This can be worked around by ensuring the ACLs are not misconfigured, but ideally asterisk should gracefully fail and not crash.
Comments:By: Asterisk Team (asteriskteam) 2020-07-04 03:57:59.860-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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: Andrew Yager (andrewyager) 2020-07-04 04:11:40.650-0500

I have pulled the CoreDump from the issue, but I had optimize on in this build; but BT points to the issue pretty clearly:

{code}
#1  0x0000559ce34dadd9 in append_ha_core (sense=sense@entry=0x7f4bbc004096 "deny", stuff=stuff@entry=0x0, path=path@entry=0x0, error=error@entry=0x7f4bd46da1f4, port_flags=port_flags@entry=768) at acl.c:581
       __old = 0x0
       __len = <optimized out>
       __new = <optimized out>
       ha = <optimized out>
       prev = 0x0
       ret = <optimized out>
       tmp = 0x1e3751a20 <error: Cannot access memory at address 0x1e3751a20>
       list = 0x7f4bbc007270 "0>"
       address = <optimized out>
       mask = <optimized out>
       addr_is_v4 = <optimized out>
       allowing = <optimized out>
       __PRETTY_FUNCTION__ = "append_ha_core"
{code}


By: Sean Bright (seanbright) 2020-07-09 11:53:35.392-0500

[~andrewyager], can you try the [attached patch|^0001-acl-Coerce-a-NULL-pointer-into-the-empty-string.patch] and let us know if it resolves the crash?

By: Andrew Yager (andrewyager) 2020-07-10 23:04:05.981-0500

Confirmed the attached patch solves the problem and produces the expected output.

{code}
Could not find ACL named 'test'
*CLI> [2020-07-11 04:02:13] WARNING[2247]: acl.c:617 append_ha_core: Invalid IP address:
[2020-07-11 04:02:13] ERROR[2247]: named_acl.c:273 named_acl_find_realtime: Rejecting realtime ACL due to bad ACL definition 'test': 1 - permit - (null)
{code}

By: Friendly Automation (friendly-automation) 2020-07-20 09:59:48.890-0500

Change 14636 merged by Joshua Colp:
acl.c: Coerce a NULL pointer into the empty string

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

By: Friendly Automation (friendly-automation) 2020-07-20 10:02:11.217-0500

Change 14660 merged by Joshua Colp:
acl.c: Coerce a NULL pointer into the empty string

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

By: Friendly Automation (friendly-automation) 2020-07-20 11:39:25.030-0500

Change 14659 merged by George Joseph:
acl.c: Coerce a NULL pointer into the empty string

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

By: Friendly Automation (friendly-automation) 2020-07-20 11:39:45.687-0500

Change 14663 merged by George Joseph:
acl.c: Coerce a NULL pointer into the empty string

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

By: Friendly Automation (friendly-automation) 2020-07-20 11:40:04.024-0500

Change 14661 merged by George Joseph:
acl.c: Coerce a NULL pointer into the empty string

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