Summary
Crawl4AI's Docker API server exposes an /execute_js endpoint that runs attacker-supplied JavaScript inside a browser context configured with disabled web security.
When reachable, this endpoint can be abused to execute arbitrary script and, due to relaxed browser policies, perform server-side request forgery (SSRF) against internal services.
Affected context
This vulnerability appears in deployments of Crawl4AI that expose the Docker API server, particularly when the /execute_js endpoint is reachable from untrusted networks or integrated into automated workflows.
The issue is most relevant in environments where the browser within the container is launched with --disable-web-security, expanding the JavaScript execution context beyond normal same-origin constraints.
Risk increases when the container has network visibility into internal services, metadata endpoints, or other sensitive infrastructure.
Exploit preconditions
- Attack surface: HTTP access to the Crawl4AI Docker API server's /execute_js endpoint
- Required access: Ability to send crafted requests (usually network-level access; authentication requirements depend on deployment)
- Trigger point: Submission of arbitrary JavaScript payloads through the /execute_js API
- Why exploitation is possible: The API directly evaluates user-supplied JavaScript within a browser instance configured with --disable-web-security, allowing scripts to issue requests to internal endpoints and bypass typical browser origin restrictions.
Why this happens
The underlying bug is the design pattern of exposing an endpoint that accepts and directly executes user-provided JavaScript without robust controls.
This maps to CWE-94: Improper Control of Generation of Code, where external input is treated as executable code in a privileged environment.
By running script in a browser with disabled web security, the component effectively grants untrusted code a powerful network-capable execution environment, blurring the boundary between user input and internal logic.
Potential impact
- Arbitrary JavaScript execution in the server-controlled browser context
- Server-side request forgery (SSRF) to internal HTTP services and cloud metadata endpoints
- Unauthorized access to internal APIs and data reachable from the container's network
- Pivoting into adjacent systems via exposed management interfaces
- Interference with crawling workflows, data integrity, or automation pipelines
General mitigation guidance
Effective mitigation focuses on reducing or eliminating the ability for untrusted input to become executable JavaScript within the server environment.
Pattern-based defensive approaches include:
- Avoid exposing generic "execute script" endpoints to untrusted users or networks.
- Replace arbitrary code execution with constrained, declarative APIs that offer specific, vetted actions instead of raw scripting.
- Enforce strict authentication, authorization, and allowlisting of permitted scripts or operations if execution capabilities must remain.
- Run browsers with standard security policies enabled; avoid disabling web security in production unless combined with strict isolation.
- Restrict outbound network access from the crawling container to only necessary destinations, minimizing SSRF blast radius.
- Apply least-privilege to container and network configurations so that compromise of the browser context has limited reach.
How teams detect issues like this
Organizations can identify similar vulnerabilities by:
- Reviewing API designs for endpoints that accept and execute code or script-like input.
- Applying static analysis rules to highlight direct evaluation of user-supplied JavaScript or unsafe code generation patterns.
- Establishing code review checklists that flag use of browser flags such as --disable-web-security in server-side automation.
- Monitoring runtime logs and network telemetry for unusual outbound requests originating from crawling containers, including calls to internal or metadata endpoints.
- Using automated security testing tools to probe API servers for script execution and SSRF behaviors as part of continuous assessment.

