Fact-checked by Grok 2 weeks ago

Confused deputy problem

The confused deputy problem is a classic in computer systems where a privileged program, acting as an intermediary or "deputy," is deceived by an unprivileged entity into misusing its authority to perform unauthorized actions. First articulated by Norm Hardy in 1988, the issue arises when a program receives authority from multiple sources without mechanisms to distinguish or isolate them, leading to unintended . This problem highlights fundamental flaws in models that separate designation (naming resources) from authorization (granting permissions), making it a key rationale for systems. In Hardy's original example from the Tymshare system, a compiler running in a privileged directory (SYSX) held a "home files license" allowing it to write to system files like the statistics file (SYSX)STAT. An unprivileged tricked the compiler into redirecting its debugging output to the billing file (SYSX)BILL instead, overwriting critical data because the compiler could not differentiate between its own legitimate authority and the user's malicious intent. This scenario demonstrated how even well-intentioned programs can be coerced into harmful actions when their privileges are not tightly scoped or revocable. The confused deputy problem remains highly relevant in modern computing environments, particularly in cloud services and multi-tenant systems where cross-account or cross-service interactions are common. For instance, in AWS, an unauthorized entity might exploit trust relationships in roles to coerce a service like S3 into granting access to resources it shouldn't, such as when a malicious principal assumes a role without proper validation. Similar vulnerabilities have appeared in mobile applications, like the and Camera apps, where third-party apps exploited unprotected features to access the camera without direct permissions. To mitigate the confused deputy problem, systems employ techniques like external identifiers in trust policies to verify the caller's , keys in resource policies to restrict access based on source attributes (e.g., account ID or ARN), and capability-based architectures that bind rights directly to objects rather than relying on global naming. In capability systems, as advocated, programs hold unforgeable representing specific permissions, preventing misuse by ensuring authorities cannot be impersonated or confused. These strategies emphasize least and explicit verification, reducing the in distributed and API-driven environments.

Definition and History

Definition

The confused deputy problem refers to a class of vulnerabilities in which a privileged , acting as an or "," is coerced by an unprivileged entity into misusing its authority to perform unauthorized actions, often by failing to verify the true intent or origin of a request despite authenticating the requester's . This occurs when the deputy interprets a credential or token as broadly legitimate without contextual validation, allowing the unprivileged entity to indirectly access resources or escalate privileges beyond its own capabilities. A key element of the problem lies in the distinction between and : authentication confirms the identity of the entity making the request (e.g., verifying that it is a valid or ), while authorization determines whether the specific action requested aligns with the permissions and intended use of those credentials. The deputy becomes "confused" when it relies solely on authentication to grant access, neglecting to authorize the request's purpose or provenance, thereby enabling the unprivileged entity to exploit the deputy's higher privileges as if they were its own. In formal terms, the emerges in systems where possesses derived from multiple sources—such as the invoker's authenticated and 's own inherent privileges—but lacks mechanisms to isolate and validate these authorities separately, resulting in unintended proxying of requests that bypass access controls. This leads to , as effectively acts on behalf of the attacker without discerning the manipulation.

Origin and Evolution

The confused deputy problem was first formally identified and named by Norman Hardy in his 1988 paper, where he described it as a fundamental flaw in systems relying on ambient authority, particularly in the context of architectures like KeyKOS. Hardy illustrated the issue through a real-world incident at Tymshare, a service provider, where a program—granted elevated privileges via a "home files license"—was tricked into overwriting critical billing data due to its inability to distinguish between its own authority and that delegated by an unprivileged user. This work emphasized how such deputy-like intermediaries in operating systems could be coerced into misapplying permissions, advocating capabilities as a to bind authority directly to designations and prevent unauthorized escalation. In the 1990s, the concept gained traction in operating systems research, particularly in discussions of access control models contrasting ACLs with capabilities. Researchers referenced Hardy's analysis to critique identity-based systems for their vulnerability to deputy confusion, influencing explorations into fine-grained protection mechanisms. By the late 1990s and early 2000s, it informed formalizations in object-capability (ocap) security models, where authority is encapsulated in objects to avoid ambient risks, as seen in systems like the E programming language and related theoretical work. The problem experienced a resurgence in the 2010s alongside the widespread adoption of , where delegated access via roles and service principals amplified deputy-like interactions across distributed services. Major cloud providers began explicitly addressing it in documentation around 2015-2017, with AWS highlighting its relevance to cross-account role assumptions and recommending mitigations like external IDs to verify intent. By the 2020s, it featured prominently in cloud guidelines, underscoring its ongoing impact on scalable, multi-tenant environments. This historical recognition has shaped standards in , prompting refinements in capabilities to decompose privileges and reduce setuid risks, as well as influencing modern token-based authentication protocols like OAuth 2.0, which incorporate scopes and audience claims to mitigate deputy confusion.

