<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Keyboard-Interactive — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/keyboard-interactive/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jul 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/keyboard-interactive/feed.xml" rel="self" type="application/rss+xml"/><item><title>russh Keyboard-Interactive Authentication Denial-of-Service</title><link>https://feed.craftedsignal.io/briefs/2024-07-03-russh-dos/</link><pubDate>Wed, 03 Jul 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-07-03-russh-dos/</guid><description>A denial-of-service vulnerability exists in the russh crate, where a malicious client can crash any russh-based server implementing keyboard-interactive authentication by sending a crafted SSH_MSG_USERAUTH_INFO_RESPONSE message with a large response count, leading to excessive memory allocation and an out-of-memory crash without requiring any credentials.</description><content:encoded><![CDATA[<p>A pre-authentication denial-of-service vulnerability exists in the russh crate, specifically affecting servers that implement keyboard-interactive authentication. This vulnerability allows a malicious client to crash a russh-based server by sending a malformed packet, without needing any valid credentials. The vulnerability resides in the <code>read_userauth_info_response</code> function within <code>russh/src/server/encrypted.rs</code>, where an unbounded <code>u32</code> count from the client&rsquo;s <code>SSH_MSG_USERAUTH_INFO_RESPONSE</code> message is used directly to allocate memory via <code>Vec::with_capacity()</code>. An attacker can exploit this by sending a large value for &rsquo;n&rsquo; (e.g., 0x10000000), leading to a massive memory allocation attempt and subsequent out-of-memory crash. This affects servers using keyboard-interactive for multi-step authentication such as TOTP or 2FA. The vulnerability exists in russh versions prior to 0.60.1.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker establishes a TCP connection to the russh server.</li>
<li>The attacker performs the initial SSH key exchange (anonymous DH handshake).</li>
<li>The attacker sends a <code>USERAUTH_REQUEST</code> message with the authentication method set to <code>keyboard-interactive</code>.</li>
<li>The server responds with <code>Auth::Partial</code>, indicating that keyboard-interactive authentication is in progress and prompts are required.</li>
<li>The attacker sends a <code>USERAUTH_INFO_RESPONSE</code> message with a crafted <code>u32</code> value for &rsquo;n&rsquo; set to a large number, such as 0x10000000 (268435456), indicating the number of responses.</li>
<li>The attacker intentionally does not include any response data in the <code>USERAUTH_INFO_RESPONSE</code> message, to maximize the memory allocation attempt.</li>
<li>The server attempts to allocate memory using <code>Vec::with_capacity(n)</code>, where n is the attacker-controlled large value, triggering excessive memory allocation.</li>
<li>The server exhausts available memory, leading to an out-of-memory (OOM) condition, and the server process crashes, causing a denial of service.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>A successful attack results in a denial of service, crashing the russh server and affecting all active SSH sessions. Because the attack occurs before authentication, it can be executed repeatedly and quickly, preventing legitimate users from accessing the server. This can disrupt services relying on the SSH server, leading to downtime and potential data loss. An end-to-end Proof of Concept demonstrates that a russh server within a container with a 512MB memory limit can be OOM-killed by this vulnerability.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to russh version 0.60.1 or later to incorporate the fix that limits the <code>Vec::with_capacity</code> allocation based on the remaining packet data.</li>
<li>Monitor network traffic for SSH <code>USERAUTH_INFO_RESPONSE</code> messages with unusually large response counts using the provided Sigma rule &ldquo;Detect Excessive SSH Keyboard-Interactive Responses&rdquo;.</li>
<li>Implement rate limiting or connection limits to mitigate the impact of rapid connection attempts from malicious clients.</li>
<li>Review and audit implementations of <code>Handler::auth_keyboard_interactive</code> to ensure proper input validation and resource management, especially where <code>Auth::Partial</code> is returned.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>denial-of-service</category><category>russh</category><category>keyboard-interactive</category></item></channel></rss>