CVE-2026-27127
JSON

7.0high

Craft CMS has Cloud Metadata SSRF Protection Bypass via DNS Rebinding

Severity
7.0high CVSS:4.0 by GitHub_M
Exploit likelihood
0.48% (higher than 43% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-gp2f-7wcm-5fhx

Description

Craft is a content management system (CMS). In versions 4.5.0-RC1 through 4.16.18 and 5.0.0-RC1 through 5.8.22, the SSRF validation in Craft CMS’s GraphQL Asset mutation performs DNS resolution separately from the HTTP request. This Time-of-Check-Time-of-Use (TOCTOU) vulnerability enables DNS rebinding attacks, where an attacker’s DNS server returns different IP addresses for validation compared to the actual request. This is a bypass of the security fix for CVE-2025-68437 that allows access to all blocked IPs, not just IPv6 endpoints. Exploitation requires GraphQL schema permissions for editing assets in the `<VolumeName>` volume and creating assets in the `<VolumeName>` volume. These permissions may be granted to authenticated users with appropriate GraphQL schema access and/or Public Schema (if misconfigured with write permissions). Versions 4.16.19 and 5.8.23 patch the issue.

Affected

Product or packageVersionsReported by
craftcms cms>= 4.5.0-RC1, < 4.16.19, >= 5.0.0-RC1, < 5.8.23CVE List
craftcms/cms (Packagist)from 5.0.0-RC1 before 5.8.23, from 3.5.0 before 4.16.19GitHub Advisory Database
craftcms craft_cmsfrom 3.5.1 before 4.16.19, from 5.0.1 before 5.8.23, 3.5.0, 5.0.0NVD

All scores

GitHub_M7.0high CVSS:4.0CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N
NVD6.3medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N

Classification

CWE-367

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Craft is a content management system (CMS). In versions 4.5.0-RC1 through 4.16.18 and 5.0.0-RC1 through 5.8.22, the SSRF validation in Craft CMS’s GraphQL Asset mutation performs DNS resolution separately from the HTTP request. This Time-of-Check-Time-of-Use (TOCTOU) vulnerability enables DNS rebinding attacks, where an attacker’s DNS server returns different IP addresses for validation compared to the actual request. This is a bypass of the security fix for CVE-2025-68437 that allows access to all blocked IPs, not just IPv6 endpoints. Exploitation requires GraphQL schema permissions for editing assets in the `<VolumeName>` volume and creating assets in the `<VolumeName>` volume. These permissions may be granted to authenticated users with appropriate GraphQL schema access and/or Public Schema (if misconfigured with write permissions). Versions 4.16.19 and 5.8.23 patch the issue.

GitHub Advisory Database

Summary

The SSRF validation in Craft CMS’s GraphQL Asset mutation performs DNS resolution separately from the HTTP request. This Time-of-Check-Time-of-Use (TOCTOU) vulnerability enables DNS rebinding attacks, where an attacker’s DNS server returns different IP addresses for validation compared to the actual request.

This is a bypass of the security fix for CVE-2025-68437 (GHSA-x27p-wfqw-hfcc) that allows access to all blocked IPs, not just IPv6 endpoints.

Severity

Bypass of cloud metadata SSRF protection for all blocked IPs

Required Permissions

Exploitation requires GraphQL schema permissions for:

  • Edit assets in the <VolumeName> volume
  • Create assets in the <VolumeName> volume

These permissions may be granted to:

  • Authenticated users with appropriate GraphQL schema access
  • Public Schema (if misconfigured with write permissions)

Technical Details

Vulnerable Code Flow

The code at src/gql/resolvers/mutations/Asset.php performs two separate DNS lookups:

// VALIDATION PHASE: First DNS resolution at time T1
private function validateHostname(string $url): bool
{
    $hostname = parse_url($url, PHP_URL_HOST);
    $ip = gethostbyname($hostname);  // DNS Lookup #1 - Returns safe IP

    if (in_array($ip, [
        '169.254.169.254',   // AWS, GCP, Azure IMDS
        '169.254.170.2',     // AWS ECS metadata
        '100.100.100.200',   // Alibaba Cloud
        '192.0.0.192',       // Oracle Cloud
    ])) {
        return false;  // Check passes - IP looks safe
    }
    return true;
}

// ... time gap between validation and request ...

// REQUEST PHASE: Second DNS resolution at time T2 (inside Guzzle)
$response = $client->get($url);  // DNS Lookup #2 - Guzzle resolves DNS AGAIN
                                  // Now returns 169.254.169.254!
Root Cause

Two separate DNS lookups occur:

  1. Validation: gethostbyname() in validateHostname()
  2. Request: Guzzle's internal DNS resolution via libcurl

An attacker controlling a DNS server can return different IPs for each query.

Bypass Mechanism
+-----------------------------------------------------------------------------+
| Attacker's DNS Server: evil.attacker.com                                    |
+-----------------------------------------------------------------------------+
| Query 1 (Validation - T1):                                                  |
|   Request:  A record for evil.attacker.com                                  |
|   Response: 1.2.3.4 (safe IP, TTL: 0)                                       |
|   Result:   Validation PASSES                                               |
+-----------------------------------------------------------------------------+
| Query 2 (Guzzle Request - T2):                                              |
|   Request:  A record for evil.attacker.com                                  |
|   Response: 169.254.169.254 (metadata IP, TTL: 0)                           |
|   Result:   Request goes to blocked IP -> CREDENTIALS STOLEN                |
+-----------------------------------------------------------------------------+

Target Endpoints via DNS Rebinding

DNS rebinding allows access to all blocked IPs:

TargetRebind ToImpact
AWS IMDS169.254.169.254IAM credentials, instance identity
AWS ECS169.254.170.2Container credentials
GCP Metadata169.254.169.254Service account tokens
Azure Metadata169.254.169.254Managed identity tokens
Alibaba Cloud100.100.100.200Instance credentials
Oracle Cloud192.0.0.192Instance metadata
Internal Services127.0.0.1, 10.x.x.xInternal APIs, databases

Attack Scenario
  1. Attacker sets up DNS server with alternating responses
  2. Attacker sends mutation with url: "http://evil.attacker.com/latest/meta-data/"
  3. First DNS query returns safe IP (e.g., 1.2.3.4) → validation passes
  4. Second DNS query returns metadata IP (169.254.169.254) → request to metadata
  5. Attacker retrieves credentials from ANY cloud provider
  6. Attacker can now achieve code execution by creating new instances with their SSH key

Remediation

Fix: DNS Pinning with CURLOPT_RESOLVE

Pin the DNS resolution - use the same resolved IP for both validation and request:

private function validateHostname(string $url): bool
{
    $hostname = parse_url($url, PHP_URL_HOST);

    // Resolve once
    $ip = gethostbyname($hostname);

    // Validate the resolved IP
    if (in_array($ip, [
        '169.254.169.254', '169.254.170.2',
        '100.100.100.200', '192.0.0.192',
    ])) {
        return false;
    }

    // Store for later use
    $this->pinnedDNS[$hostname] = $ip;

    return true;
}

// When making the request - CRITICAL: Use pinned IP
protected function makeRequest(string $url): ResponseInterface
{
    $hostname = parse_url($url, PHP_URL_HOST);
    $ip = $this->pinnedDNS[$hostname] ?? null;

    $options = [];
    if ($ip) {
        // Force Guzzle/curl to use the SAME IP we validated
        $options['curl'] = [
            CURLOPT_RESOLVE => [
                "$hostname:80:$ip",
                "$hostname:443:$ip"
            ]
        ];
    }

    return $this->client->get($url, $options);
}
Alternative: Single Resolution with Immediate Use
// Resolve to IP and use IP directly in URL
$ip = gethostbyname($hostname);

if (in_array($ip, $blockedIPs)) {
    return false;
}

// Make request directly to IP with Host header
$client->get("http://$ip" . parse_url($url, PHP_URL_PATH), [
    'headers' => [
        'Host' => $hostname
    ]
]);
Additional Mitigations
MitigationDescription
DNS Pinning (CURLOPT_RESOLVE)Force same IP for validation and request
Single IP-based requestUse resolved IP directly in URL
Implement IMDSv2Requires token header (infrastructure-level)
Network egress filteringBlock metadata IPs at network level

Resources

NVD (es)

Craft es un sistema de gestión de contenido (CMS). En las versiones 4.5.0-RC1 hasta la 4.16.18 y 5.0.0-RC1 hasta la 5.8.22, la validación de SSRF en la mutación GraphQL Asset de Craft CMS realiza la resolución DNS separadamente de la solicitud HTTP. Esta vulnerabilidad de Tiempo de Verificación-Tiempo de Uso (TOCTOU) permite ataques de reencuadernación de DNS, donde el servidor DNS de un atacante devuelve diferentes direcciones IP para la validación en comparación con la solicitud real. Esto es un bypass de la corrección de seguridad para CVE-2025-68437 que permite el acceso a todas las IP bloqueadas, no solo a los puntos finales IPv6. La explotación requiere permisos de esquema GraphQL para editar activos en el volumen `` y crear activos en el volumen ``. Estos permisos pueden ser otorgados a usuarios autenticados con acceso apropiado al esquema GraphQL y/o Esquema Público (si está mal configurado con permisos de escritura). Las versiones 4.16.19 y 5.8.23 parchean el problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-27127 changed 2026-02-28CVE Terms of Use
GitHub Advisory DatabaseGHSA-gp2f-7wcm-5fhx changed 2026-02-28CC-BY-4.0
NVDCVE-2026-27127 changed 2026-06-17Public domain