Cloud IAM: policy scope and AssumeRole chain
The SOC team detected access without MFA into an AWS account from an unknown IP address outside the corporate network (10.20.0.0/16) using a leaked static AKIA... key. In the account, CloudTrail is enabled only for Management Events (control plane: sts:AssumeRole and IAM/management calls), and S3 Data Events logs were not recorded.
You are given the cloud_iam_audit.zip package:
cloudtrail/events.json.gz— CloudTrailRecordslog (corporate background traffic and attacker actions);iam/policies_snapshot.json— IAM users, roles (Tags,TrustPolicy,AttachedPolicies,InlinePolicies), managed policies (ManagedPolicies), and S3BucketPolicies;s3_objects/<bucket>/<key>.b64— base64-encoded JSON copies of S3 objects (containing many decoy tokens).
Task: first, trace the successful sts:AssumeRole chain (responseElements.credentials.accessKeyId -> userIdentity.accessKeyId) performed without MFA from an external IP in the CloudTrail log to determine the roles assumed by the attacker and the session context (aws:SourceIp, aws:MultiFactorAuthPresent, aws:PrincipalTag/clearance). Then, evaluate the role and bucket policies according to AWS IAM evaluation rules (Explicit Deny > Explicit Allow > Implicit Deny, wildcard *, NotAction, Condition operators: StringEquals, StringNotEquals, StringLike, Bool, IpAddress, NotIpAddress) to find the only S3 object that the attacker could read with s3:GetObject. Decode the object from base64 and obtain the audit_token value. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).