Skip to main content
Back
DemonstrationAWS
6 min read

Datadog Security Labs' Amplify IAM role takeover research on AWS

Environment
AWS accounts with roles generated by AWS Amplify (research staged by Datadog Security Labs)
When
Jan 4, 2024 – Apr 15, 2024Disclosed Apr 15, 2024
Entry
A role trust policy that trusted the Amazon Cognito identity service without scoping to the project's identity pool, assumed from a Cognito identity pool in another AWS account.

AWS Amplify generated IAM roles whose trust policy let the Amazon Cognito identity service assume them without naming the project's identity pool: one variant dropped the condition when a developer removed authentication, the other checked only whether the identity was signed in. Datadog Security Labs showed that a Cognito identity pool in another AWS account could mint a web identity token and assume such a role through AWS STS, and that some exposed roles kept full Amazon S3 or full Amazon Kinesis access. AWS fixed the Amplify CLI and Studio in January 2024 and changed IAM and STS in February and April 2024; the research names no victim and reports no in-the-wild use, and assumption from the same account stays possible.

What the demonstration did

External Parties
Datadog Security Labs
AWS
Internet
AWS STSweb-identity role assumption
AWS Amplify
Amplify-generated roles
Outside AWS account
+ Amazon S3 buckets
+ Amazon Kinesis streams
+ what the role allows
Resources the role reaches
Amplify IAM role
Amplify CLI and Studio
Project identity pool
Outside identity pool
Outside user pool

Replaying Datadog's Amplify role takeover demonstration / reported to AWS in January 2024, disclosed in April 2024

  1. 1

    Trust open to any identity pool

    Variant two from July 2018, variant one from August 2019

    AWS Amplify writes role trust policies that let any Cognito identity pool assume the role: one variant drops the condition when authentication is removed, the other checks only the sign-in state.

  2. 2

    Role ARNs found in public code

    Not dated

    A public code search over GitHub gathers over 8,000 role ARNs in minutes, by Datadog's count; over 90 percent of the vulnerable roles share similar names, and three sit in AWS's own sample projects.

  3. 3

    Role assumed from an outside account

    Not dated · proof of concept sent to AWS Jan 9, 2024

    An identity pool in another AWS account mints a web identity token through the basic (classic) flow, and AWS STS returns the Amplify role's temporary credentials; a role that requires a signed-in identity also takes a user pool and a user in that account.

  4. 4

    The role's broad access

    Not dated

    Amplify leaves the role's permissions in place, so some exposed roles keep full Amazon S3 or full Amazon Kinesis access that the returned credentials can use; the research's example of reading documents is hypothetical.

Impact

No attack was reported: Datadog showed that an Amplify-generated role whose trust policy did not scope to its identity pool could be assumed from an identity pool in any AWS account, returning the role's temporary credentials, and that roles which kept broad managed policies gave broad reach; the research names no victim.

Outcome

What the Amplify role takeover shows about trust policies

A role trust policy that trusts the Amazon Cognito identity service without naming your identity pool lets a token from a pool in another AWS account assume the role, and the role's attached policies then set what that token can reach. Scope each such trust policy to your own pool with the aud condition, which IAM now requires when a trust policy is saved. AWS STS also refuses a cross-account Cognito assumption when the condition is missing, but a pool in the same account can still reach a role that remains vulnerable, so the finder recommends deleting such a role or changing its trust policy. A permissions boundary on the role caps what a takeover reaches.

Would the controls have stopped it?

In hindsight, not as a whole. 2 controls would have refused a step outright, and 2 controls would have limited one. 1 step has no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

2
Prevented
2
Contained
1
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

External Parties
Datadog Security Labs
AWS
Internet
AWS STSweb-identity role assumption
AWS Amplify
Amplify-generated roles
Outside AWS account
+ Amazon S3 buckets
+ Amazon Kinesis streams
+ what the role allows
Resources the role reaches
Amplify IAM role
Amplify CLI and Studio
Project identity pool
Outside identity pool
Outside user pool

Replaying Datadog's Amplify role takeover demonstration / reported to AWS in January 2024, disclosed in April 2024

1 · Trust open to any identity pool

1 Prevented

2 · Role ARNs found in public code

1 Not covered

3 · Role assumed from an outside account

1 Prevented1 Contained3 on other clouds

4 · The role's broad access

1 Contained3 on other clouds

Key facts

  • AWS Amplify generated IAM roles whose trust policy let the Amazon Cognito identity service assume them without scoping to the project's identity pool; Amplify CLI versions before 12.10.1 and Amplify Studio were affected
  • In variant one, Amplify dropped the trust policy's condition when a developer removed the authentication component, a behavior the write-up traced to August 2019; in variant two, an earlier Amplify CLI default, the condition checked only whether the identity was authenticated, not which pool it came from
  • Datadog Security Labs reported to AWS on January 9, 2024, with a proof of concept, that a Cognito identity pool in another AWS account could mint a web identity token and assume such a role through AWS STS
  • A public code search over GitHub gathered over 8,000 role ARNs in minutes, per Datadog Security Labs' write-up of April 15, 2024, which does not date the search; over 90 percent of the vulnerable roles had similar names, and three sat in AWS's own public sample projects. The write-up gave no count of roles assumed and no total of affected accounts
  • AWS released Amplify CLI 12.10.1 on January 10, 2024, and patched Amplify Studio on January 12; it changed STS to block cross-account assumption of variant-one roles on February 28 and of variant-two roles on April 8, and IAM to refuse new variant-one roles on February 29
  • Disclosure was coordinated on April 15, 2024, with AWS bulletin AWS-2024-003 and CVE-2024-28056, rated CVSS 9.8 (critical); no source reported in-the-wild use, and assumption from the same account stayed possible after the fixes

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    Amplified exposure: How AWS flaws made Amplify IAM roles vulnerable to takeoverDatadog Security Labs · Apr 15, 2024 · Researchthe two trust policy variants, role discovery, the takeover method, the disclosure timeline, the AWS fixes, no observed in-the-wild use
  2. 2.
    CVE-2024-28056 (AWS security bulletin AWS-2024-003)Amazon Web Services · Apr 15, 2024 · AdvisoryCLI fix version, IAM and STS changes, customer notification
  3. 3.
    CVE-2024-28056 recordMITRE (CVE Program), with CISA-ADP enrichment · Apr 15, 2024 · AdvisoryCVSS score, CWE class, the condition-removal trigger, references
  4. 4.
    Exploit Amplify vulnerability in same account scenarioHacking the Cloud · Nov 21, 2024 · Researchresidual same-account exploitation, the operations named, delete-the-role remediation
  5. 5.
    Amplify CLI release 12.10.1AWS Amplify (GitHub) · Jan 10, 2024 · Vendor reportCLI fix date and change

The estate in the replay follows the researchers' description of their own test environment. Verdicts describe what a control does when it is in place before the run. They are not an assessment of any company's security program.

More cloud attack breakdowns

All breakdowns