[asterisk-bugs] [JIRA] (ASTERISK-28903) res_srtp: Answered Crypto Suite might be wrong in SDP/SDES.

Alexander Traud (JIRA) noreply at issues.asterisk.org
Mon May 18 10:12:25 CDT 2020


Alexander Traud created ASTERISK-28903:
------------------------------------------

             Summary: res_srtp: Answered Crypto Suite might be wrong in SDP/SDES.
                 Key: ASTERISK-28903
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28903
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_srtp
    Affects Versions: 17.4.0, 16.10.0
            Reporter: Alexander Traud


Fixing my own code. ASTERISK-26190 introduced the support for additional Crypto Suites in SDES-sRTP. Normally, one would expect that the UAS = Asterisk simply copies the name of the very first supported Crypto Suite. 

In Asterisk, {{ast_sdp_srtp_get_attrib(.)}} is called long time after the Crypto Suite are accepted via {{ast_sdp_crypto_process(.)}}. However, instead of a string, my code uses flags, one for the tag length for authentication, one for the AES size, and one flag whether an old—flipped—name for the Crypto Suite is used. This avoids the creation/deletion of one additional dynamic string buffer.

However, {{res_sdp_crypto_parse_offer(.)}} might have parsed the name of the Crypto Suite, set those flags but not accept the Crypto Suite for other reasons, for example:
{code}
WARNING: sdp_srtp.c:1050: SRTP descriptions key length is '48', not '46'
{code}
This happens, when the UAC has a faulty SDES-sRTP implementation. For example, desk phones from [Atcom|https://www.atcom.cn] allow not only AES-128 but also AES-256. However, the provided key is too long. With those, the current implementation in Asterisk answers:
{code}
a=crypto:3 AES_CM_256_HMAC_SHA1_80 inline: …
{code}
The result is a call with broken audio although the Crypto Suite at index 3, AES_CM_*128*_HMAC_SHA1_80 has the correct key length and works great.

This happens, because the ‘object’, where the flags are set, gets reused by the channel, here chan_sip. In other words: The flag for AES-256 is still set from the previous parsing of the Crypto Suite name. The trick is to clear all flags before any new parsing/selection happens. The attached patch does this.



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



More information about the asterisk-bugs mailing list