Heartbleed is a memory-disclosure vulnerability in TLS heartbeat handling. A normal heartbeat asks a server to echo a stated payload, such as the 12-byte message “good_morning.” The server should return only that payload. section 10.6
The failure follows a simple attack sequence:
- A malicious client supplies a short payload but claims that it contains thousands of bytes. section 10.6
- The vulnerable server allocates a response using the claimed length and calls memcpy() without verifying that the input contains that many bytes. section 10.6
- The response reads beyond the heartbeat input and discloses adjacent server memory, potentially including private keys. section 10.6
The dangerous length mismatch
A request can provide only a few bytes while requesting several thousand bytes in the response. The server then copies from the attacker-controlled pointer for the claimed length, exposing data outside the payload buffer.
