T05 · Unauthorized Access and Privilege Escalation
- Location
templates/adapters/cloudflare/src/index.ts:27- Finding
Unauthenticated Public Workflow Execution Endpoint
- Content
View full analysis
{ const body = await c.req.json<{ task: string }>(); if (!body.task) { return c.json({ error: "Missing 'task' in request body" }, 400); } try { const result = await executeWorkflow(c.env, body.task); return c.json(result); } catch (e) { const message = e instanceof Error ? e.message : String(e); return c.json({ error: message }, 500); } }); ``` ### Technical Analysis The generated Cloudflare Worker exposes a POST endpoint that immediately passes an arbitrary user-supplied task to `executeWorkflow`. No authentication, authorization, request signature, API token, origin restriction, or abuse-prevention control is applied. A request consequently invokes all eligible agents in the workflow using the deployment owner's LLM account and credentials. Depending on the generated workflow, execution may also invoke tools, process persistent memory, and write output to Cloudflare D1 or R2 storage. This violates least privilege because possession of the public Worker URL is sufficient to exercise the workflow owner's resources. The endpoint also returns complete workflow results to the requester. If those results include information derived from long-term memory, prior-agent output, internal data sources, or privileged tools, the endpoint could expose that information to an unauthenticated party. ### Attack Path 1. An attacker discovers or guesses the deployed `workers.dev` endpoint. 2. The attacker sends a POST request containing an arbitrary `task`. 3. The Worker invokes the configured agents using the operator's LLM credentials. 4. The agents process attacker-controlled instructions and may use enabled tools or persistent storage. 5. The attacker receives the generated workflow output ...[truncated 851 chars]- Remediation
View remediation
