Unbounded memory growth with session handling in TLSv1.3
A non-default TLS server configuration using the SSL_OP_NO_TICKET option can cause the session cache to fail to flush properly, leading to unbounded memory growth. A malicious client could deliberately trigger this to cause a denial of service.
Originally disclosed on HackerOne
- Triaged in 21 hours
- Fixed in 30 days
- Paid in 30 days
- Disclosed after 2 months
Summary by the program
OpenSSL Security Advisory: https://www.openssl.org/news/secadv/20240408.txt CVE-2024-2511
The report
Some non-default TLS server configurations can cause unbounded memory growth when processing TLSv1.3 sessions
This problem can occur in TLSv1.3 if the non-default SSL_OP_NO_TICKET option is being used (but not if early_data support is also configured and the default anti-replay protection is in use). In this case, under certain conditions when multiple Client connect to server, the session cache can get into an incorrect state and it will fail to flush properly as it fills. The session cache will continue to grow in an unbounded manner. A malicious client could deliberately create the scenario for this failure to force a Denial of Service.
Steps to reproduce:
- Multiple browser connecting to webserver and sending continuous connection request
- Session cache limit is set to 20 and with SSL_OP_NO_TICKET option.
- Initial few minutes cache size is ok ( within 20) but after that cache is increasing continuously and consuming all the heap memory available.
• When new Session is added , OpenSSL is trying to reduce the cache size but remove_session_lock (ssl_update_cache -> SSL_CTX_add_session ->remove_session_lock) not able to remove the entries from cache • ctx->session_cache_tail passed to remove_session_lock having session_id_length as zero and there is a check in remove_session_lock that only non zero session_id_length are deleted. After that no old session are deleted from cache and new session are added to cache and keep increasing the cache.

Reason:session was added to cache but later session_id_length was update as zero. After that cache tail have session_id_length as zero and no entry is deleted after that.


Impact
An attacker may exploit certain server configurations to trigger unbounded memory growth that would lead to a Denial of Service. This issue only affects TLS servers supporting TLSv1.3. It does not affect TLS clients.
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
Likely a session was added to the cache but its session_id_length was later set to zero, and the removal function only deletes entries with a non-zero session_id_length, so the cache tail entry is never removed and the cache grows without bound.
Impact
An attacker may exploit certain server configurations to trigger unbounded memory growth that would lead to a Denial of Service.
What the attacker needed
TLS server supporting TLSv1.3; SSL_OP_NO_TICKET option enabled; early_data not configured with anti-replay
How it was found
- Multiple browsers connect to the web server and send continuous connection requests.
- The session cache limit is set to 20 and the SSL_OP_NO_TICKET option is enabled.
- Initially the cache size stays within the limit, but after a few minutes it increases continuously and consumes all available heap memory.
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.
When a server handles many secure connections, it keeps a small cache of session information to speed up reconnections. In this bug, under a specific non-default setting, the cache stops removing old entries and keeps growing until the server runs out of memory. An attacker could exploit this to make the server crash or become unresponsive.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.