Heap Overflow — libssl 3.x

Condensed notes on the CVE-2024-XXXXX heap overflow in libssl 3.x. Target: 10.10.10.42 on :443.

Primitive

The bug is a classic malloc header corruption via an over-long TLS extension. Controllable write of 8 bytes past a tcache chunk boundary.

ssl_ext_parse.c
C
/* len is attacker-controlled — no upper bound check */
memcpy(buf + offset, ext_data, len);
 
/* chunk header sits 8 bytes past buf end when len == buf_sz */
typedef struct {
  size_t prev_size;
  size_t size;       /* overwritten — clears PREV_INUSE */
} malloc_chunk;

Exploitation steps

  1. Groom heap with SSL_CTX_new() calls to align target chunk.
  2. Send crafted ClientHello — extension type 0x000f, length buf_sz.
  3. Trigger free() of next chunk — corrupted size causes consolidation into unsorted bin.
  4. Use malloc_consolidate() to get a pointer into libc's .data.
  5. Overwrite __free_hooksystem. Pass /bin/sh as next freed pointer.

⚠ Warning — Step 3 is timing-sensitive on multi-threaded servers. Run the grooming loop in a tight 50 ms window.

Patch check

  • Fixed in OpenSSL 3.0.14 — bounds check added before memcpy.
  • Verify: openssl version -a | grep -E '^OpenSSL 3'
Disclaimer

All content published on exploit.se is intended strictly for educational and informational purposes. Research is conducted responsibly under coordinated disclosure principles.

Techniques, tools, and writeups shared on this site are meant to advance the security community's understanding of vulnerabilities and defences. They are not intended to encourage or enable unauthorised access to any system.

The author bears no responsibility for any misuse of information presented here.

Cookie Settings

This site does not use cookies, analytics, or any third-party tracking technologies.

No personal data is collected. No fingerprinting. No ads. You are not the product.


 ██╗ ██████╗ ███████╗██╗███████╗███╗   ██╗██████╗
 ██║██╔═══██╗██╔════╝██║██╔════╝████╗  ██║██╔══██╗
 ██║██║   ██║█████╗  ██║█████╗  ██╔██╗ ██║██║  ██║
 ██║██║   ██║██╔══╝  ██║██╔══╝  ██║╚██╗██║██║  ██║
 ██║╚██████╔╝██║     ██║███████╗██║ ╚████║██████╔╝
 ╚═╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝╚═╝  ╚═══╝╚═════╝
You found me.
↑↑↓↓←→←→ B A  ·  click to close