Examples

Classic File System Example

The classic file system example of the confused deputy problem originates from a in early operating systems, where a privileged is tricked into misusing its to overwrite a sensitive system . In this setup, the , located in a protected system such as SYSX, is designed to run with elevated privileges—specifically, a "home files license" that allows it to write to within SYSX, including its hardcoded statistics (SYSX)STAT. However, the also accepts user-specified filenames for optional output, relying on the invoking user's for most operations but inadvertently applying its system-level privileges when the specified resides in the protected . The attack unfolds in the following steps:
  1. A low-privilege invokes the using a command like RUN (SYSX)FORT, which executes the program with its inherent system privileges.
  2. During , the requests debugging output and supplies (SYSX)BILL—the system's billing file—as the target , exploiting the 's acceptance of input without validating the file's or .
  3. The , acting as the "deputy," trusts the provided and uses its home license (stemming from its ) to write the , thereby overwriting the billing and erasing critical usage records.
This confusion arises because the derives authority from two distinct sources: its own -granted privileges for protected operations and the invoker's limited authority for user-directed actions, without a to segregate or validate them. In operating systems, this example underscores vulnerabilities in setuid programs or server daemons that temporarily elevate privileges (e.g., to access shared resources) but fail to scrutinize user-supplied parameters, potentially allowing unauthorized modifications to system files. To illustrate the request flow:
User (low privilege) ── invokes ──> Compiler (deputy, with system privileges)
                          │ specifies filename: (SYSX)BILL
                          v
Compiler trusts input ── writes ──> (SYSX)BILL (overwrites billing data)
  (uses own authority)         │
                              │ Point of confusion: No validation of target
This snippet represents the flawed logic in the compiler's output handling:
pseudocode
function write_debug_output(filename):
    if filename is in SYSX [directory](/page/Directory):
        use home_files_license()  // Elevated [privilege](/page/Privilege)
        write_to_file(filename, debug_data)
    else:
        use invoker_authority()   // User's limited [privilege](/page/Privilege)
        write_to_file(filename, debug_data)
    // Flaw: No check if filename targets sensitive SYSX files like BILL
The and highlight how the deputy's misplaced in the principal's input leads to .

Cloud Computing Examples

In cloud computing environments, the confused deputy problem manifests through cross-service interactions where one AWS service, acting as a trusted , is coerced into accessing resources in another service or account on behalf of an unauthorized entity. This often occurs via role assumptions without proper validation, exploiting the transient and federated nature of cloud identities. For instance, in AWS, an attacker with stolen temporary credentials can assume an role to invoke a function, which then interacts with an S3 the attacker lacks direct access to, effectively using Lambda as the unwitting deputy. A prominent cross-service example involves CloudTrail and Amazon S3, where an unauthorized actor configures a malicious CloudTrail trail to deliver logs to a target S3 bucket in a different account. The S3 bucket's resource policy trusts the cloudtrail.amazonaws.com service principal without additional checks, allowing the actor to leverage CloudTrail's elevated permissions to write data to the bucket, potentially exfiltrating or overwriting sensitive information. Similarly, API Gateway can be tricked into accessing CloudWatch Logs; if the logging role for API Gateway trusts the service principal broadly, an attacker could invoke API Gateway to push unauthorized log data into a victim's CloudWatch stream, exploiting the service's trust to bypass direct access controls. EC2 instances with instance profile roles are also vulnerable, as an attacker assuming such a role can coerce the instance to retrieve or modify unauthorized resources, such as EBS volumes or other EC2 metadata, in a multi-account setup. Recent developments in the highlight the problem's persistence in serverless architectures, where ephemeral functions and rapid role assumptions exacerbate risks. A notable vulnerability in AWS AppSync allowed attackers to cross account boundaries by creating malicious data sources that assumed roles trusted by AppSync, enabling execution of calls like reading from DynamoDB tables in victim accounts without authentication. In 2024, a confused deputy vulnerability in Amazon DataZone enabled potential attackers to assume roles in AWS accounts by exploiting trust relationships in DataZone environments, which was subsequently resolved by AWS. These cases illustrate the prevalence in multi-tenant clouds, where thousands of daily role assumptions across services create numerous attack surfaces. Unlike the classic example, where operates within a single local system, variants involve distributed, transient role assumptions across global, multi-tenant infrastructures, scaling the problem to affect potentially millions of resources simultaneously due to the automated and federated trust models.

