| Package | Affected versions | Patched versions |
|---|---|---|
| crawl4ai | < 0.8.0 | 0.8.0 |
| crawl4ai | < 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)
Running one of these products? Scan your site to see whether it exposes a vulnerable version.
Scan my site free