{"id":"GHSA-365w-hqf6-vxfg","summary":"Crawl4AI: Multiple Docker API Vulnerabilities - File Write, SSRF, Auth Bypass, XSS, JS Execution","details":"### Summary\n\nMultiple security vulnerabilities in the Crawl4AI Docker API server affecting endpoints for crawling, markdown/LLM extraction, screenshots, PDFs, webhooks, monitoring, JavaScript execution, and configuration.\n\n### Vulnerabilities\n\n#### 1. Arbitrary File Write via /screenshot and /pdf (CWE-22, CVSS 9.1)\n\nThe `output_path` parameter accepts arbitrary filesystem paths with no validation. An attacker can overwrite server files (DoS) or write to any appuser-writable location.\n\n**Fix:** Added `validate_output_path()` restricting writes to `CRAWL4AI_OUTPUT_DIR` (/tmp/crawl4ai-outputs by default). Added Pydantic `field_validator` rejecting `..` traversal sequences.\n\n#### 2. SSRF via Webhook URL (CWE-918, CVSS 8.6)\n\nWebhook URLs in `/crawl/job` and `/llm/job` accept internal/private IPs with no validation, enabling Server-Side Request Forgery against cloud metadata endpoints (169.254.169.254), internal services, and Docker networks.\n\n**Fix:** Added `validate_webhook_url()` with blocklist for RFC 1918, loopback, link-local, cloud metadata IPs and hostnames. Validation at both job submission and send time. Explicit `follow_redirects=False`.\n\n#### 3. Authentication Bypass on Monitor Endpoints (CWE-306, CVSS 6.5)\n\nThe monitor router was mounted without `token_dep` dependency, making all monitoring endpoints (including destructive ones like `/monitor/actions/cleanup`) accessible without authentication.\n\n**Fix:** Added `dependencies=[Depends(token_dep)]` to monitor router. Added explicit token check on WebSocket `/monitor/ws` endpoint.\n\n#### 4. Stored XSS in Monitor Dashboard (CWE-79, CVSS 6.1)\n\nURLs and error messages rendered in the monitor dashboard via `innerHTML` without escaping, enabling stored XSS via crafted crawl URLs.\n\n**Fix:** Server-side `html.escape()` on URL and error storage. Client-side `escapeHtml()` wrapper on all `innerHTML` template injections.\n\n#### 5. Arbitrary JavaScript Execution via /execute_js (CWE-94, CVSS 8.1)\n\nThe `/execute_js` endpoint accepts and executes arbitrary JavaScript in the server's browser with `--disable-web-security` enabled, combining arbitrary JS execution with SSRF capability.\n\n**Fix:** Disabled by default via `CRAWL4AI_EXECUTE_JS_ENABLED` env var. Added SSRF blocklist on destination URL. Removed `--disable-web-security` from default browser args.\n\n#### 6. Hardcoded JWT Secret Key (CWE-798, CVSS 9.8)\n\nThe JWT signing key defaults to `\"mysecret\"` in the public source code, allowing anyone to forge valid authentication tokens.\n\n**Fix:** Removed default value. Added startup validation rejecting weak/short secrets. Auto-generates ephemeral key when JWT enabled but no key set.\n\n#### 7. SSRF via Direct Crawl Endpoints /crawl, /md, /llm (CWE-918, CVSS 8.6)\n\nThe primary crawl entry points (`/crawl`, `/crawl/stream`, `/md`, `/llm`) fetch arbitrary user-supplied URLs with no destination validation, enabling Server-Side Request Forgery against internal services, Docker networks, and cloud metadata endpoints (169.254.169.254). A blocklist that only inspects the literal hostname is additionally bypassable via IPv6-mapped IPv4 addresses (e.g. `[::ffff:169.254.169.254]`, `[::ffff:10.0.0.1]`), which resolve to the blocked private/metadata ranges but evade a naive string check.\n\n**Fix:** Added URL destination validation on all crawl/md/llm entry points, reusing the SSRF blocklist (RFC 1918, loopback, link-local, cloud-metadata IPs and hostnames). IPv6-mapped IPv4 addresses are normalized to their IPv4 form before the blocklist check, closing the mapping bypass. `raw://` URLs are skipped. Validation applies at request entry, not only at fetch time.\n\n### Workarounds\n\n1. Upgrade to the patched version (recommended)\n2. Set `CRAWL4AI_API_TOKEN` to enable authentication\n3. Set a strong `SECRET_KEY` (min 32 chars) if using JWT\n4. Restrict network access to the Docker API\n\n### Credits\n\n- Jeongbean Jeon - file write, SSRF, monitor auth bypass, stored XSS\n- wulonchia - file write via output_path (independent report)\n- by111 ([August829](https://github.com/August829)) - hardcoded JWT, eval in /config/dump, /execute_js, hook sandbox escape\n- secsys_codex - SSRF via /md, /crawl, /llm endpoints + IPv6-mapped IPv4 bypass (URL destination validation)\n- Velayutham Selvaraj ([LinkedIn](https://www.linkedin.com/in/velayuthamselvaraj)) - SSRF via missing host validation in validate_url_scheme (independent report)\n- IcySun & Yashon - SSRF, arbitrary file write, missing-auth-by-default, hook sandbox bypass via asyncio (independent report)","aliases":["CVE-2026-56260","CVE-2026-56261","CVE-2026-56262","CVE-2026-56263","CVE-2026-56264","CVE-2026-56265","CVE-2026-56266","GHSA-53rg-46cm-4g2v","GHSA-8qrg-7j2f-rf2h","GHSA-f23g-2f38-gg94","GHSA-g2pv-76hm-j4x9","GHSA-r9hw-78q5-478g","GHSA-xrfj-6m49-wfmm","PYSEC-2026-229","PYSEC-2026-230","PYSEC-2026-239","PYSEC-2026-3443","PYSEC-2026-3449","PYSEC-2026-596","PYSEC-2026-798"],"modified":"2026-09-23T21:15:03.978902533Z","published":"2026-06-16T20:13:30Z","database_specific":{"severity":"CRITICAL","github_reviewed":true,"github_reviewed_at":"2026-06-16T20:13:30Z","nvd_published_at":"2026-06-22T22:16:50Z","cwe_ids":["CWE-22","CWE-306","CWE-79","CWE-798","CWE-918","CWE-94"]},"references":[{"type":"WEB","url":"https://github.com/unclecode/crawl4ai/security/advisories/GHSA-365w-hqf6-vxfg"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-56266"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-unauthenticated-access-to-monitor-endpoints-via-docker-api-server"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-stored-cross-site-scripting-in-monitor-dashboard"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-server-side-request-forgery-via-webhook-urls"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-server-side-request-forgery-via-direct-crawl-endpoints"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-authentication-bypass-via-hardcoded-jwt-signing-key"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-arbitrary-javascript-execution-via-execute-js-endpoint"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-arbitrary-file-write-via-output-path-parameter"},{"type":"PACKAGE","url":"https://github.com/unclecode/crawl4ai"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-798.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-596.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-3449.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-3443.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-239.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-230.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-229.yaml"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-xrfj-6m49-wfmm"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-r9hw-78q5-478g"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-g2pv-76hm-j4x9"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-f23g-2f38-gg94"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-8qrg-7j2f-rf2h"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-53rg-46cm-4g2v"}],"affected":[{"package":{"name":"crawl4ai","ecosystem":"PyPI","purl":"pkg:pypi/crawl4ai"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.8.7"}]}],"versions":["0.3.0","0.3.1","0.3.2","0.3.3","0.3.4","0.3.5","0.3.6","0.3.7","0.3.71","0.3.72","0.3.73","0.3.731","0.3.74","0.3.741","0.3.742","0.3.743","0.3.744","0.3.745","0.3.746","0.3.8","0.4.0","0.4.1","0.4.21","0.4.22","0.4.23","0.4.24","0.4.241","0.4.242","0.4.243","0.4.244","0.4.245","0.4.246","0.4.247","0.4.248","0.4.248b3","0.4.3b1","0.4.3b2","0.4.3b3","0.5.0","0.5.0.post1","0.5.0.post2","0.5.0.post3","0.5.0.post4","0.5.0.post5","0.5.0.post6","0.5.0.post7","0.5.0.post8","0.6.0","0.6.0rc1","0.6.1","0.6.2","0.6.3","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.7.8","0.8.0","0.8.5","0.8.6"],"database_specific":{"last_known_affected_version_range":"\u003c= 0.8.6","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-365w-hqf6-vxfg/GHSA-365w-hqf6-vxfg.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"},{"type":"CVSS_V4","score":"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/"}]}