Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

security: patch proxy SSRF in Docker server (0.8.9)

unclecodecdf2ead7ed4b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8261bb79..883bb7b7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,18 @@ All notable changes to Crawl4AI will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.8.9] - 2026-06-04
+
+0.8.9 is a follow-up, backward-compatible security patch for the self-hosted Docker API server, closing an SSRF path that 0.8.8 did not cover. Upgrade in place; no configuration changes required.
+
+### Security
+
+A security advisory accompanies this release.
+
+- **SSRF via proxy settings (CWE-918)**: the SSRF destination check was applied only to the crawl target URL, not to the proxy address. An unauthenticated `/crawl`, `/crawl/stream`, or `/crawl/job` request could set `browser_config.proxy_config.server` (or the deprecated `browser_config.proxy`, or `crawler_config.proxy_config`, or a `--proxy-server` / `--host-resolver-rules` flag in `extra_args`) to an internal address and route the browser through it, reaching internal services and cloud-metadata endpoints. All proxy destinations are now validated with the same global-routability check before the browser is built, and proxy/DNS-redirecting flags are stripped from `extra_args`. A legitimate public proxy still works. Credit: Geo ([geo-chen](https://github.com/geo-chen)).
+
+Backward compatible. Note: raw `--proxy-server` / `--host-resolver-rules` / `--proxy-bypass-list` / `--proxy-pac-url` flags passed via `extra_args` are now ignored; configure proxies through `proxy_config` (which is validated).
+
## [0.8.8] - 2026-06-04
0.8.8 is a focused, backward-compatible security patch for the self-hosted Docker API server. Upgrade in place; no configuration changes are required. If you run the Docker server, upgrade. If it is exposed to a network, also set `CRAWL4AI_API_TOKEN`.
diff --git a/Dockerfile b/Dockerfile
index 0c0830a0..8d7e06f7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
FROM python:3.12-slim-bookworm AS build
# C4ai version
-ARG C4AI_VER=0.8.8
+ARG C4AI_VER=0.8.9
ENV C4AI_VERSION=$C4AI_VER
LABEL c4ai.version=$C4AI_VER
diff --git a/README.md b/README.md
index e833d44f..1ab6fd26 100644
--- a/README.md
+++ b/README.md
@@ -37,9 +37,9 @@ Limited slots._
Crawl4AI turns the web into clean, LLM ready Markdown for RAG, agents, and data pipelines. Fast, controllable, battle tested by a 50k+ star community.
-[✨ Check out latest update v0.8.8](#-recent-updates)
+[✨ Check out latest update v0.8.9](#-recent-updates)
-✨ **New in v0.8.8**: Backward-compatible security patch for the self-hosted Docker API server (SSRF filter gaps, output_path file write, LLM credential exfiltration, log and webhook header injection). If you run the Docker server, upgrade. A larger secure-by-default release with breaking changes is coming in ~1-2 weeks. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.8.md)
+✨ **New in v0.8.9**: Follow-up security patch for the self-hosted Docker API server, closing an SSRF via proxy settings that 0.8.8 did not cover. Backward compatible. If you run the Docker server, upgrade. A larger secure-by-default release with breaking changes is coming in ~1-2 weeks. [Release notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.9.md)
✨ Recent v0.8.6: Security hotfix that replaced `litellm` with `unclecode-litellm` due to a PyPI supply chain compromise.
@@ -565,9 +565,22 @@ async def test_news_crawl():
## ✨ Recent Updates
<details open>
+<summary><strong>Version 0.8.9 Release Highlights - Proxy SSRF Patch</strong></summary>
+
+A follow-up, backward-compatible security patch for the self-hosted Docker API server: closes an SSRF via proxy settings (`proxy_config.server`, the deprecated `proxy`, `crawler_config.proxy_config`, and proxy/DNS flags in `extra_args`) that 0.8.8 did not cover. Proxy destinations are now validated like crawl URLs. Upgrade in place, no config changes. A larger secure-by-default release with breaking changes is coming in ~1-2 weeks; a migration guide will accompany the pre-announcement.
+
+```bash
+pip install -U crawl4ai
+```
+
+[Full v0.8.9 Release Notes →](https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.9.md)
+
+</details>
+
+<details>
<summary><strong>Version 0.8.8 Release Highlights - Docker Server Security Patch</strong></summary>
-A focused, backward-compatible security patch for the self-hosted Docker API server: closes SSRF filter gaps (IPv6 transition forms), hardens screenshot/PDF `output_path` against a symlink write, stops LLM credential exfiltration via a request `base_url`, and adds CRLF-safe logging and webhook header validation. Upgrade in place, no config changes. A larger secure-by-default release with breaking changes is coming in ~1-2 weeks; a migration guide will accompany the pre-announcement.
+A focused, backward-compatible security patch for the self-hosted Docker API server: closes SSRF filter gaps (IPv6 transition forms), hardens screenshot/PDF `output_path` against a symlink write, stops LLM credential exfiltration via a request `base_url`, and adds CRLF-safe logging and webhook header validation. Upgrade in place, no config changes.
```bash
pip install -U crawl4ai
diff --git a/SECURITY-CREDITS.md b/SECURITY-CREDITS.md
index 84225200..37ed89e8 100644
--- a/SECURITY-CREDITS.md
+++ b/SECURITY-CREDITS.md
@@ -12,3 +12,4 @@ We thank the following security researchers for their responsible disclosure:
| Velayutham Selvaraj | [LinkedIn](https://www.linkedin.com/in/velayuthamselvaraj) | SSRF via missing host validation in validate_url_scheme (independent report) | 2026-05-06 |
| IcySun & Yashon | [email protected], [email protected] | SSRF, file write via output_path, missing auth by default, hook sandbox bypass via asyncio (independent report) | 2026-05-15 |
| Geo ([geo-chen](https://github.com/geo-chen)) | [email protected] | LLM API key exfiltration via unvalidated base_url (0.8.8) | 2026-06-02 |
+| Geo ([geo-chen](https://github.com/geo-chen)) | [email protected] | SSRF via proxy_config.server bypassing the SSRF check (0.8.9) | 2026-06-04 |
diff --git a/crawl4ai/__version__.py b/crawl4ai/__version__.py
index 6784bb98..f575cbdf 100644
--- a/crawl4ai/__version__.py
+++ b/crawl4ai/__version__.py
@@ -1,7 +1,7 @@
# crawl4ai/__version__.py
# This is the version that will be used for stable releases
-__version__ = "0.8.8"
+__version__ = "0.8.9"
# For nightly builds, this gets set during build process
__nightly_version__ = None
diff --git a/deploy/docker/api.py b/deploy/docker/api.py
index 42fcc11b..758b90fb 100644
--- a/deploy/docker/api.py
+++ b/deploy/docker/api.py
@@ -47,6 +47,8 @@ from utils import (
get_llm_base_url,
get_redis_task_ttl,
validate_url_destination,
+ validate_proxy_destination,
+ scrub_browser_extra_args,
)
from webhook import WebhookDeliveryService
@@ -54,6 +56,32 @@ import psutil, time
logger = logging.getLogger(__name__)
+
+def _enforce_proxy_safety(browser_config, crawler_config=None):
+ """Block SSRF via a caller-supplied proxy / proxy-redirecting browser flags.
+
+ The crawl-target URL is validated elsewhere; this covers the other paths
+ that reach Chromium's egress: BrowserConfig.proxy, BrowserConfig.proxy_config
+ .server, CrawlerRunConfig.proxy_config.server, and proxy/DNS flags smuggled
+ via extra_args. Raises HTTPException(400) on a non-global proxy host."""
+ from fastapi import HTTPException
+ try:
+ if browser_config is not None:
+ if getattr(browser_config, "proxy", None):
+ validate_proxy_destination(browser_config.proxy)
+ pc = getattr(browser_config, "proxy_config", None)
+ if pc is not None and getattr(pc, "server", None):
+ validate_proxy_destination(pc.server)
+ if getattr(browser_config, "extra_args", None):
+ browser_config.extra_args = scrub_browser_extra_args(browser_config.extra_args)
+ if crawler_config is not None:
+ cpc = getattr(crawler_config, "proxy_config", None)
+ if cpc is not None and getattr(cpc, "server", None):
+ validate_proxy_destination(cpc.server)
+ except ValueError:
+ # opaque: do not echo the resolved internal address
+ raise HTTPException(status_code=400, detail="Proxy destination blocked (SSRF protection)")
+
# --- Helper to get memory ---
def _get_memory_mb():
try:
@@ -573,6 +601,7 @@ async def handle_crawl_request(
validate_url_destination(url)
browser_config = BrowserConfig.load(browser_config)
crawler_config = CrawlerRunConfig.load(crawler_config)
+ _enforce_proxy_safety(browser_config, crawler_config)
dispatcher = MemoryAdaptiveDispatcher(
memory_threshold_percent=config["crawler"]["memory_threshold_percent"],
@@ -717,6 +746,9 @@ async def handle_crawl_request(
return response
+ except HTTPException:
+ raise # client errors (e.g. blocked proxy 400) must not become 500
+
except Exception as e:
logger.error(f"Crawl error: {str(e)}", exc_info=True)
@@ -761,6 +793,7 @@ async def handle_stream_crawl_request(
# browser_config.verbose = True # Set to False or remove for production stress testing
browser_config.verbose = False
crawler_config = CrawlerRunConfig.load(crawler_config)
+ _enforce_proxy_safety(browser_config, crawler_config)
crawler_config.scraping_strategy = LXMLWebScrapingStrategy()
crawler_config.stream = True
@@ -814,6 +847,11 @@ async def handle_stream_crawl_request(
return crawler, results_gen, hooks_info
+ except HTTPException:
+ if crawler:
+ await release_crawler(crawler)
+ raise # client errors (e.g. blocked proxy 400) must not become 500
+
except Exception as e:
# Release crawler on setup error (for successful streams,
# release happens in stream_results finally block)
diff --git a/deploy/docker/tests/test_security_0_8_9.py b/deploy/docker/tests/test_security_0_8_9.py
new file mode 100644
index 00000000..2535b505
--- /dev/null
+++ b/deploy/docker/tests/test_security_0_8_9.py
@@ -0,0 +1,119 @@
+"""
+Behavioral tests for the 0.8.9 non-breaking security patch.
+
+Closes the proxy-injection SSRF class in the Docker server: an unauthenticated
+/crawl could set a proxy (or proxy-redirecting Chromium flag) pointing at an
+internal IP and route the browser through it, reaching internal services and
+cloud metadata. The crawl-target URL was validated; the proxy address was not.
+
+All fixes are backward compatible: a legitimate public proxy still works; only
+non-global proxy hosts are rejected and dangerous --proxy/--host-resolver flags
+are stripped from extra_args.
+"""
+
+import os
+import sys
+
+import pytest
+
+DOCKER_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+if DOCKER_DIR not in sys.path:
+ sys.path.insert(0, DOCKER_DIR)
+
+
+class TestValidateProxyDestination:
+ # IP literals so getaddrinfo is numeric (no network needed).
+ @pytest.mark.parametrize("server", [
+ "http://169.254.169.254:8080", # cloud metadata
+ "http://127.0.0.1:8888",
+ "http://10.0.0.5:3128",
+ "http://192.168.1.10:3128",
+ "169.254.169.254:8080", # bare host:port (no scheme)
+ "socks5://10.1.2.3:1080",
+ "http://[::1]:8080", # ipv6 loopback
+ "http://[::ffff:169.254.169.254]:80", # v4-mapped metadata
+ ])
+ def test_internal_proxy_rejected(self, server):
+ import utils
+ with pytest.raises(ValueError):
+ utils.validate_proxy_destination(server)
+
+ @pytest.mark.parametrize("server", [
+ "http://8.8.8.8:3128",
+ "https://1.1.1.1:443",
+ "8.8.8.8:3128",
+ ])
+ def test_public_proxy_allowed(self, server):
+ import utils
+ utils.validate_proxy_destination(server) # no raise
+
+ def test_empty_is_noop(self):
+ import utils
+ utils.validate_proxy_destination("") # no raise
+ utils.validate_proxy_destination(None) # no raise
+
+
+class TestScrubExtraArgs:
+ def test_strips_dangerous_flags(self):
+ import utils
+ args = [
+ "--headless",
+ "--proxy-server=http://10.0.0.1:3128",
+ "--host-resolver-rules=MAP * 169.254.169.254",
+ "--proxy-bypass-list=*",
+ "--proxy-pac-url=http://evil/p.pac",
+ "--disable-gpu",
+ ]
+ out = utils.scrub_browser_extra_args(args)
+ assert out == ["--headless", "--disable-gpu"]
+
+ def test_keeps_benign(self):
+ import utils
+ args = ["--headless", "--no-sandbox", "--disable-dev-shm-usage"]
+ assert utils.scrub_browser_extra_args(args) == args
+
+ def test_empty(self):
+ import utils
+ assert utils.scrub_browser_extra_args([]) == []
+ assert utils.scrub_browser_extra_args(None) is None
+
+
+class TestEnforceProxySafety:
+ def test_browser_proxy_config_internal_400(self):
+ import api
+ from fastapi import HTTPException
+ from crawl4ai import BrowserConfig, ProxyConfig
+ b = BrowserConfig(proxy_config=ProxyConfig(server="http://169.254.169.254:8080"))
+ with pytest.raises(HTTPException) as e:
+ api._enforce_proxy_safety(b, None)
+ assert e.value.status_code == 400
+ assert "169.254" not in str(e.value.detail) # opaque
+
+ def test_deprecated_proxy_field_internal_400(self):
+ import api
+ from fastapi import HTTPException
+ from crawl4ai import BrowserConfig
+ b = BrowserConfig(proxy="http://10.0.0.9:3128")
+ with pytest.raises(HTTPException):
+ api._enforce_proxy_safety(b, None)
+
+ def test_crawler_proxy_config_internal_400(self):
+ import api
+ from fastapi import HTTPException
+ from crawl4ai import BrowserConfig, CrawlerRunConfig, ProxyConfig
+ c = CrawlerRunConfig(proxy_config=ProxyConfig(server="http://192.168.0.2:3128"))
+ with pytest.raises(HTTPException):
+ api._enforce_proxy_safety(BrowserConfig(), c)
+
+ def test_extra_args_proxy_scrubbed(self):
+ import api
+ from crawl4ai import BrowserConfig
+ b = BrowserConfig(extra_args=["--proxy-server=http://10.0.0.1", "--headless"])
+ api._enforce_proxy_safety(b, None) # no raise (scrub, not block)
+ assert b.extra_args == ["--headless"]
+
+ def test_public_proxy_passes(self):
+ import api
+ from crawl4ai import BrowserConfig, ProxyConfig
+ b = BrowserConfig(proxy_config=ProxyConfig(server="http://8.8.8.8:3128"))
+ api._enforce_proxy_safety(b, None) # no raise
diff --git a/deploy/docker/utils.py b/deploy/docker/utils.py
index 4e65af33..7292118b 100644
--- a/deploy/docker/utils.py
+++ b/deploy/docker/utils.py
@@ -450,6 +450,47 @@ def validate_webhook_url(url: str) -> None:
raise ValueError("URL resolves to a blocked address")
+# Chromium launch flags that can redirect/route egress or remap DNS, enabling
+# the same SSRF as a proxy field. Stripped from caller-supplied extra_args.
+_DANGEROUS_BROWSER_ARGS = (
+ "--proxy-server", "--proxy-pac-url", "--proxy-bypass-list",
+ "--host-resolver-rules",
+)
+
+
+def validate_proxy_destination(server: str) -> None:
+ """Reject a proxy server whose host is non-global (SSRF via proxy_config).
+
+ The crawl-target SSRF check is applied to the URL being fetched, but a proxy
+ address is also attacker-controllable and is handed to Chromium's
+ --proxy-server. Validate it with the same not-is_global rule. Honors
+ CRAWL4AI_ALLOW_INTERNAL_URLS. Raises ValueError (opaque) on a blocked host."""
+ if ALLOW_INTERNAL_URLS or not server:
+ return
+ s = str(server)
+ # proxy strings may be "scheme://host:port" or bare "host:port"
+ parsed = urlparse(s if "://" in s else "//" + s)
+ host = parsed.hostname
+ if not host:
+ raise ValueError("Invalid proxy server")
+ # Reuse the destination check (resolve + not-is_global on transition forms).
+ validate_webhook_url(f"http://{host}")
+
+
+def scrub_browser_extra_args(extra_args):
+ """Drop egress/DNS-redirecting Chromium flags from caller-supplied args.
+
+ The supported way to set a proxy is proxy_config (validated). Raw
+ --proxy-*/--host-resolver-rules flags bypass that validation and re-enable
+ the SSRF, so they are removed. Returns the filtered list."""
+ if not extra_args:
+ return extra_args
+ return [
+ a for a in extra_args
+ if not any(str(a).startswith(bad) for bad in _DANGEROUS_BROWSER_ARGS)
+ ]
+
+
def verify_email_domain(email: str) -> bool:
try:
domain = email.split('@')[1]
diff --git a/docs/blog/release-v0.8.9.md b/docs/blog/release-v0.8.9.md
new file mode 100644
index 00000000..aee54193
--- /dev/null
+++ b/docs/blog/release-v0.8.9.md
@@ -0,0 +1,37 @@
+# Crawl4AI v0.8.9: Proxy SSRF Patch
+
+*June 2026 - 2 min read*
+
+---
+
+I'm releasing Crawl4AI v0.8.9, a follow-up security patch for the self-hosted Docker API server. It closes a server-side request forgery path that v0.8.8 did not cover. It is backward compatible: upgrade in place, no configuration changes required.
+
+If you run the Docker server, please upgrade. If it is exposed to a network, also set `CRAWL4AI_API_TOKEN`. A security advisory accompanies this release.
+
+## What it fixes
+
+The SSRF destination check validated the crawl target URL, but not the proxy address. An unauthenticated `/crawl`, `/crawl/stream`, or `/crawl/job` request could point a proxy at an internal IP and route the browser through it, reaching internal services and cloud-metadata endpoints, even with a perfectly valid crawl URL.
+
+v0.8.9 validates every proxy destination with the same global-routability check before the browser is built:
+
+- `browser_config.proxy_config.server`
+- `browser_config.proxy` (deprecated field)
+- `crawler_config.proxy_config.server`
+- proxy / DNS-redirecting flags in `extra_args` (`--proxy-server`, `--host-resolver-rules`, `--proxy-bypass-list`, `--proxy-pac-url`) are stripped
+
+A legitimate public proxy still works. The only behavior change: set proxies through `proxy_config` (which is validated) rather than raw `extra_args` flags.
+
+## Upgrade
+
+```bash
+pip install -U crawl4ai
+docker pull unclecode/crawl4ai:0.8.9
+```
+
+## Still coming: a secure-by-default Docker server (~1-2 weeks)
+
+The next release remains a larger, secure-by-default update for the Docker API server, with intentional breaking changes (authentication on by default, stricter request validation, safer deployment defaults). A full migration guide will accompany the pre-announcement on Discord and X. This proxy fix is already part of that release; 0.8.9 simply brings it forward because it is an unauthenticated SSRF.
+
+Thanks to Geo for the responsible disclosure.
+
+Live long and import crawl4ai