79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

curl_cffi SSRF Filter Bypass, No Fix Yet (CVE-2026-144579)

curl_cffi's safe redirect mode misses 0.0.0.0 and IPv4-mapped IPv6 addresses, so a malicious server can redirect requests to loopback and cloud metadata.

TL;DR

  • A curl_cffi SSRF protection bypass lets a malicious server redirect a request to 0.0.0.0 or an IPv4-mapped IPv6 address. CVE-2026-144579 carries CVSS v4.0 9.2 Critical.
  • Every curl_cffi release from 0.15.0 through 0.17.0 is affected when an application uses allow_redirects="safe". The 0.17.1b1 pre-release carries the same check.
  • No fixed release exists as of 2026-12-04. No public proof of concept or in-the-wild exploitation is reported, and the CVE is not in CISA KEV as of 2026-12-04.
  • Do not rely on "safe" mode for SSRF protection. "How do I fix it?" gives the egress rules and the manual redirect validation that close the gap.

Am I affected?

You are affected if your application uses curl_cffi's "safe" redirect mode to fetch a URL that an attacker can influence. All of these must hold:

  • The installed curl_cffi version is 0.15.0 through 0.17.0, or the 0.17.1b1 pre-release.
  • The call passes allow_redirects="safe" or CurlFollow.SAFE.
  • The application fetches an attacker-influenced URL, or follows a redirect from a server the attacker controls.
  • The response body, an error message or a timing difference reaches the attacker.

An application that uses the default allow_redirects=True does not run the safe-mode check, so this specific bypass does not apply. That default still follows redirects without any SSRF filter, which is a separate exposure. An application that sets allow_redirects=False and validates every hop itself is outside the affected path.

Release line Affected versions Fixed version
curl_cffi stable 0.15.0 through 0.17.0 none as of 2026-12-04
curl_cffi pre-release 0.17.1b1 none as of 2026-12-04

Check the installed version:

python -m pip show curl_cffi
python -m pip list | grep -iE "curl[_-]cffi"

Check whether the code enables the safe mode:

grep -rn "allow_redirects" --include='*.py' .
grep -rn "CurlFollow.SAFE" --include='*.py' .

A match on "safe" or CurlFollow.SAFE marks a call that depends on the flawed check. A wrapper that sets the option for every request needs the same review.

How do I fix it?

No released version fixes this flaw as of 2026-12-04. Stop treating "safe" mode as a security boundary, and add the controls the library does not provide.

  1. Set allow_redirects=False on every request to an attacker-influenced URL.
  2. Read the Location header yourself and resolve the hostname of each hop.
  3. Reject the request when any resolved address is 0.0.0.0, in 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 or 100.64.0.0/10, or equals ::1, or is in fc00::/7 or fe80::/10.
  4. Reject every IPv4-mapped IPv6 address in ::ffff:0:0/96, which covers ::ffff:127.0.0.1 and ::ffff:169.254.169.254.
  5. Cap the redirect chain at three or five hops, and re-check the address after every redirect.
  6. Deny egress from the application host to loopback, link-local and the cloud metadata address at the network layer.

The network rule is the control that holds when application code misses a case. A host firewall or a security group that blocks the metadata address and loopback prevents the redirect from reaching a useful target, even when the Python check passes. For cloud instances, require Instance Metadata Service Version 2 with a response hop limit of 1, so a proxied request cannot read credentials.

The pre-release 0.17.1b1 is not a fix. It pins curl-impersonate 2.3.3, and that patch still contains the same is_internal_ip() function. Watch the project's releases and advisories for a version that adds the missing checks, then upgrade and keep the egress rules in place.

What is the root cause?

The safe-mode check compares the resolved address against a short list of private ranges and misses two address forms that still reach local services. curl_cffi bundles curl-impersonate, a patched libcurl that reproduces browser TLS and HTTP fingerprints. The check lives in the patched lib/cf-socket.c and runs after the connection address is resolved, only when the request is a redirect.

cf_socket_open() calls is_internal_ip() before it opens the socket:

  /* curl-impersonate: SSRF protection, reject internal IPs on redirect */
  if(data->set.http_follow_mode == CURLFOLLOW_SAFE &&
     data->state.this_is_a_follow &&
     is_internal_ip(ctx->ip.remote_ip, ctx->addr.family)) {
    failf(data, "Redirect to internal IP %s rejected (SSRF protection)",
          ctx->ip.remote_ip);
    result = CURLE_COULDNT_CONNECT;
    goto out;
  }

is_internal_ip() compares the resolved address against a short list of private ranges:

