# Unbounded memory growth with session handling in TLSv1.3

With SSL_OP_NO_TICKET in TLSv1.3, sessions get added to the cache with session_id_length later zeroed, so remove_session_lock skips them and the cache grows unbounded, enabling DoS.

- Payout: $497
- Severity: low
- Program: Internet Bug Bounty
- Found by (vendor credit): Manish Patidar (Hewlett Packard Enterprise)
- Found by: manishpatidar
- Disclosed: 2024-09-22
- CVE: CVE-2024-2511
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2622671
- Library page: https://bugbountylibrary.com/r/h1%3A2622671
- Tags: area:oss domain:oss impact:dos kind:bounty platform:hackerone sev:low tech:linux technique:source-review vuln:dos

**Target:** TLSv1.3 server session cache (SSL_CTX_add_session / remove_session_lock)
**Root cause:** A session is added to the cache but its session_id_length is later set to zero; remove_session_lock only deletes entries with non-zero session_id_length, so the cache tail can never be evicted and the cache grows without bound.
**Steps:**
1. Configure a TLSv1.3 server with SSL_OP_NO_TICKET and a small session cache limit (e.g. 20).
2. Have multiple clients open continuous connections to fill the cache.
3. Observe cache size stays within limit briefly, then grows continuously, consuming heap.
4. Trace ssl_update_cache -> SSL_CTX_add_session -> remove_session_lock: ctx->session_cache_tail has session_id_length == 0 and is not removed.
**How found:** Researcher observed cache size exceeding the configured limit after a few minutes under continuous connections, then traced the eviction path and found the cache tail had session_id_length zeroed, defeating the deletion check.
**Exploitation:** A malicious client deliberately drives many TLSv1.3 connections against a server using SSL_OP_NO_TICKET to force the cache into the broken state, causing unbounded memory growth until heap exhaustion and denial of service.
**Insight:** When auditing cache eviction, check invariants on the eviction key (here session_id_length) at removal time versus insertion time; a field mutated to zero after insertion silently disables eviction and turns a bounded cache into an unbounded one.

