<remark><p>Recommended hashing the secret to satisfy length requirement; hostnames and Stream ID should be separated by spaces to avoid ambiguity; updated example to match rfc3920bis.</p>
<p>Clarified and corrected roles of originating and receiving servers; updated recommendation and main example to use HMAC-SHA256 for key generation.</p>
<p><cite>RFC 3920</cite> does not specify how to generate the keys used in the server dialback protocol, and why each of the variables used in key generation is crucial for security. This document is provided for discussion purposes and aims at clarifying the key generation and its validation mechanism and to show common attacks on weak mechanisms. It is not meant to supersede the text in <cite>RFC 3920</cite>; however, the recommendations in this document have been incorporated into <cite>rfc3920bis</cite>.</p>
<p>The Originating Server, which generates the dialback key, and the Authoritative Server, which validates the dialback key, may reside on different hosts or be running in separate processes. The method used in key generation and validation should not require interactive communication between Originating Server, Authoritative Server and optionally a third party like a database.</p>
<p>The key is generated based on</p>
<ul>
<li>the (hostname of) Originating Server,</li>
<li>the (hostname of) Receiving Server,</li>
<li>the Stream ID,</li>
<li>and a secret known by the Authoritative Server's network.</li>
<p>The last item, a shared secret known to Originating Server and Authoritative Server, is used in a Keyed-Hash Message Authentication Code (HMAC) to generate and validate the dialback keys. This key must either be set up in a configuration option for each host or process or generated as a random string when starting the server.</p>
<p>&nistfips198a; recommends that the length of the key should be at least half of the size of the hash function output. To fulfill this requirement, the secret should be hashed with the hash function prior to usage as key in HMAC.</p>
<p>The Stream ID and the involved hostnames should be concatenated with a unicode space character (U+0020) for the delimiter.</p>
<p>This document closely follows the description of the dialback protocol in RFC 3920, but omits steps that are not important for the generation and validation of the dialback keys. For ease of comparison the numbering of the steps is the same as in section 8.3 of RFC 3920.</p>
<p>3. Receiving Server sends a stream header back to the Originating Server, including a unique ID for this interaction:</p>
<p>The Authoritative Server calculates the valid key for this verify request, using data supplied in the packet and the secret shared with the Originating Server.</p>
<p>9. The Authoritative Server compares this value to the key contained in the verification requests and informs the Originating Server of the result, in our example a success:</p>
<section1topic='Attacks Against Key Generation Methods'>
<p>This section contains attack scenarios that illustrate why each of the factors used in key generation is important.</p>
<p>An attacker will assume the role of the Originating Server and try to send a dialback key that the Authoritative Server acknowledges as valid. If this is successful, the attacker is allowed to send packets for the hostname of the Authoritative Server.</p>
<p>In each subsection, the example hash method, which uses the SHA1 algorithm as described in &rfc3174; for simplicity, ignores one of the variables,</p>
<ul>
<li>Originating Server,</li>
<li>Stream ID,</li>
<li>Receiving Server,</li>
<li>or Secret,</li>
</ul>
<p>and it is shown how an attacker might exploit this behavior to get a valid result from the Authoritative Server.</p>
<section2topic='Hostname of Originating Server Not Considered'>
<p>This subsection demonstrates what can happen if the key generation method ignores the hostname of the Originating Server, e.g. for the hash function</p>
<code>
key = SHA1({ Secret, Receiving Server, Stream ID })
</code>
<p>The dialback keys generated for the originating domains 'example.com' and 'example.net' are the same, which might disclose that the secret used to generate the keys for these domains is equal. An attacker cannot exploit this any further.</p>
<p>If the key generation method does not take into account a shared secret in the Authoritative Servers network or if this secret is disclosed and the key generation method is known, an attacker can generate valid dialback keys.</p>
<code>
key = SHA1({ Receiving Server, Originating Server, Stream ID })
</code>
<p>In both cases the attacker is able to generate an arbitrary number of dialback keys.</p>
<p>This document introduces no security considerations or concerns above and beyond those discussed in <cite>RFC3920</cite>, but describes what might happen if the security considerations are ignored.</p>