The vulnerability lies in the handling of the 'name' field within nested aggregation objects in Shopware's DAL (Data Abstraction Layer). The provided commit 0372c310349f9ad8e3401af69fc260378861b278 patches this vulnerability.
- File Analysis: The primary change is in
src/Core/Framework/DataAbstractionLayer/Dbal/EntityAggregator.php.
- Method Identification: The method
fetchAggregation is responsible for processing these aggregations. Before the patch, it had a direct, non-recursive check for invalid characters in the aggregation name: if (str_contains($aggregation->getName(), '?') || str_contains($aggregation->getName(), ':')). This check was insufficient for nested aggregations as stated in the vulnerability description.
- Patch Analysis: The patch introduces a new private method
validateAggregation(Aggregation $aggregation). This method performs the same check on getName() but crucially, if the aggregation is a BucketAggregation and contains a nested aggregation ($aggregation->getAggregation()), it calls validateAggregation recursively on the nested aggregation. The fetchAggregation method was modified to call $this->validateAggregation($aggregation); at its beginning, replacing its previous direct validation.
- Vulnerable Function: Since
fetchAggregation is the public-facing (within the class context, though it's private, it's the one that initiates the aggregation processing logic) method that handles the aggregation criteria and would have processed the malicious input (the aggregation name) prior to the fix, it is identified as the vulnerable function. The lack of recursive validation for nested aggregation names within fetchAggregation (before the patch) is the core of the vulnerability.