Analyzing Authorization Failures

5 minutes 5 Questions

Analyzing authorization failures is a core skill in Domain 4 of the SCS-C03 exam. It means finding out why a principal was denied access to an AWS resource and fixing the problem while keeping least privilege. Start with the IAM policy evaluation logic. A request is denied by default. An explicit Deny in any applicable policy overrides every Allow. Several policy types can be involved: identity-based policies, resource-based policies (such as S3 bucket policies or KMS key policies), permissions boundaries, session policies, Service Control Policies (SCPs), Resource Control Policies (RCPs), and VPC endpoint policies. Every applicable guardrail must permit the action. For cross-account access, both the identity policy in the calling account and the resource policy in the owning account must allow the request. Key troubleshooting tools: - AWS CloudTrail: Look for events with errorCode values such as AccessDenied, UnauthorizedOperation, or Client.UnauthorizedOperation. Check userIdentity, sourceIPAddress, eventSource, and errorMessage. Use CloudTrail Lake or Amazon Athena to query failures at scale. - Enhanced AccessDenied messages: Many services now name the policy type that caused the denial, for example \"with an explicit deny in a service control policy\". - STS DecodeAuthorizationMessage: EC2 and some other services return an encoded message. Calling sts:DecodeAuthorizationMessage reveals the matched statements and context. - IAM Policy Simulator: Tests how identity policies, boundaries, and SCPs evaluate specific actions, resources, and condition keys. - IAM Access Analyzer: Validates policies, flags errors, and generates least-privilege policies from CloudTrail activity. - Last accessed data: Shows which services and actions a role actually uses. Common root causes include missing KMS key policy grants, condition key mismatches (aws:SourceIp, aws:SourceVpce, aws:MultiFactorAuthPresent, aws:PrincipalOrgID, tag-based ABAC conditions), Region restrictions in SCPs, wrong resource ARNs (for example, bucket ARN versus object ARN), expired session credentials, and role trust policies that do not allow sts:AssumeRole. Exam tip: When a scenario describes unexpected denials, first identify which policy layer applies, then pick the tool that exposes that layer's decision.

Analyzing Authorization Failures in AWS: A Guide for the AWS Certified Security - Specialty Exam

Introduction
Authorization failures are among the most common operational and security problems in AWS. An authenticated principal (user, role or service) can sign a request correctly and still be refused because no policy grants the action, or because some policy explicitly blocks it. The AWS Certified Security - Specialty exam tests whether you can find which policy layer caused the denial, which tool reveals it, and what the least-privilege fix is.

Why It Is Important
- Security posture: Repeated AccessDenied events can point to credential misuse, reconnaissance by an attacker, or a compromised workload probing for permissions.
- Least privilege: Engineers under pressure often 'fix' a denial by attaching AdministratorAccess or adding wildcards. Knowing how to pinpoint the exact missing permission lets you grant only what is needed.
- Availability: Broken permissions stop applications, pipelines, backups and logging. A missing KMS key permission can halt an entire data pipeline.
- Governance: With AWS Organizations, SCPs, RCPs, permission boundaries and resource policies stacked together, a denial can come from many layers. Security teams must trace it accurately.
- Exam weight: The Identity and Access Management domain is a major part of the exam, and troubleshooting scenarios appear frequently.

What It Is
Analyzing authorization failures is the process of identifying why AWS returned a denial such as AccessDenied, AccessDeniedException, UnauthorizedOperation (EC2) or Client.UnauthorizedOperation, and then correcting the policy configuration. It is distinct from authentication failures such as InvalidClientTokenId, SignatureDoesNotMatch, ExpiredToken or UnrecognizedClientException, which mean AWS could not verify who you are, not that you lack permission.

How It Works: The Policy Evaluation Logic
Every request starts as an implicit deny. AWS evaluates all applicable policies and applies these rules:
1. An explicit Deny in any applicable policy always wins.
2. Organizations SCPs (for principals in member accounts) must allow the action. SCPs never grant permissions; they set maximum guardrails. They do not affect the management account.
3. Resource Control Policies (RCPs) set maximum permissions on resources in member accounts for supported services (such as S3, STS, KMS, SQS, Secrets Manager).
4. Resource-based policies (S3 bucket policies, KMS key policies, SQS/SNS policies, Lambda function policies, role trust policies) can grant access.
5. Identity-based policies attached to the user, group or role must allow the action (within the same account, an allow in either the identity policy or resource policy is generally enough, with exceptions such as KMS and role trust policies).
6. Permission boundaries cap what identity-based policies can grant. The effective permission is the intersection of boundary and identity policy.
7. Session policies (passed during AssumeRole or GetFederationToken) further restrict the session to the intersection.

Cross-account access requires an allow on both sides: the identity policy in the calling account and the resource policy (or role trust policy) in the owning account.

