Overly Permissive IAM Role Trust Policy
An IAM role's trust policy lets principals outside the intended set assume it, such as any AWS account, a third party without an external ID, or any repository using an OIDC provider.
| Severity | High |
| CVSS 3.1 | 7.4 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 9.1 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-863: Incorrect Authorization |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1078.004 Cloud Accounts, T1199 Trusted Relationship |
| Category | Broken Access Control |
Description
A role's trust policy (its AssumeRolePolicyDocument) defines who may assume it. One or more roles trust a wider set of principals than intended. Typical forms are:
- A principal of
"AWS": "*"or"*"without restricting conditions, which lets an identity in any AWS account assume the role. - Trust in a third party's whole account without an
sts:ExternalIdcondition, which exposes the role to the confused deputy problem: any customer of that third party can ask its service to act against the role. - Trust in an OIDC identity provider, such as
token.actions.githubusercontent.comfor GitHub Actions, without a condition on the token'ssubclaim restricting it to the organisation's repositories and branches, so that workflows in other repositories can assume the role. - Trust in another account's root ARN where only one specific role in that account should be trusted.
Where a role can be assumed from outside the intended set, an attacker who learns its ARN, made up of the account ID and role name, which are often guessable or exposed in code and documentation, can obtain temporary credentials for it from their own AWS account or code repository, and then holds all of the role's permissions without having compromised any of the organisation's credentials. Cross-account roles used by deployment pipelines and third-party tools often have broad permissions, so the result can be control of the account, and the activity appears in CloudTrail under the role's name, which makes it easy to mistake for legitimate use.
The issue is identified by reviewing trust policies with aws iam get-role and from IAM Access Analyzer external access findings, which report roles that can be assumed from outside the account or organisation. Prowler and ScoutSuite also flag wildcard and condition-less trust. It can be confirmed by attempting sts:AssumeRole from an unrelated account controlled by the tester.
Remediation
Restrict every trust policy to the specific principals that need the role:
- Replace wildcard principals with the exact role or account ARNs that must assume the role. Where a wildcard is needed for technical reasons, add conditions such as
aws:PrincipalOrgIDoraws:PrincipalAccountthat limit it to the organisation's own accounts. - For roles assumed by third-party services, require the unique external ID that the vendor issues for the organisation, with an
sts:ExternalIdcondition. - For OIDC federation, require the expected
audclaim and restrict thesubclaim to the specific repositories and branches or environments that deploy, usingStringEqualsor a narrowly scopedStringLike. - Review the permissions of cross-account roles as well, and give each only the access its task requires.
- Create an
IAM Access Analyzerexternal access analyser for the account or organisation, and treat new findings as alerts.
Confirm the fix by repeating the assumption attempt from an unrelated account, which should be denied, and by checking that no unintended external access to the role is reported.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.