scr1++y

Writeups for CTF Challenges

View on GitHub

UltraTech by lp1

IP = 10.10.186.15*
Difficulty: Medium
Machine OS: Linux
Learning Platform: tryhackme.com
Finished on: Arch Linux

*Note: IP address may vary.

Reconnaissance

Scoping and Preparation

Preliminary Enumeration via nmap

Table 1.1: nmap Results Summary

PORT STATUS SERVICE VERSION
21/tcp open FTP vsftpd 3.0.3
22/tcp open SSH OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
8081/tcp open HTTP Node.js Express framework
31331/tcp open HTTP Apache httpd 2.4.29 ((Ubuntu))

Nmap Scan

Machine OS: Based on OpenSSH version, machine is Ubuntu Bionic.

Enumeration

FTP Enumeration

FTP RDoS

Manual Web Enumeration

Webpage at port 8081

Webpage at port 31331

what html

Note: Manual Enumeration is important.

Web Enumeration using GoBuster

auth endpoint

GoBuster Scan Results

api.js

api.js contents

Tip: When in doubt, search it in Google.

Exploitation

Steps to reproduce:

  1. Navigate to ultratech:8081/ping and add the parameter ip as seen in the api.js file.

  2. Input the payload: ?ip=localhost

    Testing command injection

  3. Command injection works and should output a ping request to localhost.

  4. Input the payload: ?ip=localhost `ls`

    ls

  5. It should list the files/directories in the current user.

  6. Input the payload: ?ip=localhost `cat utech.db.sqlite`. It should output the content of utech.db.sqlite file containing user hashes.

    creds

  7. Go to CrackStation to see if the hashes are cracked.

  8. Input the hashes you found on utech.db.sqlite file to the input box in CrackStation.

    admin hash cracked

    r00t hash cracked

  9. Save the credentials in a file.

  10. Try logging in the credentials in either SSH or FTP. In this case, SSH is used to login.

    r00t user SSH login

Privilege Escalation / Post-Exploitation

Internal Enumeration

Table 1.2: Checklist for Linux Internal Enumeration

COMMAND DESCRIPTION  
ss -tlnp lists all sockets (-t = tcp) (-l = listening) (-n = numeric) (-p = processes)  
netstat -tulnp    
sudo -l lists all binaries/files/programs the current user has sudo permissions. (might require password)  
find / -type f -user root -perm -u+s 2>/dev/null finds files in / directory that has SUID bit set. If any, consult GTFOBins.  
uname -a prints system information (-a = all)  
whoami && id prints effective userid (EUID) and prints real and effective userid and groupids (GID).  

Notes: For more information about the commands look here Tip: When nothing else makes sense, try to use LinPEAS (winPEAS for windows machines.).

Docker Group

Vertical Privilege Escalation

Finished

STATUS: ROOTED

The next two steps are not necessary for completion of the machine but it completes the 5 Phases of Penetration Testing.

Post Exploitation / Maintaining Access

Clearing Tracks

Status: Finished

Feel free to reach out and if there is something wrong about the above post. Feedbacks are also appreciated :D

Donation Box

Not required but appreciated :D

ko-fi

"Buy Me A Coffee"

Socials

<– Go Back