[asterisk-bugs] [JIRA] (ASTERISK-29264) Certain IAX2 authentication failures cause Asterisk to crash

N A (JIRA) noreply at issues.asterisk.org
Fri Jan 29 10:44:59 CST 2021


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=253665#comment-253665 ] 

N A edited comment on ASTERISK-29264 at 1/29/21 10:43 AM:
----------------------------------------------------------

Hmm, I *assumed* (and maybe was wrong about this) that somehow the auth method was inferred from the negotiation. At least, it seemed to be working that way, as if the right secret was provided in the Dial string, I could correctly make calls regardless of whether the called switch was using plain text or MD5 authentication.

It seems like setting auth in general would break this by forcing a particular method. I don't necessarily always want to use MD5 authentication, just whatever the called peer is using. Is this information negotiated/communicated back to the calling switch? That's what it seemed to be doing to do either PT or MD5 authentication properly.

Just worried that if, say, the called switch is actually using plain text or no encryption instead, it would not work (RSA requires an IAX2 user present on both sides, if my understanding is correct, so I don't think there would be any issues here anyways). This all assumes there is no way to communicate the auth method in the dial string, even if known.

Hope this makes sense - if not, I can clarify. My worry here is interoperability between switches with differing authentication methods that may not be the same and/or known in advance. Would adding auth=md5 to [general] in iax.conf potentially break anything?


was (Author: interlinked):
Hmm, I *assumed* (and maybe was wrong about this) that somehow the auth method was inferred from the negotiation. At least, it seemed to be working that way, as if the right secret was provided in the Dial string, I could correctly make calls regardless of whether the called switch was using plain text or MD5 authentication.

It seems like setting auth in general would break this by forcing a particular method. I don't necessarily always want to use MD5 authentication, just whatever the called peer is using. Is this information negotiated/communicated back to the calling switch? That's what it seemed to be doing to do either PT or MD5 authentication properly.

Just worried that if, say, the called switch is actually using plain text or no encryption instead, it would not work (RSA requires an IAX2 user present on both sides, if my understanding is correct, so I don't think there would be any issues here anyways). This all assumes there is no way to communicate the auth method in the dial string, even if known.

Hope this makes sense - if not, I can clarify. My worry here is interoperability between switches with differing authentication methods that may not be the same and/or known in advance.

> Certain IAX2 authentication failures cause Asterisk to crash
> ------------------------------------------------------------
>
>                 Key: ASTERISK-29264
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29264
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_iax2, Resources/res_crypto
>    Affects Versions: 16.16.0
>         Environment: Debian Linux 9 and 10, multiple Asterisk versions ranging from 13.23.1 to 13.38 to version 16. To my knowledge, all Asterisk versions with res_crypto are affected from the testing that has been done.
>            Reporter: N A
>            Assignee: Unassigned
>            Severity: Major
>              Labels: crash
>         Attachments: core-brief.txt, core-brief.txt, core-full.txt, core-full.txt, core-info.txt, core-info.txt, core-locks.txt, core-locks.txt, core-thread1.txt, core-thread1.txt
>
>
> Versions affected: All versions of Asterisk with res_crypto.so loaded: This bug affects all known Asterisk versions from the testing that has been done on multiple different Asterisk machines on multiple versions of Debian Linux. The dump attached is from a 13.23.1 testing system.
> This issue affects chan_iax2 and/or res_crypto. I initially thought it was the former, but it may be more of the latter.
> IAX2 supports no, plaintext, md5, and rsa authentication, the latter two of which allow for encryption. It has been identified that Asterisk contains a bug that results in a crash in the following circumstance: Switch B requires MD5 authentication (i.e. it requires a secret) for some IAX2 user. Switch A places a call to Switch B with all the correct information, except it omits to provide any kind of secret (that is, the Dial string is IAX2/user at host/extension as opposed to IAX2/user:secret at host/extension). In this case, Switch A's Asterisk will immediately crash. Once Asterisk is manually started again, Asterisk runs normally until the next crash.)
> This does not occur with plaintext authentication, it does not occur if an invalid IAX2 user is called, and it does not occur if the desired IAX2 user is called and a secret is provided that is not the right secret. It only occurs when the called IAX2 user requires an MD5 secret but NO secret at all is provided by the calling switch. RSA has not been tested at all.
> I suspect this issue is related to Switch A not knowing how to handle the failed authentication negotiation with Switch B. In most such scenarios, Switch A will say "I don't know how to authenticate to..." and then time out or end the call with CHANUNAVAIL, as expected. In this case, it says "I don't know how to authenticate to..." and then immediately crashes.
> If res_crypto is not loaded, Switch A cannot negotiate the authentication at all, so the call fails but the switch does not crash. Obviously, such a switch cannot make any encrypted IAX2 call.
> What should be happening here is that Asterisk should simply fail the call with a CHANUNAVAIL result as in all other circumstances where an IAX2 call fails (e.g. wrong user, wrong plaintext secret, etc.) Instead, Asterisk just crashes.
> Backtrace files from ast_coredumper attached.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list