Mr Robot CTF

Date: 21, May, 2021

Author: Dhilip Sanjay S


Click Herearrow-up-right to go to the TryHackMe room.

Enumeration

Nmap

nmap -sC -sV -p- 10.10.79.200 -oN nmap-initial
Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-21 11:07 IST
Nmap scan report for 10.10.79.200
Host is up (0.19s latency).
Not shown: 65532 filtered ports
PORT    STATE  SERVICE  VERSION
22/tcp  closed ssh
80/tcp  open   http     Apache httpd
|_http-server-header: Apache
|_http-title: Site doesnt have a title (text/html).
443/tcp open   ssl/http Apache httpd
|_http-server-header: Apache
|_http-title: 400 Bad Request
| ssl-cert: Subject: commonName=www.example.com
| Not valid before: 2015-09-16T10:45:03
|_Not valid after:  2025-09-13T10:45:03

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 905.32 seconds

Gobuster

Mr Robot CTF - Home

Wappalyzer

Wappalyzer - Technologies identified

phpmyadmin

Php My Admin - Not accessible

WordPress

WordPress Home - http://10.10.79.200/0/

Key 1

  • Visit robots.txt or robots:

  • Now we have the clue to obtain the key 1:

  • Let's curl it down:

Wpscan

Bruteforcing Wordpress login

fsocity.dic

  • In the robots.txt, we also find a dictionary file.

  • On downloading, we find that it looks like some username/password file.

Identifying username

  • If you have watched Mr.Robot, you know that Elliot is the name of the protagonist.

  • So, I enter Elliot:something as the username and password.

  • And I was able to confirm that an user named Elliot existed.

Username Elliot

Using wpscan

  • We know the username. We need to bruteforce the password.

  • We can use fsocity.dic as the wordlist. But the file is very large.

  • Try to fetch only the unique values using sort -u.

  • Apparently, the file size was drastically reduced (8.5 lakh values -> 11K values). Easy for bruteforcing!

  • Using wpscan for bruteforcing the password:

Accessing the admin panel

  • Login using Elliot:REDACTED credentials to access the admin panel.

Wordpress Admin panel

Reverse Shell

  • Modify 404.php or any other page of the theme and add reverse shell code.

Adding Reverse Shell Code in 404.php
  • Listen on the appropriate port using nc to obtain a reverse shell:

  • Upgrade the shell

Key 2

  • The key 2 file is located in robot user's directory.

  • But the permission is denied.

  • Still we can find the md5 hash of robot's password.

  • Cracking the hash using hashcat:

  • Switching to robot user using the cracked password & obtaining the key:


Privilege Escalation

  • Robot user doesn't have sudo rights:

Running linpeas

  • Linpeas gave away the Privilege Escalation vector easily: nmap

Using Nmap for Priv Esc

  • By running nmap in interactive mode, we can spawn a shell using !sh.

  • Since the SUID bit is set, the spawned shell will have root access.


Key 3


References

Last updated