The vulnerability lies in the zeroconf library's DNS cache mechanism, which failed to impose limits on the number of records it stored. The core of the issue is in the DNSCache._async_add method. This function, prior to being patched, would insert DNS records into the cache without any size restrictions. An unauthenticated attacker on the same local network could exploit this by sending a continuous flood of multicast DNS responses with unique names. Each of these responses would be added to the cache by _async_add, causing the application's memory usage to grow without bounds, eventually leading to a denial of service through memory exhaustion (OOM kill).
A second variant of the attack involved re-sending already cached records but with different TTL (Time-To-Live) values. This would cause the _expire_heap, a data structure used to manage record expirations, to grow indefinitely between cleanup cycles, even if the main cache size remained stable. This also leads to uncontrolled resource consumption.
The patch addresses these issues by introducing a hard cap on the total number of records (_MAX_CACHE_RECORDS) and implementing an eviction policy (_async_evict_oldest) within the _async_add function. When the cache is full, the oldest record is removed to make space for a new one. To counter the heap growth attack, a heap rebuilding mechanism (_maybe_rebuild_heap) was added, which is also called from within _async_add to keep the heap size in check. Therefore, DNSCache._async_add is the primary vulnerable function, and DNSCache.async_add_records is the public-facing method that orchestrates the addition of multiple records, making it a key function that would be observed during exploitation.