Skip to content
Memory corruption Advisory Advanced CVE-2023-31247

Weston Embedded uC-HTTP HTTP Server Host header parsing memory corruption vulnerability

The HTTP server's Host header parsing allows a one-byte NULL overwrite when the header value length equals the configured maximum. This can corrupt a heap free-list pointer, enabling arbitrary memory allocation and potentially code execution.

Kelly Leuschner Follow

Originally disclosed on Cisco Talos

Critical 9.0 View original

A memory corruption vulnerability exists in the HTTP Server Host header parsing functionality of Weston Embedded uC-HTTP v3.01.01. A specially crafted network packet can lead to code execution.

Kelly Leuschner, on Cisco Talos

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The code uses the header length as an index without reserving space for the null terminator, causing an off-by-one write.

Impact

An attacker could achieve arbitrary memory allocation and potentially code execution, though the CVSS vector indicates high attack complexity.

What the attacker needed

Network access to the HTTP server; ability to send crafted HTTP requests

The fix

The code should be fixed by limiting the maximum index to one less than the buffer size, as shown in the sample patch.

How it was found

  1. Send an HTTP request with a Host header value whose length equals the configured maximum.
  2. The server copies the value and writes a null byte at index len, overwriting the first byte of the next heap block.
  3. If that block was previously freed, its free-list pointer is corrupted.
  4. On the next allocation, the corrupted pointer is dereferenced and stored as the next free pointer.
  5. On the following allocation, the attacker-controlled value is used as the allocated address.

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 report has not been written yet. The Original tab links to the source.

The server copies the Host header into a fixed-size buffer but forgets to leave room for the terminating null character. When the header is exactly the maximum allowed length, the null byte spills over into the next memory area. This can corrupt internal bookkeeping and let an attacker control where future memory is allocated.

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.

More by Kelly Leuschner

View all

32 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

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.