docs/security/GHSA-DRAFT-RCE-LFI.md
Instructions: Copy this content to create security advisories at: https://github.com/unclecode/crawl4ai/security/advisories/new
Remote Code Execution in Docker API via Hooks Parameter
Critical
10.0 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H)
CWE-94 (Improper Control of Generation of Code)
crawl4ai (Docker API deployment)
< 0.8.0
0.8.0
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:
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"
}
}
}
An unauthenticated attacker can:
/crawl endpoint at network level__import__ from allowed_builtins in hook_manager.pyCRAWL4AI_HOOKS_ENABLED=false)Discovered by Neo by ProjectDiscovery (https://projectdiscovery.io)
Local File Inclusion in Docker API via file:// URLs
High
8.6 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N)
CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)
crawl4ai (Docker API deployment)
< 0.8.0
0.8.0
A local file inclusion vulnerability exists in the Crawl4AI Docker API. The /execute_js, /screenshot, /pdf, and /html endpoints accept file:// URLs, allowing attackers to read arbitrary files from the server filesystem.
Attack Vector:
POST /execute_js
{
"url": "file:///etc/passwd",
"scripts": ["document.body.innerText"]
}
An unauthenticated attacker can:
/etc/passwd, /etc/shadow, application configs)/proc/self/environAdded URL scheme validation to block:
file:// URLsjavascript: URLsdata: URLsOnly http://, https://, and raw: URLs are now allowed.
Discovered by Neo by ProjectDiscovery (https://projectdiscovery.io)
Go to: https://github.com/unclecode/crawl4ai/security/advisories/new
Fill in the form for each advisory:
After creating, GitHub will:
Coordinate disclosure timing with the fix release