Cloudflare Agents SDK has Insecure Direct Object Reference (IDOR) via Header-Based Email Routing
Affected releases · agents
- 0.3.x0.3.0 – 0.3.6Fixed in 0.3.7
- 0.2.x0.2.0 – 0.2.35No fix on this line yet
- 0.1.x and older0.0.1 – 0.1.6No fix, no longer updated
On 0.3.x, the newest line:
npm install agents@0.3.7Affected
0.0.1 – 0.3.6
127 releases
Fixed
0.3.7 – 0.29.0
78 releases, latest
Is your project affected?
Paste your package.json, or type the range you declare for agents. It is read in your browser and sent nowhere.
What happens
Summary
An Insecure Direct Object Reference (CWE-639) has been found to exist in createHeaderBasedEmailResolver() function within the Cloudflare Agents SDK. The issue occurs because the Message-ID and References headers are parsed to derive the target agentName and agentId without proper validation or origin checks, allowing an external attacker with control of these headers to route inbound mail to arbitrary Durable Object instances and namespaces.
Root cause
The createHeaderBasedEmailResolver() function lacks cryptographic verification or origin validation for the headers used in the routing logic, effectively allowing external input to dictate internal object routing.
Impact
Insecure Direct Object Reference (IDOR) in email routing lets an attacker steer inbound mail to arbitrary Agent instances via spoofed Message-ID.
Patches
Agents-sdk users should upgrade to agents@0.3.7. PR: #811 This documentation provides the necessary architectural context for coding agents to mitigate the issue by refactoring the resolver to enforce strict identity boundaries.