The vulnerability is a Server-Side Request Forgery (SSRF) in Statamic's Glide image manipulation feature. The root cause was the lack of input validation on URLs provided for external images, either directly or through the watermark feature. The analysis of the patch commit 3c008e0f66a72c11a1c0049a5a4044a5b3eca1b6 revealed the core of the vulnerability and the fix.
The primary vulnerable function was Statamic\Imaging\ImageGenerator::parseUrl, which used PHP's parse_url without checking if the host resolved to a private or reserved IP address. This function was called by Statamic\Imaging\ImageGenerator::generateByUrl, which is the main function for processing external image URLs.
Additionally, the Statamic\Imaging\GuzzleAdapter::get method was vulnerable to SSRF via open redirects. An attacker could provide a safe-looking URL that would redirect to an internal service, and the server would follow it.
The patch introduces a new Statamic\Imaging\RemoteUrlValidator class, which is now used in both ImageGenerator::parseUrl and as a redirect middleware in GuzzleAdapter::get. This validator ensures that any provided URL is using http or https, does not contain credentials, and resolves to a public IP address, effectively mitigating the SSRF vulnerability. The controller Statamic\Http\Controllers\GlideController::generateBy was updated to handle exceptions from this new validator, confirming it as the entry point for exploitation.