The confused deputy problem is a security problem in which a program or service with legitimate authority is induced to exercise that authority improperly on behalf of another party. The program—the deputy—can access a resource or perform an operation that the requester cannot directly access or perform. The failure occurs when the deputy does not adequately distinguish its own authority from the authority that should apply to the request. It is a foundational concept in cybersecurity, particularly in systems that delegate work across trust boundaries.
Basic mechanism
A confused deputy scenario usually involves three roles:
- Requester: a user, program, or service that supplies a request or influences its contents.
- Deputy: a program authorized to carry out some operation.
- Protected resource: a file, account, service, or other object over which the deputy has authority.
The requester supplies information that influences an operation, such as a filename, destination address, account identifier, or instruction. The deputy acts on that information using authority available to it, without correctly determining whether that authority is appropriate for the request.
For example, a report-generation service may be able to read confidential records and write reports to an approved destination. If a requester can substitute an arbitrary output destination, the service might send confidential information somewhere the requester controls. The service's ability to read the records may be legitimate; the failure lies in using that ability for an unauthorized purpose.
This distinguishes the problem from a straightforward failure to check whether the deputy itself has permission. A resource's access-control system may correctly recognize the deputy and permit the operation. What it may not know is whether the deputy is exercising that permission on behalf of an authorized requester and for an authorized purpose.
The deputy need not be deceived about the requester's identity. Correct authentication does not, by itself, establish that a requested use of the deputy's authority is permitted.
Historical origin
The term is associated with Norman Hardy's 1988 paper The Confused Deputy: (or why capabilities might have been invented). Its central example involved a compiler service that needed special permission to write accounting information to a protected billing file.
The compiler also accepted a caller-selected filename for output. By specifying the protected billing file as the output destination, a caller could cause the compiler to write to that file using the compiler's special authority, even though the caller could not write to it directly.
The compiler therefore served two distinct purposes: performing compilation for a caller and maintaining accounting information for the service operator. Its authority to perform the second task became available to an operation controlled by the first.
The example illustrated a problem with interfaces that identify resources by names while obtaining permission to access them from a separate, implicit security context. The resource name did not express which authority should authorize the operation.
Authority, designation, and delegation
Three distinctions help explain the problem.
Designation identifies the resource to be used. A pathname, object identifier, or URL can designate a resource, but designation alone generally does not establish permission to access it.
Authority is the ability to perform an operation on that resource. It may derive from a process identity, a service account, an access token, or a reference carrying specific permissions.
Delegation allows another party to exercise some authority, directly or through an intermediary. Safe delegation requires defining which operations and resources are included, rather than merely allowing the intermediary to use all of its own privileges.
A common source of confused deputy vulnerabilities is ambient authority: permissions available implicitly from the execution environment rather than supplied explicitly for a particular operation. For example, a process may open a caller-supplied pathname using all permissions associated with its account. The pathname selects the object, while the account silently supplies authority.
Ambient authority does not automatically create a vulnerability. It creates conditions in which resource selection and permission selection can become disconnected.
Capability-based security
Capability-based security addresses this separation by using unforgeable references that both designate a resource and convey authority to perform specified operations on it.
Instead of accepting an arbitrary filename and opening it with broad service credentials, a deputy might accept an already-opened handle that permits writing only to the intended output object. Separately, it can retain a narrowly scoped handle for accounting operations.
This approach makes the distinction between caller-provided authority and service-owned authority explicit. However, capabilities are not an automatic guarantee against all confused deputy behavior. A component can still misuse a powerful capability it already holds if untrusted input controls how that capability is exercised.
Common manifestations
Privileged local programs
A program running with elevated permissions may accept paths, commands, or configuration from a less-privileged caller. If it uses those inputs with its elevated permissions without enforcing the intended boundary, it can modify protected files or perform unauthorized operations.
Some cases also involve race conditions, such as a resource changing between a permission check and its use. That timing problem is distinct from confused delegation, although both can occur in the same vulnerability.
Cloud services and cross-account access
In cloud computing, a customer may authorize a third-party service to access resources in the customer's account. The service acts as a deputy and may serve many customers using a shared service identity.
A vulnerability can arise if an attacker can make the service select another customer's resources while presenting the service's legitimate credentials. Authorizing the service identity alone may not establish which customer initiated a particular operation.
Defenses can bind requests to a customer-specific external identifier, a verified source resource, or another trusted context. The binding must establish the relationship between the requester and the target resource; an identifier accepted without validation is not sufficient.
Server-side request forgery
In server-side request forgery (SSRF), an attacker causes a server to make requests to destinations selected or influenced by the attacker. The server may have network access, credentials, or a trusted network position unavailable to the attacker.
SSRF is a confused deputy pattern when the server's legitimate authority is redirected toward an unauthorized resource. For example, a public-facing service might be induced to contact an internal administrative endpoint. The relevant authority may be network reachability rather than a file permission or explicit access token.
Cross-site request forgery
In cross-site request forgery (CSRF), an attacker induces a user's browser to send an unwanted request to a site where the user is authenticated. The browser may automatically attach cookies or other credentials.
This can be understood as a confused deputy pattern: attacker-controlled content causes the browser to exercise the user's session authority without a corresponding authorized user action. The browser's ability to submit authenticated requests is legitimate, but the attacker influences when and how that authority is used.
Tool-using AI systems
A tool-using AI agent may have access to private documents, messaging functions, or administrative services. Through prompt injection, attacker-controlled material can attempt to redirect the agent's use of those tools.
When an agent treats instructions in an untrusted document or tool response as authorization to exercise its own privileges, the resulting failure can be modeled as a confused deputy problem. The key issue is not simply that the model produced an incorrect response: lower-trust content has influenced an operation performed with higher-trust authority.
Not every prompt injection involves a confused deputy. An attack that changes only the wording of an answer may not involve delegated access to any protected resource.
Prevention and containment
Effective defenses preserve the relationship between the requester, the permitted operation, and the target resource.
Explicit authorization context
A deputy should distinguish between operations performed for itself and operations performed for a caller. An API can carry explicit caller identity, tenant context, resource scope, and delegated permissions.
Such context must be validated rather than merely copied from attacker-controlled parameters. A caller-supplied account identifier, for example, does not prove that the caller is entitled to act for that account.
Narrowly scoped authority
The principle of least privilege limits the resources and actions available to a deputy. Separate identities or components can isolate unrelated duties, such as maintaining billing records and producing user-selected output.
Least privilege reduces potential damage but may not eliminate the underlying confusion. Even a deputy with limited permissions can misuse those permissions if requests are not properly bound to authorized purposes.
Constrained interfaces and capabilities
Interfaces can avoid accepting unrestricted names, destinations, or operations. Alternatives include preauthorized object handles, resource-specific permissions, fixed destination mappings, and narrowly defined service methods.
A broad interface such as “fetch any address” exposes more opportunities for authority misuse than an interface restricted to a validated set of resources.
End-to-end binding
In multi-service workflows, delegation should preserve the relevant authorization context across each step. Credentials and requests can be restricted to an intended recipient, resource, operation, or validity period.
Authenticating one service to another establishes the immediate caller's identity. It does not necessarily establish the identity or permissions of the original requester.
Independent enforcement
For sensitive operations, policy enforcement outside the deputy's ordinary decision logic can provide an additional boundary. Examples include network egress restrictions, filesystem isolation, and tool gateways that validate requested actions.
This is particularly important when a deputy processes complex or untrusted content. Logging can support investigation, but an audit trail does not itself prevent an unauthorized operation.
Relationship to other security problems
The confused deputy problem overlaps with several categories of security vulnerability, but it describes a specific failure in the use of authority.
- Privilege escalation describes an outcome: gaining or exercising greater privileges than intended. Confusing a deputy is one mechanism that can produce that outcome.
- Injection vulnerabilities allow untrusted input to affect interpretation or execution. They become confused deputy cases when that influence redirects a component's authority.
- Broken access control is a broader category. A confused deputy is a particular pattern in which an intermediary misapplies authority it legitimately possesses.
- Impersonation involves acting as another identity. A confused deputy may remain correctly authenticated under its own identity throughout the attack.
The central diagnostic question is therefore not merely whether a component is allowed to perform an operation, but whose authority the operation should use, and whether the request legitimately invokes that authority.