static bool is_internal_ip(const char *ip, int family)
{
  if(family == AF_INET) {
    unsigned int addr;
    if(1 != curlx_inet_pton(AF_INET, ip, &addr))
      return FALSE;
    addr = ntohl(addr);
    /* 127.0.0.0/8 */
    if((addr >> 24) == 127)
      return TRUE;
    /* 10.0.0.0/8 */
    if((addr >> 24) == 10)
      return TRUE;
    /* 172.16.0.0/12 */
    if((addr >> 20) == 0xac1) /* 172.16-31 */
      return TRUE;
    /* 192.168.0.0/16 */
    if((addr >> 16) == 0xc0a8)
      return TRUE;
    /* 169.254.0.0/16 */
    if((addr >> 16) == 0xa9fe)
      return TRUE;
  }
#ifdef USE_IPV6
  else if(family == AF_INET6) {
    unsigned char addr[16];
    if(1 != curlx_inet_pton(AF_INET6, ip, addr))
      return FALSE;
    /* ::1/128 */
    {
      static const unsigned char loopback[16] = {
        0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1
      };
      if(!memcmp(addr, loopback, 16))
        return TRUE;
    }
    /* fc00::/7 - unique local */
    if((addr[0] & 0xfe) == 0xfc)
      return TRUE;
    /* fe80::/10 - link-local */
    if(addr[0] == 0xfe && (addr[1] & 0xc0) == 0x80)
      return TRUE;
  }
#endif
  return FALSE;
}

The IPv4 branch does not treat 0.0.0.0 as internal. On Linux, a connect to 0.0.0.0 reaches the local host, so a redirect to http://0.0.0.0:PORT/ lands on a loopback service.

The IPv6 branch checks only the ::1 loopback and the fc00::/7 and fe80::/10 ranges. An IPv4-mapped address such as ::ffff:127.0.0.1 has the bytes 00...00 ff ff 7f 00 00 01. It matches neither ::1 nor the two prefixes, and the function returns false.

The function's name promises a check on internal addresses. Its comparisons cover only the ranges the author listed. The two omitted forms are enough to turn the redirect filter into a pass-through.

How is it exploited?

An attacker needs a server that returns a redirect and a curl_cffi client that follows it in safe mode. The advisory describes the redirect targets; it does not publish exploit code.

  1. The application fetches a URL on the attacker's server with allow_redirects="safe".
  2. The attacker's server answers with 302 Found and a Location header of http://0.0.0.0:PORT/, http://[::ffff:127.0.0.1]:PORT/ or http://[::ffff:169.254.169.254]/.
  3. curl_cffi resolves the new host and calls is_internal_ip() on the result.
  4. The function returns false for 0.0.0.0 and for the IPv4-mapped address, so the request proceeds.
  5. The connection reaches the loopback service or the cloud metadata endpoint.
  6. The response returns to the application, which may pass it to the attacker or expose it through an error or a delay.

The plain IPv4 metadata address 169.254.169.254 is blocked by the 169.254.0.0/16 comparison. The IPv4-mapped form ::ffff:169.254.169.254 is not, and the operating system routes it to the same endpoint. The same trick reaches loopback-only admin panels, Redis, Elasticsearch and other services that trust local connections.

How does the attack flow?

A redirect to an address the filter does not recognise moves the request from the attacker's server to a service that only the application host can reach.

flowchart LR A["Attacker-controlled URL"] --> B["curl_cffi with allow_redirects='safe'"] B --> C["302 to 0.0.0.0 or an IPv4-mapped address"] C --> D["is_internal_ip returns false"] D --> E["request reaches loopback or metadata"] E --> F["response returns through the application"]

What can an attacker do?

An attacker can read services that are reachable only from the application host. That includes loopback-only admin interfaces and cloud instance metadata. On a cloud instance, metadata can contain temporary role credentials, which the attacker can use against the cloud account.

The impact needs all of these conditions:

  • The application uses curl_cffi 0.15.0 through 0.17.0, or 0.17.1b1, with the safe redirect mode.
  • The attacker controls the first URL or a server in the redirect chain.
  • The application returns the response body, or leaks enough through errors or timing to read it.
  • The target service accepts requests from the application host and does not require a credential the attacker lacks.

The CVSS v4.0 vector is CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N. It records a confidentiality impact on the vulnerable system and on later systems, with no integrity or availability impact. The flaw does not by itself give code execution.

Why does the fix work?

No vendor fix exists as of 2026-12-04, so there is no patch to review. A correct fix has to make is_internal_ip() reject the two address forms the current code misses. The IPv4 branch needs a check for 0.0.0.0, and the IPv6 branch needs to unwrap an IPv4-mapped address and run the IPv4 checks on it.

A fix must add the equivalent of these comparisons:

    /* 0.0.0.0 and 0.0.0.0/8 */
    if((addr >> 24) == 0)
      return TRUE;
    /* ::ffff:0:0/96 - IPv4-mapped IPv6 */
    if(!memcmp(addr, mapped_prefix, 12)) {
      unsigned int v4;
      memcpy(&v4, addr + 12, 4);
      return is_internal_ip_v4(ntohl(v4));
    }

Those checks close the two redirect targets in the advisory. They do not make the filter a complete SSRF defence, because the list still omits ranges such as 100.64.0.0/10. A complete fix should compare against a maintained table of non-global addresses, or reject every address that is not globally routable. The patch is complete for this CVE only when both the 0.0.0.0 case and the mapped-address case are rejected.

How do I check if I was compromised?