Solutions and Mitigations

General Mechanisms

The principle of least is a foundational mechanism for mitigating the confused deputy problem by ensuring that privileged components, or "deputies," operate only with the minimal authority necessary to fulfill their intended functions and rigorously validate of every incoming request. This approach limits the potential damage from coerced actions, as the deputy cannot perform unauthorized operations even if tricked into processing a . For instance, in systems where a deputy like a or service must act on behalf of users, enforcing least prevents by requiring explicit checks on request and purpose before execution. Token and credential validation provides another critical layer of protection by employing non-transferable or that include context-specific information, such as request origin or intended recipient, beyond mere . These mechanisms require deputies to verify not only the validity of the but also its applicability to the specific and , thereby blocking attempts to or credentials in coercive scenarios. For example, in identity platforms, must be validated against the expected and to prevent misuse where an attacker impersonates a legitimate principal. Capability-based security addresses the confused deputy problem at its core by structuring access rights as unforgeable, object-specific tokens that cannot be delegated or transferred without explicit endorsement from the rights holder. In such systems, deputies hold tied directly to particular resources, ensuring that any action requires possession of the exact capability for that object and preventing generic through intermediaries. This model, originally motivated by the need to resolve deputy confusion in multi-principal environments, enforces fine-grained control where rights are inseparable from their designated use. Audit and logging mechanisms enable post-incident detection and forensic analysis of confused deputy incidents by maintaining detailed traces of request , including origins, delegations, and executed actions. These logs allow system administrators to reconstruct attempts, identify patterns of abuse, and refine policies to prevent recurrence, serving as a complementary defense when preventive measures fail. Systematic tools for analyzing such logs can automatically detect vulnerabilities by evaluating inter-service interactions and privilege flows.

Cloud-Specific Protections

In (AWS), External IDs serve as a key mechanism to mitigate the confused deputy problem during cross-account role assumptions. When configuring roles for third-party access, an External ID—a unique, non-secret string provided by the resource owner—is required in the AssumeRole request. This ensures that only authorized entities possessing the correct External ID can assume the role, preventing malicious actors from coercing the service into acting on unintended resources. AWS explicitly states that this feature addresses scenarios where a less-privileged entity tricks a trusted service principal into unauthorized actions. AWS further employs Service Control Policies (SCPs) within AWS Organizations and resource-based policies to enforce restrictions on actions based on principals and contextual attributes, directly countering confused deputy risks in multi-account environments. SCPs set maximum permissions at the organizational unit level, denying actions that could enable cross-service impersonation, while resource policies use condition keys like aws:SourceArn and aws:SourceAccount to verify the originating service or account before allowing access. In , analogous protections are provided through managed identities combined with (RBAC) conditions, which restrict role assignments based on attributes such as the requesting principal or resource context, ensuring identities cannot be misused across tenants. Similarly, (GCP) utilizes service accounts with conditions and audience validation in tokens for workload identity federation, requiring specific claims like the intended audience to prevent token misuse by unauthorized parties. Best practices for implementing cloud-specific protections include incorporating audience (aud) claims in JSON Web Tokens (JWTs) to ensure tokens are validated only for intended recipients, thereby blocking confused deputy attacks where tokens are replayed across services. Adopting least-privilege policies limits the scope of roles to essential actions, reducing the impact of any coerced assumptions. Additionally, continuous monitoring via services like AWS CloudTrail, Monitor, or GCP Cloud Audit Logs enables detection of anomalous role assumptions, such as unexpected cross-account activity, allowing for rapid response.

References

  1. [1]
    [PDF] The Confused Deputy - UT Computer Science
    The Confused Deputy www.cis.upenn.edu/~KeyKOS/ConfusedDeputy.html. 1/3. The Confused Deputy. (or why capabilities might have been invented). Norm Hardy. Senior ...
  2. [2]
    CWE-441: Unintended Proxy or Intermediary ('Confused Deputy')
    The vulnerability arises when the attacker causes the program to run unexpected code or access unexpected files.
  3. [3]
    The confused deputy problem - AWS Identity and Access Management
    The confused deputy problem is when an entity without permission coerces a more-privileged one to act, using the trust of an AWS service principal to gain ...
  4. [4]
    Confused-Deputy-Attack - OWASP Cornucopia
    The application is seen as 'confused' because it was tricked into making a request on behalf of a malicious application. Example. In 2019 the Google and Samsung ...<|control11|><|separator|>
  5. [5]
    The Confused Deputy
    ### Summary of the Confused Deputy Problem
  6. [6]
    The Confused Deputy - MIT CSAIL Computer Systems Security Group
    The fundamental problem is that the compiler runs with authority stemming from two sources. (That's why the compiler is a confused deputy.)Missing: definition | Show results with:definition
  7. [7]
    The Confused Deputy: (or why capabilities might have been invented)
    The Confused Deputy: (or why capabilities might have been invented). Author: Norm Hardy ... Download PDF · View Issue's Table of Contents. Close modal. Export ...
  8. [8]
    Norm Hardy's Place in History - Mark S. Miller
    Mar 16, 2023 · Confused Deputy is the anomaly of identity-based access control that will always reappear. Of all the flaws we trot out, this one is irreducible ...Missing: definition | Show results with:definition
  9. [9]
    AWS Confused Deputy - is "external id" really just a "password"?
    Sep 8, 2015 · Yes, the External ID used with IAM Third-Party Roles is a glorified password. I'll be using the following terms here.
  10. [10]
    Confused deputy prevention - Amazon CloudWatch Logs
    The confused deputy problem is a security issue where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to ...
  11. [11]
    A confused deputy vulnerability in AWS AppSync
    Nov 21, 2022 · This vulnerability in AWS AppSync allowed attackers to cross account boundaries and execute AWS API calls in victim accounts via IAM roles that trusted the ...
  12. [12]
    Preventing Cross-Service Confused Deputy Attacks in AWS Lambda
    Sep 9, 2024 · The confused deputy attack is a scenario where a trusted service (the “deputy”) is tricked into performing actions on behalf of another entity.Missing: resurgence | Show results with:resurgence<|control11|><|separator|>
  13. [13]
    [PDF] SHILL: A Secure Shell Scripting Language - USENIX
    Oct 6, 2014 · Note that unlike SHILL scripts, sandboxed executables are vulnerable to confused deputy attacks if they allow clients to specify resources with ...
  14. [14]
    PoLPer: Process-Aware Restriction of Over-Privileged Setuid Calls ...
    Thus, adversaries must not only hijack the control flow or manipulate the data flow but also launch confused deputy attacks [22] to circumvent least privilege.<|separator|>
  15. [15]
    Access tokens in the Microsoft identity platform
    May 14, 2025 · Validating and accepting tokens meant for another resource is an example of the confused deputy problem. If the application needs to ...Tokens and claims overview · Configurable Token Lifetimes · ID tokens
  16. [16]
    [PDF] On access control, capabilities, their equivalence, and confused ...
    Hardy, “The confused deputy (or why capabilities might have been invented),” Operating Systems Review, vol. 22, no. 4, pp. 36–38, 1988. [17] OWASP, “Cross ...Missing: Norm | Show results with:Norm
  17. [17]
    iService: Detecting and Evaluating the Impact of Confused Deputy ...
    Dec 5, 2022 · Confused deputy problem is a specific type of privilege escalation. ... Our tool takes a snapshot of the access-control metadata, and performs ...
  18. [18]
    [PDF] FReD: Identifying File Re-Delegation in Android System Services
    Aug 10, 2022 · However, these services can become confused deputies if they improperly re-delegate file access to third-party applications through remote ...
  19. [19]
    Access to AWS accounts owned by third parties - AWS Identity and ...
    The primary function of the external ID is to address and prevent The confused deputy problem. Important. AWS does not treat the external ID as a secret.When should I use an external... · Example scenario using an...
  20. [20]
    Best practices for using Workload Identity Federation
    Requiring tokens and assertions to use this URL as the audience helps reduce the risk of a confused deputy attack. In such an attack, a bad actor presents a ...Protecting Against Spoofing... · Protecting Against... · Protecting Against Privilege...