The vulnerability is a cache poisoning issue in self-hosted Next.js applications. The root cause is that the cache keys used for statically generated (SSG) and incrementally regenerated (ISR) pages were not specific enough. This allowed different routes to share the same cache entry, leading to a scenario where a request for one page could poison the cache for another page.
The patches address this vulnerability by introducing a new cache keying strategy that scopes the cache keys to their source route. This is achieved by creating a new function, getRouteCacheKey, which generates a unique key for each route by hashing its source. This new function is then used throughout the codebase in places where cache entries are created or accessed, including in the FileSystemCache, the build process, and the page handlers.
The vulnerable functions are those that were involved in the caching process and were using the old, non-specific cache keys. The most critical of these is the FileSystemCache.get method, which is responsible for retrieving cached pages. The page handlers (handler in app-page.ts and app-route.ts) are also directly implicated, as they were not verifying the ownership of prerendered cache entries. Finally, the Server.findPageComponents method had a flaw in its page selection logic for parallel routes that could lead to the wrong cache entry being accessed.