No indicators of compromise are published for CVE-2026-144579, and curl_cffi does not log the resolved address by default. Start with the code and the network path.

Search the application for the affected mode:

grep -rn "allow_redirects" --include='*.py' .
grep -rn "CurlFollow.SAFE" --include='*.py' .

Then look for outbound requests to the address forms in proxy, firewall or eBPF logs:

grep -Ei "0\.0\.0\.0|::ffff:" /var/log/proxy/access.log

A hit is a lead, not proof, because applications and health checks may contact 0.0.0.0 for other reasons. Check the destination port and the response size against the services on the application host.

On a cloud instance, review the audit log for metadata credential use from an unexpected source. A stolen role credential often appears as a call from an address outside the instance's normal egress. An attempt that fails may leave no trace in the application log at all.

Timeline

  • 2026-04-03: curl_cffi 0.15.0 was released, the first version the advisory lists as affected.
  • 2026-10-26: curl_cffi 0.17.0 was released and remains the latest stable version.
  • 2026-11-29: curl_cffi 0.17.1b1 was published as a pre-release and still carries the flawed check.
  • 2026-12-04: VulnCheck published the advisory and the CVE record for CVE-2026-144579.

No curl_cffi release has fixed CVE-2026-144579
Figure 1: The affected releases from 0.15.0 to the 0.17.1b1 pre-release, and the advisory date, with no fixed release. Source: curl_cffi releases and the VulnCheck advisory, checked December 4, 2026

FAQ

Is there a fixed curl_cffi version?

No. The advisory lists 0.15.0 through 0.17.0 as affected, and 0.17.0 is the latest stable release on PyPI. The 0.17.1b1 pre-release pins the same curl-impersonate 2.3.3 patch and keeps the same function.

Does this affect the default redirect setting?

No. The check runs only when http_follow_mode is CURLFOLLOW_SAFE, which the Python API sets with allow_redirects="safe" or CurlFollow.SAFE. The default True follows redirects without this check, so it has no SSRF protection at all.

Can the bypass reach cloud metadata?

Yes, through the IPv4-mapped IPv6 form ::ffff:169.254.169.254. The plain IPv4 address 169.254.169.254 is rejected by the 169.254.0.0/16 comparison. Whether the metadata response is readable depends on the cloud provider's configuration and on whether the application returns the body.

Is there a public proof of concept?

No exploit code is published. The advisory names the redirect targets and the missing checks, which is enough to reproduce the bypass in a lab. Treat any working redirect to 0.0.0.0 or an IPv4-mapped address as the same flaw.

Is CVE-2026-144579 in CISA KEV?

No. The CISA KEV catalog was at version 2026.11.30 with 1,810 records on 2026-12-04, and this CVE is not in it. No in-the-wild exploitation is reported.

What if I cannot change the redirect handling?

Block egress to loopback, link-local and the metadata address at the network layer, and require Instance Metadata Service Version 2 with a hop limit of 1. That control limits the impact even while the application still uses safe mode.

References

  • VulnCheck, "curl_cffi 0.15.0 through 0.17.0 SSRF Protection Bypass via Redirect Targets", advisory published 2026-12-04 (checked December 4, 2026): https://www.vulncheck.com/advisories/curl-cffi-0.15.0-through-0.17.0-ssrf-protection-bypass-via-redirect-targets
  • CVE Program, "CVE-2026-144579" record, published 2026-12-04 (checked December 4, 2026): https://www.cve.org/CVERecord?id=CVE-2026-144579
  • curl_cffi source at 0.17.0, curl_cffi/requests/utils.py, redirect option handling (checked December 4, 2026): https://github.com/lexiforest/curl_cffi/blob/v0.17.0/curl_cffi/requests/utils.py
  • curl_cffi source at 0.17.0, curl_cffi/requests/session.py, allow_redirects documentation (checked December 4, 2026): https://github.com/lexiforest/curl_cffi/blob/v0.17.0/curl_cffi/requests/session.py
  • curl-impersonate patch at v2.3.3, lib/cf-socket.c, is_internal_ip() and the redirect check (checked December 4, 2026): https://github.com/lexiforest/curl-impersonate/blob/v2.3.3/patches/curl.patch
  • curl_cffi 0.17.1b1, Makefile, VERSION := 2.3.3 (checked December 4, 2026): https://github.com/lexiforest/curl_cffi/blob/v0.17.1b1/Makefile
  • PyPI, curl_cffi project page with release history, 0.17.0 published 2026-10-26 (checked December 4, 2026): https://pypi.org/project/curl_cffi/
  • pypistats, curl-cffi recent download counts, 8,136,805 in the last week (checked December 4, 2026): https://pypistats.org/packages/curl-cffi
  • GitHub, lexiforest/curl_cffi repository, 6,955 stars and 581 forks (checked December 4, 2026): https://github.com/lexiforest/curl_cffi
  • CISA, Known Exploited Vulnerabilities catalog, version 2026.11.30, 1,810 records (checked December 4, 2026): https://www.cisa.gov/known-exploited-vulnerabilities-catalog

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog