CVE-2026-26216: Crawl4AI Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-5882-5rx9-xgxp
CWE-94
Published
Advisory Summary

CVE-2026-26216 is a CRITICAL remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Crawl4AI libraries in the PyPI ecosystem. The issue involves crawl4ai is vulnerable to remote code execution in docker api via hooks parameter. Remediation is available by upgrading affected packages to version 0.8.0.

CVE-2026-26216 at a Glance

CVE Identifier CVE-2026-26216
GHSA Identifier GHSA-5882-5rx9-xgxp
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Crawl4AI
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-26216

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.0
pip install Crawl4AI>=0.8.0
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 CVE-2026-26216, 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.0), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. 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

A critical remote code execution vulnerability exists in the Crawl4AI Docker API deployment. The `/crawl` endpoint accepts a `hooks` parameter containing Python code that is executed using `exec()`. The `__import__` builtin was included in the allowed builtins, allowing attackers to import arbitrary modules and execute system commands. **Attack Vector:** ```json POST /crawl { "urls": ["https://example.com"], "hooks": { "code": { "on_page_context_created": "async def hook(page, context, **kwargs):\n __import__('os').system('malicious_command')\n return page" } } } ``` ### Impact An unauthenticated attacker can: - Execute arbitrary system commands - Read/write files on the server - Exfiltrate sensitive data (environment variables, API keys) - Pivot to internal network services - Completely compromise the server ### Mitigation 1. **Upgrade to v0.8.0** (recommended) 2. If unable to upgrade immediately: - Disable the Docker API - Block `/crawl` endpoint at network level - Add authentication to the API ### Fix Details 1. Removed `__import__` from `allowed_builtins` in `hook_manager.py` 2. Hooks disabled by default (`CRAWL4AI_HOOKS_ENABLED=false`) 3. Users must explicitly opt-in to enable hooks ### Credits Discovered by Neo by ProjectDiscovery (https://projectdiscovery.io)

CVE-2026-26216 Affected Crawl4AI Versions

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

References

Frequently Asked Questions

What is CVE-2026-26216?
CVE-2026-26216 is a security vulnerability in Crawl4AI involving Crawl4AI is Vulnerable to Remote Code Execution in Docker API via Hooks Parameter under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Crawl4AI versions are affected?
Affected versions include releases prior to 0.8.0 across affected packages: Crawl4AI.
What version fixes CVE-2026-26216?
Upgrading to 0.8.0 (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.0. Upgrade your dependency to 0.8.0 or later.
What CWE is associated with CVE-2026-26216?
CVE-2026-26216 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2026-26216?
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-5882-5rx9-xgxp",
  "modified" : "2026-06-05T16:23:37Z",
  "published" : "2026-01-16T20:59:16Z",
  "aliases" : [ "CVE-2026-26216" ],
  "summary" : "Crawl4AI is Vulnerable to Remote Code Execution in Docker API via Hooks Parameter",
  "details" : "A critical remote code execution vulnerability exists in the Crawl4AI Docker API deployment. The `/crawl` endpoint accepts a `hooks` parameter containing Python code that is executed using `exec()`. The `__import__` builtin was included in the allowed builtins, allowing attackers to import arbitrary modules and execute system commands.\n\n**Attack Vector:**\n```json\nPOST /crawl\n{\n  \"urls\": [\"https://example.com\"],\n  \"hooks\": {\n    \"code\": {\n      \"on_page_context_created\": \"async def hook(page, context, **kwargs):\\n    __import__('os').system('malicious_command')\\n    return page\"\n    }\n  }\n}\n```\n\n### Impact\n\nAn unauthenticated attacker can:\n- Execute arbitrary system commands\n- Read/write files on the server\n- Exfiltrate sensitive data (environment variables, API keys)\n- Pivot to internal network services\n- Completely compromise the server\n\n### Mitigation\n\n1. **Upgrade to v0.8.0** (recommended)\n2. If unable to upgrade immediately:\n   - Disable the Docker API\n   - Block `/crawl` endpoint at network level\n   - Add authentication to the API\n\n### Fix Details\n\n1. Removed `__import__` from `allowed_builtins` in `hook_manager.py`\n2. Hooks disabled by default (`CRAWL4AI_HOOKS_ENABLED=false`)\n3. Users must explicitly opt-in to enable hooks\n\n### Credits\n\nDiscovered by Neo by ProjectDiscovery (https://projectdiscovery.io)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Crawl4AI"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.8.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/unclecode/crawl4ai/security/advisories/GHSA-5882-5rx9-xgxp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-26216"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/crawl4ai/PYSEC-2026-33.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/unclecode/crawl4ai"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unclecode/crawl4ai/blob/release/v0.8.0/docs/blog/release-v0.8.0.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unclecode/crawl4ai/blob/release/v0.8.0/docs/migration/v0.8.0-upgrade-guide.md"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/crawl4ai-docker-api-unauthenticated-remote-code-execution-via-hooks-parameter"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-16T20:59:16Z",
    "nvd_published_at" : "2026-02-12T16:16:17Z"
  }
}