Skip to content
Memory corruption Write-up Advanced

!exploitable Episode Two - Enter the Matrix

The SSH daemon's crc32 compensation attack detector had a 16-bit integer overflow in its hash table size calculation, allowing a remote attacker to cause memory corruption and potentially execute arbitrary code.

blog.doyensec.com

Published on blog.doyensec.com

In case you are just tuning in, Doyensec has found themselves on a cruse ship touring the Mediterranean. Unwinding, hanging out with colleagues and having some fun.

Dennis Goodlett, on blog.doyensec.com

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

Likely a 16-bit unsigned integer overflow when a 32-bit length value is assigned to a 16-bit variable, causing the allocated hash table to be too small for later writes.

Impact

A remote attacker could cause memory corruption and potentially execute arbitrary code, though the text notes that no reliable public exploit existed until June 2001.

What the attacker needed

Network access to SSH daemon; send crafted encrypted packet

How it was found

  1. Compile the provided standalone main.c with gcc -g.
  2. Set the input length to 0x15560 or more so the loop runs twice.
  3. Call detect_attack with that buffer.
  4. Debug with lldb and observe that l becomes 0x10000, which overflows the 16-bit n to 0.

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.

SSH is a protocol for secure remote login. A bug in its attack-detection code let a remote attacker send specially crafted data that overflowed a small counter, corrupting memory and possibly running their own code on the server.

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.