GHSA-7cx2-g3h9-382p: Crawl4AI Arbitrary File Write (symlink/TOCTOU) Plus Vulnerability

HIGH
CVSS 8.1
CWE-59 CWE-117 CWE-93 CWE-22
Published
Advisory Summary

GHSA-7cx2-g3h9-382p is a HIGH (CVSS 8.1) arbitrary file write (symlink/toctou) plus vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting Crawl4AI libraries in the PyPI ecosystem. The issue involves arbitrary file write (symlink/toctou) plus log and webhook-header injection in docker server. Remediation is available by upgrading affected packages to version 0.8.8.

GHSA-7cx2-g3h9-382p at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-7cx2-g3h9-382p
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-59: Improper Link Resolution Before File Access ('Link Following')
Affected Product Crawl4AI
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix GHSA-7cx2-g3h9-382p

To remediate this vulnerability, upgrade all affected Crawl4AI dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

crawl4ai fixed: 0.8.8
pip install crawl4ai>=0.8.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show crawl4ai

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-7cx2-g3h9-382p, inspect your installed packages using pip:

pip show crawl4ai

Analyze the terminal output to locate any version of Crawl4AI in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.8), your application is affected.

Note: The pip show crawl4ai command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. In Crawl4AI, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Three backward-compatible hardening fixes in the Docker API server. The headline issue is an arbitrary file write via the screenshot/PDF `output_path`. ### 1. Arbitrary file write via output_path symlink / TOCTOU (primary) `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. Fix: `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. ### 2. CRLF log injection (CWE-117) User-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. ### 3. Webhook request-header injection (CWE-93/CWE-113) User-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. ### Impact Arbitrary file write (potential code execution) for #1; log forging for #2; request smuggling / header injection on outbound webhooks for #3. ### Workarounds - Upgrade to the patched version. - Enable authentication (`CRAWL4AI_API_TOKEN`). - Run the container with a read-only root filesystem. ### Credits Internal security audit (Crawl4AI maintainers).

GHSA-7cx2-g3h9-382p Affected Crawl4AI Versions

1 component(s)
Fixed Versions:
0.8.8
Product / Package Ecosystem Affected Versions Fixed Version
crawl4ai
PyPI
< 0.8.8
0.8.8

References

Frequently Asked Questions

What is GHSA-7cx2-g3h9-382p?
GHSA-7cx2-g3h9-382p is a security vulnerability in Crawl4AI involving Arbitrary file write (symlink/TOCTOU) plus log and webhook-header injection in Docker server under CWE-59: Improper Link Resolution Before File Access ('Link Following').
Which Crawl4AI versions are affected?
Affected versions include releases prior to 0.8.8 across affected packages: crawl4ai.
What version fixes GHSA-7cx2-g3h9-382p?
Upgrading to 0.8.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is crawl4ai affected?
Yes, crawl4ai is affected in releases prior to 0.8.8. Upgrade your dependency to 0.8.8 or later.
What is the CVSS score of GHSA-7cx2-g3h9-382p?
GHSA-7cx2-g3h9-382p has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with GHSA-7cx2-g3h9-382p?
GHSA-7cx2-g3h9-382p is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following') (The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.).
How can I check PyPI dependencies for GHSA-7cx2-g3h9-382p?
Run the dependency tree command: 'pip show crawl4ai'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7cx2-g3h9-382p",
  "modified" : "2026-07-21T15:02:21Z",
  "published" : "2026-06-16T21:02:19Z",
  "aliases" : [ ],
  "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).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "crawl4ai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.8.7"
    }
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-117", "CWE-22", "CWE-59", "CWE-93" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-16T21:02:19Z",
    "nvd_published_at" : null
  }
}