Common Root Causes
- Missing action or wrong resource ARN: for example granting s3:GetObject on arn:aws:s3:::bucket instead of arn:aws:s3:::bucket/*, or s3:ListBucket on the object ARN instead of the bucket ARN.
- Explicit deny in an SCP, RCP, bucket policy, boundary or identity policy (for example region restriction via aws:RequestedRegion).
- Condition keys not satisfied: aws:SourceIp fails when traffic flows through a VPC endpoint (use aws:SourceVpce or aws:SourceVpc instead); aws:MultiFactorAuthPresent is absent for long-term access keys; aws:SecureTransport false for HTTP; aws:PrincipalOrgID mismatch; tag-based (ABAC) conditions where aws:PrincipalTag or aws:ResourceTag values differ.
- KMS: the key policy must allow the principal (or delegate to IAM via the account root statement). Encrypted S3, EBS, SQS or Secrets Manager access fails if kms:Decrypt or kms:GenerateDataKey is missing, even when S3 access itself is allowed. Grants and kms:ViaService conditions also matter.
- Role assumption: the trust policy must name the principal, and the caller needs sts:AssumeRole. Conditions such as sts:ExternalId, MFA, or missing sts:TagSession / sts:SetSourceIdentity cause denials.
- iam:PassRole missing when launching EC2 with an instance profile, creating a Lambda function, or configuring services that use a role.
- S3 specifics: Block Public Access overriding public policies, Object Ownership / ACL issues where the bucket owner does not own objects uploaded cross-account (fix with Bucket owner enforced), and VPC endpoint policies that restrict buckets.
- VPC endpoint policies limiting which actions or resources are reachable through the endpoint.
- Permission boundary missing the action that the identity policy grants.
- Service-linked role or service principal missing from a resource policy (for example CloudTrail or Config writing to a bucket, or EventBridge invoking Lambda).

Tools for Analysis
- AWS CloudTrail: Search for events with errorCode AccessDenied or UnauthorizedOperation. Fields such as userIdentity, eventSource, eventName, sourceIPAddress, vpcEndpointId and errorMessage reveal who, what and from where. Use CloudTrail Lake, Athena queries on trail logs in S3, or CloudWatch Logs Insights plus metric filters and alarms for repeated denials.
- Enhanced access denied messages: Many services now state the policy type responsible, for example 'with an explicit deny in a service control policy' or 'because no identity-based policy allows the action'. This narrows the search fast.
- sts:DecodeAuthorizationMessage: EC2 and some other services return an encoded authorization failure message. Decode it with aws sts decode-authorization-message (requires the sts:DecodeAuthorizationMessage permission) to see the evaluated action, resource, context and matched statements.
- IAM Policy Simulator: Tests identity policies, boundaries, SCPs and resource policies against specific actions, resources and context keys, showing which statement allowed or denied.
- IAM Access Analyzer: Policy validation (syntax, security warnings, suggestions), custom policy checks, external access findings, unused access findings, and policy generation from CloudTrail activity to build least-privilege policies.
- IAM Access Advisor (last accessed data): Shows services and actions last used, helpful to refine permissions and SCPs.
- AWS Config and Security Hub: track policy configuration changes that may have introduced a denial.

A Systematic Troubleshooting Approach
1. Confirm it is authorization, not authentication (check the error code).
2. Identify the principal from CloudTrail userIdentity (note the assumed role session, not just the user who assumed it).
3. Identify exact action and resource ARN.
4. Read the error message or decode it to learn the policy type.
5. Check for explicit denies: SCP, RCP, resource policy, boundary, session policy, VPC endpoint policy.
6. Check for an allow: identity policy and, where relevant, resource or key policy (both sides for cross-account).
7. Evaluate condition keys against request context.
8. Apply the narrowest fix and validate with Policy Simulator or Access Analyzer.

Exam Tips: Answering Questions on Analyzing Authorization Failures
- Explicit deny beats everything. If any answer mentions an explicit deny in an SCP or bucket policy, an allow elsewhere cannot override it. Look for the answer that modifies or scopes the deny.
- SCPs do not grant. An answer suggesting 'add an Allow to the SCP' only helps if the SCP is the restricting layer; the identity policy still needs an allow. SCPs never affect the management account or service-linked roles.
- Cross-account means two allows. When a role in Account A cannot read a bucket or KMS key in Account B, check both the identity policy in A and the bucket/key policy in B.
- Encrypted resource = check KMS. If S3 or Secrets Manager access fails despite correct S3 permissions and SSE-KMS is used, the answer usually involves the KMS key policy or kms:Decrypt.
- VPC endpoint + aws:SourceIp = trap. Requests through a gateway or interface endpoint carry private addresses; the correct fix is aws:SourceVpce or aws:SourceVpc.
- Encoded message from EC2 points to sts decode-authorization-message.
- 'Determine which permission is missing with the least effort' typically maps to CloudTrail plus enhanced error messages, Policy Simulator, or Access Analyzer policy generation.
- 'Generate a least-privilege policy based on activity' maps to IAM Access Analyzer policy generation.
- 'Detect repeated access denied attempts' maps to CloudTrail with CloudWatch metric filters and alarms, or GuardDuty findings for suspicious API patterns.
- Permission boundaries: when a delegated admin created a role that cannot perform an action allowed by its policy, suspect the boundary.
- iam:PassRole is the classic answer when a user cannot launch an instance with a role or create a Lambda function.
- Reject overly broad fixes. Answers granting AdministratorAccess, Principal '*', or removing all SCPs are almost always wrong on this exam.
- Distinguish error types. SignatureDoesNotMatch, ExpiredToken and InvalidClientTokenId are authentication problems; do not pick a policy change for them.
- S3 cross-account uploads where the bucket owner cannot read objects: choose S3 Object Ownership set to Bucket owner enforced.
- Read every condition key in policy snippets: MFA, time, tags, region, org ID, secure transport. The failing condition is often the hidden answer.

Summary
Analyzing authorization failures combines knowledge of the IAM policy evaluation logic with practical use of CloudTrail, decoded messages, Policy Simulator and IAM Access Analyzer. On the exam, identify the layer causing the denial, remember that explicit deny wins and cross-account requires both sides, watch for KMS and condition-key traps, and always choose the most precise, least-privilege remediation.
Test mode:
More Analyzing Authorization Failures questions
23 questions (total)