How the attack works
The attacker calls the Crawl4AI API and sets a base_url or endpoint parameter to a server they control. In the same request, they set a credential field like api_token, api_key, or secret to the literal string "env:SOME_VARIABLE_NAME" instead of a real key. The vulnerable server interprets that string as an instruction, looks up the named environment variable on its own host, and sends the resolved value to the attacker-controlled endpoint. This can leak provider API keys, JWT signing secrets, or any other environment variable the server process has access to — none of which the caller was ever authorized to see.
Why it matters
An external caller can extract server-side secrets (API keys, signing secrets, other credentials) they should never have access to, by abusing a single API call with no prior access to the environment. This can lead to further compromise of connected AI providers or services using the stolen keys.
What you can do
- Never let user-supplied field values be resolved as server-side environment variable lookups; treat all incoming credential fields as opaque literal values.
- Restrict or validate base_url / endpoint-redirect parameters to an allowlist of known destinations.
- Audit environment variables available to the Crawl4AI service and remove any secrets it does not strictly need.
- Review logs for requests containing the literal pattern "env:" in credential fields combined with unfamiliar base_url values.
Known benign look-alikes
- Documentation or .env.example files showing 'API_KEY=your-key-here' style placeholders — no literal env: resolution-trick syntax.
- Legitimate code using os.environ.get('VAR_NAME') or process.env.VAR_NAME — different syntax from the literal 'env:VAR_NAME' string-value trick this rule targets.
- A base_url field pointing to a well-known first-party provider domain with no accompanying env: token trick.
References
- https://agentthreatrule.org/en/rules/ATR-2026-02262
- https://github.com/unclecode/crawl4ai/security/advisories/GHSA-f989-c77f-r2cq
- https://www.vulncheck.com/advisories/crawl4ai-llm-credential-exfiltration-via-base-url-and-environment-variable-resolution
- https://nvd.nist.gov/vuln/detail/CVE-2026-56259