{"id":"GHSA-7cx2-g3h9-382p","summary":"Crawl4AI: Arbitrary file write (symlink/TOCTOU) plus log and webhook-header injection in Docker server","details":"### Summary\n\nThree backward-compatible hardening fixes in the Docker API server. The headline issue is an arbitrary file write via the screenshot/PDF `output_path`.\n\n### 1. Arbitrary file write via output_path symlink / TOCTOU (primary)\n\n`POST /screenshot` and `POST /pdf` accept an `output_path` constrained to `ALLOWED_OUTPUT_DIR` by `validate_output_path`. The 0.8.7 check was string-only: it did not resolve symlinks, so a symlinked path component inside the output directory could redirect the write outside the directory, and the final `open()` followed symlinks. On a deployment where the runtime user can write executable/cron locations this is an arbitrary-write to code-execution primitive. The API is unauthenticated by default.\n\nFix: `validate_output_path` now resolves the real path (symlinks) of the parent and re-checks containment, and the write uses `O_NOFOLLOW` (`write_output_file`). `output_path` remains supported.\n\n### 2. CRLF log injection (CWE-117)\n\nUser-controlled URLs/errors reflected into log lines could embed CR/LF and forge additional log entries. Fix: a logging filter strips CR/LF/control characters from all records.\n\n### 3. Webhook request-header injection (CWE-93/CWE-113)\n\nUser-supplied webhook headers were sent verbatim, allowing CRLF and hop-by-hop / sensitive header injection on the outbound webhook request. Fix: webhook headers are validated (name pattern, no control characters, deny `Host`/`Content-Length`/`Transfer-Encoding`/`Authorization`/`Cookie`/...), with early request-time rejection.\n\n### Impact\n\nArbitrary file write (potential code execution) for #1; log forging for #2; request smuggling / header injection on outbound webhooks for #3.\n\n### Workarounds\n\n- Upgrade to the patched version.\n- Enable authentication (`CRAWL4AI_API_TOKEN`).\n- Run the container with a read-only root filesystem.\n\n### Credits\n\nInternal security audit (Crawl4AI maintainers).","aliases":["CVE-2026-56258","PYSEC-2026-228"],"modified":"2026-07-21T15:15:49.444148882Z","published":"2026-06-16T21:02:19Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-06-16T21:02:19Z","nvd_published_at":null,"cwe_ids":["CWE-117","CWE-22","CWE-59","CWE-93"],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/unclecode/crawl4ai/security/advisories/GHSA-7cx2-g3h9-382p"},{"type":"WEB","url":"https://github.com/unclecode/crawl4ai/issues/1"},{"type":"WEB","url":"https://github.com/unclecode/crawl4ai/issues/2"},{"type":"WEB","url":"https://github.com/unclecode/crawl4ai/pull/3"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-228.yaml"},{"type":"PACKAGE","url":"https://github.com/unclecode/crawl4ai"},{"type":"WEB","url":"https://www.vulncheck.com/advisories/crawl4ai-arbitrary-file-write-via-output-path-symlink-and-toctou"}],"affected":[{"package":{"name":"crawl4ai","ecosystem":"PyPI","purl":"pkg:pypi/crawl4ai"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.8.8"}]}],"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","0.8.7"],"database_specific":{"last_known_affected_version_range":"\u003c= 0.8.7","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-7cx2-g3h9-382p/GHSA-7cx2-g3h9-382p.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}