Skip to content
Memory corruption Write-up Advanced

Analysis of CVE-2021-35211 (Part 1)

A memory corruption vulnerability in SolarWinds Serv-U's SFTP component allowed an unauthenticated attacker to crash the server by sending SSH packets in an invalid order, specifically an SSH2_MSG_NEWKEYS packet without a preceding key exchange. The crash was caused by an uninitialised function pointer in an outdated OpenSSL library, which could potentially lead to remote code execution.

yichenchai.github.io

Published on yichenchai.github.io

On around 13 Jul, I chanced upon this article warning users of Solarwinds Serv-U against a pre-auth SSH RCE bug being exploited in the wild. This was pretty interesting to me, as I didn’t think SSH RCE was still possible in a year like 2021.

The author, on yichenchai.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The server did not verify that an SSH2_MSG_KEXDH_INIT packet had been received before accepting an SSH2_MSG_NEWKEYS packet, leading to the use of an uninitialised encryption context and an uninitialised function pointer in an outdated OpenSSL library.

Impact

An unauthenticated attacker could crash the Serv-U service, and the use of an uninitialised function pointer could potentially lead to remote code execution, though the report only demonstrates a crash.

What the attacker needed

Network access to the SSH service; no authentication required

The fix

The vulnerability was fixed by adding checks to ensure SSH packets are received in the correct order, specifically verifying that an SSH2_MSG_KEXDH_INIT packet has been processed before accepting SSH2_MSG_NEWKEYS.

How it was found

  1. Send an SSH2_MSG_KEXINIT packet specifying that client-to-server encryption is 'none'.
  2. Send an SSH2_MSG_NEWKEYS packet without a preceding key exchange.
  3. Send an SSH2_MSG_KEXDH_INIT packet to trigger a server response.
  4. The server attempts to encrypt the response using an uninitialised context, causing a crash.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This report describes a bug in a file-sharing server that lets an attacker crash it without logging in. The server uses a protocol called SSH to set up secure connections, but it did not check that messages arrived in the right order. By sending a message out of order, the attacker made the server use a piece of memory that had not been set up properly, causing a crash.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.