The vulnerability lies in the calculateQueryComplexity function in src/GraphQL/helpers/queryComplexity.js. This function is responsible for calculating the complexity of GraphQL queries to prevent resource exhaustion. The core of the vulnerability is an inefficient algorithm for handling GraphQL fragments. Specifically, the nested visitSelectionSet function recursively processed fragment spreads. In the vulnerable version, it did so without memoization, meaning that if a fragment was spread multiple times, its complexity would be recalculated each time. This allowed an attacker to craft a query with a 'binary fan-out' of fragment spreads, where each fragment references two others. This structure leads to an exponential growth in the number of traversal steps, causing the Node.js event loop to block for a significant amount of time and resulting in a Denial of Service (DoS). The provided patches fix this by introducing a cache (fragmentCache) to memoize the complexity of each fragment. This ensures that each fragment's complexity is calculated only once, changing the algorithm's time complexity from exponential to linear and preventing the DoS. The createComplexityValidationPlugin function is the entry point that triggers this validation and would be present in any stack trace related to the exploit.