Welcome to YTUnity

One free SpiderTaz Network account works across every network site.

HackTheBox - Nimbus

IppSec Review 4 days ago

Description

00:00 - Introduction
00:59 - Start of nmap
01:45 - Checking out the Nimbus job scheduler, the healthcheck leaks aws.nimbus.htb which returns InvalidClientTokenId
03:16 - Submitting a job by URL, the server reaches back to us with python-requests, the URL must end in .yaml
04:05 - The preview prints a Python dict, explaining why single quoted keys and values point to Python (comparing JavaScript and PHP output)
08:38 - Trying SSRF against the Instance Metadata Service (IMDS), 169.254.169.254 is blocked but the octal encoding bypasses the filter
10:02 - Walking the IMDS metadata to iam/security-credentials and grabbing the nimbus-web-role keys, talking about ASIA vs AKIA keys
11:27 - Setting up an AWS CLI profile with the stolen session token and an endpoint_url of aws.nimbus.htb
12:59 - Enumerating AWS, S3 and Lambda are denied but we can list SQS queues and find nimbus-jobs on Floci
14:33 - We cannot receive messages from the queue but we can send them, thinking about how a job queue works
17:05 - Sending a PyYAML deserialization payload (python/object/apply os.system) into the SQS queue and getting a ping back
18:46 - Getting a reverse shell, then showing why ping without -c hangs the worker and blocks future jobs
20:30 - Reverting the box, getting a shell as worker in a container, and looking at worker.py which runs yaml.load on queue messages
24:20 - Finding the worker's long term AKIA keys in the environment and using them to receive messages from SQS
25:56 - Finding Floci on port 4566, using python -m json.tool to pretty print the health endpoint and seeing the huge list of services
27:29 - Explaining that CodeBuild is the vulnerable service and that there's not much pointing to it, talking about privilegedMode
28:51 - Creating a CodeBuild project with the floci image and privilegedMode, talking directly to Floci to bypass the IAM proxy
33:22 - Using batch-get-builds to see the BUILD phase failed with cannot exec in a stopped container
34:04 - Explaining BASH_FUNC_name%% exported functions (post Shellshock) to hijack the id command inside the build container
35:45 - Adding a BASH_FUNC_id%% environment variable to the project, first with a sleep, then echoing a non-root id so Floci's entrypoint stays running
40:01 - Building the modprobe container escape, grabbing the overlay upperdir out of /proc/mounts with sed
44:37 - Writing x.sh to add our SSH key to root, pointing /proc/sys/kernel/modprobe at it, and creating an invalid binary to trigger it
49:15 - The escape does not work, troubleshooting the payload, getting a reverse shell from the build container
54:51 - Fixing escaping and switching the magic bytes to octal 377 but still no luck
1:00:46 - Finding the typo, we never executed /tr, fixing it and getting SSH as root
1:02:00 - Looking at the overlay directory on the host to see the files our build container created

Featured creators

Creators on the SpiderTaz Network

Become a creator →