Cross-Account Security Patterns, EC2 Instance Metadata Service v2 (IMDSv2), AWS Systems Manager Session Manager, and AWS STS mechanics — four topics that sit at the literal BOUNDARY where an identity crosses from one trust zone into another: account to account, instance to credential, operator to instance, and caller to assumed role. This is some of the most consistently and specifically tested material on the exam, and almost none of it has its own dedicated AWS service name — it's mechanism knowledge.
ExternalId is the fix.169.254.169.254). If a web app on that instance has an SSRF vulnerability, an external attacker can trick the app into fetching those credentials FOR them — unless the metadata service requires a session token that SSRF payloads typically can't obtain.These four topics rarely appear as their own standalone question — they show up EMBEDDED inside scenarios about other services (a Lambda function calling a third party's API, an EC2 instance running an internet-facing app, a help-desk engineer needing instance access, an enterprise federating into a partner's AWS account). The exam expects you to recognize the underlying mechanism even when the scenario is dressed up as something else entirely.
| Domain | Where This Bundle Shows Up |
|---|---|
| Identity & Access Management | The centerpiece — confused deputy, ExternalId, STS session mechanics, role chaining |
| Infrastructure Security | IMDSv2 enforcement, SSRF mitigation, Session Manager replacing SSH/bastion architecture |
| Threat Detection & Incident Response | CloudTrail-based accountability via source identity, detecting/responding to credential theft via SSRF |
| Management & Security Governance | Organization-wide IMDSv2 enforcement via Declarative Policies, centralized Session Manager logging |
A confused deputy being tricked into acting on an attacker's behalf across accounts; SSRF stealing EC2 instance-role credentials; SSH-based instance access requiring open ports, bastions, and key sprawl; uncontrolled role-chaining producing long-lived, untraceable sessions
Verify the true identity crossing each trust boundary, and minimize standing exposure (open ports, long sessions, unauthenticated metadata access) at each one
The Identity & Access Boundary Bundle
Require ExternalId on every third-party cross-account trust policy; enforce IMDSv2 account/org-wide with hop limit 1; remove port 22 from security groups in favor of Session Manager; require sts:SourceIdentity on sensitive role trust policies.
CloudTrail records every AssumeRole call (with source identity, when set) and every Session Manager session start; instance metadata defaults can be audited via Config/Trusted Advisor.
Rotate the ExternalId if suspected leaked; revoke active sessions via the aws:TokenIssueTime condition pattern; force IMDSv2-only on a compromised instance; terminate an active Session Manager session.
ExternalId exists specifically to solve the confused deputy problem in third-party cross-account role assumptionsts:SourceIdentity persists across an entire role chain, giving CloudTrail-based accountability even after multiple AssumeRole hopsExam appearance probability: HIGH
AssumeRole call, required via a sts:ExternalId condition on your role's trust policy — without the correct ExternalId, the AssumeRole call fails even if the calling principal matches+ = , . @ : / -), no whitespace.169.254.169.254X-aws-ec2-metadata-token-ttl-seconds) — most SSRF vulnerabilities only allow the ATTACKER to induce a GET request and cannot set custom headers or issue PUT requests, making IMDSv2 resistant to the classic SSRF-to-credential-theft chainmodify-instance-metadata-defaults (--http-tokens required --http-put-response-hop-limit 1); per-instance via modify-instance-metadata-options; SCPs can deny launching instances without IMDSv2 required; Organization Declarative Policies (introduced December 2024) can enforce IMDSv2 as a non-overridable ORG-WIDE defaultAssumeRole, configurable up to the role's own maximum session duration settingDurationSeconds greater than 1 hour, the operation FAILS — chained sessions are hard-capped at 1 hour regardless of any role's configured maximumsts:SourceIdentityAn optional, settable value at the FIRST AssumeRole call that PERSISTS across the entire subsequent role chain — lets CloudTrail logs attribute actions taken deep into a chain back to the originally authenticated identity, even after several hops. Can be required via a role trust policy conditionGetSessionToken vs AssumeRole vs GetFederationTokenGetSessionToken — temporary creds for the SAME IAM user/root, mainly to enable MFA-protected API calls. AssumeRole — temporary creds for a DIFFERENT role, the standard cross-account/federation mechanism. GetFederationToken — temporary creds for a federated user identity without an existing IAM identity, scoped by a session policyaws:TokenIssueTime condition key (effectively revoking everything issued before a given point)TokenIssueTime-based deny policy (or waiting for natural expiration) actually revokes it.Requirement → Keywords → Expected Answer → why every distractor fails.
Require ExternalId on the role's trust policy
| Distractor | Why it's wrong |
|---|---|
| Restricting the trust policy's Principal to the vendor's account ID alone | Necessary but NOT sufficient — it doesn't prevent the vendor's own system from confusing which of ITS customers' sessions should map to your role, which is the actual confused-deputy risk ExternalId addresses |
Enforce IMDSv2 (require session tokens)
| Distractor | Why it's wrong |
|---|---|
| Removing the instance's IAM role entirely | Breaks legitimate application functionality that depends on that role — IMDSv2 solves the SPECIFIC theft vector without removing needed permissions |
| Patching the SSRF vulnerability only | Defense-in-depth principle — IMDSv2 is the layer that limits BLAST RADIUS even before/if the underlying app vulnerability is fixed |
AWS Systems Manager Session Manager (standard interactive session, with logging enabled)
| Distractor | Why it's wrong |
|---|---|
| A bastion host with SSH key management | Requires open inbound ports (even if just to the bastion) and ongoing SSH key lifecycle management — exactly what Session Manager is designed to eliminate |
| Session Manager via port forwarding | Provides the port-less access, but does NOT provide content-level audit logging — fails the "full audit trail" requirement specifically |
Attach/update an IAM policy denying access based on aws:TokenIssueTime
| Distractor | Why it's wrong |
|---|---|
| Deleting the IAM role's access keys | Has no effect on already-issued STS session tokens — they remain valid until natural expiration regardless of what happens to long-lived access keys |
sts:SourceIdentity, set at the first AssumeRole and persisting through the chain
| Distractor | Why it's wrong |
|---|---|
| The session name on the final AssumeRole call alone | Only reflects the immediate caller of the LAST hop, not the originally authenticated identity from the start of the chain — source identity is specifically designed to persist across the whole chain where session names don't |
IMDSv2 enforcement (requiring tokens) and the hop limit are TWO SEPARATE controls — requiring tokens alone doesn't prevent a stolen token from being relayed beyond the instance if the hop limit is left at a permissive value, and a restrictive hop limit alone doesn't prevent unauthenticated GET-based theft if tokens aren't required. Both should generally be configured together.
sts:SourceIdentity on sensitive role trust policies to preserve attribution through role chains| Misconception | Reality |
|---|---|
| "Restricting a role's trust policy Principal to a specific account ID is sufficient cross-account protection" | Insufficient alone for third-party, multi-tenant scenarios — ExternalId is the additional control needed to prevent confused-deputy-style cross-customer confusion on the THIRD PARTY's side |
| "IMDSv2 enforcement protects Lambda functions from credential theft too" | False — Lambda doesn't use EC2 IMDS at all; this setting is entirely irrelevant to Lambda's credential model |
| "All Session Manager sessions are fully content-logged by default" | False — port forwarding and SSH-tunneled sessions are explicitly NOT content-logged, due to end-to-end encryption within the tunnel; only session-initiation metadata is captured via CloudTrail |
| "Deleting an IAM role's access keys revokes any active STS sessions using that role" | False — STS session tokens remain valid until natural expiration; only a TokenIssueTime-based deny policy can forcibly invalidate already-issued sessions |
| "You can chain roles indefinitely with each chain hop using its own full configured session duration" | False — role chaining caps the session duration at 1 hour maximum, regardless of any individual role's own configured maximum |
| Comparison | What actually differs |
|---|---|
| ExternalId vs restricting trust policy Principal | Solves confused deputy across MULTIPLE customers of the same third party vs only verifies the calling ACCOUNT is correct — necessary but not sufficient alone in multi-tenant scenarios |
| IMDSv1 vs IMDSv2 | Unauthenticated GET request, trivially SSRF-exploitable vs token-based PUT-then-GET flow, resistant to most SSRF payload patterns |
| IMDSv2 token requirement vs hop limit | Blocks unauthenticated credential RETRIEVAL vs blocks a retrieved token from being RELAYED beyond the first network hop — complementary, not redundant |
| Session Manager standard session vs port forwarding/SSH session | Content fully logged (if enabled) vs content NOT logged due to end-to-end tunnel encryption, only initiation metadata captured |
| AssumeRole vs GetSessionToken vs GetFederationToken | Temporary creds for a DIFFERENT role (cross-account/federation) vs temporary creds for the SAME identity (mainly for MFA-gated calls) vs temporary creds for a federated user with no existing IAM identity |
Click card to flip. Mark right or wrong to track score.
SCS-C02 scenario style, Easy → Specialty. Select an answer to reveal the explanation.