CTF··3 min read

HTB Blocky

WordPress Enumeration and Exploitation

Privilege Escalation via SUID Binary

For another HTB path that turns an unsafe SUID executable into root access, compare HTB Irked Writeup: UnrealIRCd Backdoor to Root via SUID Abuse.

Begin with attaching IP address to domain:

nano /etc/hosts

Terminal window showing nano /etc/hosts with blocky.htb mapped to 10.10.10.37

Firstly, check 80,443,8080 ports + conduct automated reconnaissance

WordPress homepage of blocky.htb with blog posts and footer visible

Looks like Wordpress frontend. On meta part and footer it is observable

Terminal output of automated reconnaissance tool showing open ports and services

Let’s conduct port scan & fuzzing respectively.

use both at the same time ->

sudo nmap -sV -sC blocky.htb

Terminal output of sudo nmap -sV -sC blocky.htb showing open ports 21, 22, 80, 443, 25565

sudo nmap -sV -sC -T4 -p- blocky.htb

Faster results in 65535 ports

Terminal output of sudo nmap -sV -sC -T4 -p- blocky.htb showing all 65535 ports scanned with no additional services

No meaningful services.

Terminal output of enum4linux showing SMB shares and user enumeration results

To dive into SMB shares I conducted enum4linux scan.

Terminal output of wpscan showing WordPress version and plugins, including vulnerable plugin

There were no juicy findings.

Fuzzing matters ,but let me initially give a chance to wpscan

Clear RCE vector plugin can be seen below

Terminal output of dirsearch showing discovered directories including /plugins

Checking fuzz results:

dirsearch -u blocky.htb -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-medium-directories.txt

Interesting path -> /plugins

Terminal output of wpscan --url http://blocky.htb --enumerate u showing usernames notch and root

Apply --enumerate u so as to identify current users available on application:

wpscan --url http://blocky.htb --enumerate u

Terminal output of unzip or strings on a Java file showing root:pass credentials

Returning back to java files, I found a generic root:pass combination.

phpMyAdmin login page at http://blocky.htb/phpmyadmin with username root and password field

Upon that finding, I tried on SSH ,but still stucks. However, after a successful fuzzing operation, I saw phpmyadmin login.

phpMyAdmin interface showing user table with hashed password for user notch

Found user pass as hashed format.

Crackstation website showing hash input and no result found

Lets check via Crackstation

Could not determine

hashes.com website showing hash identification result as unknown or not found

I used hashes.com to identify regarding hash type

Terminal output of hash-identifier showing hash type as unknown or not identified

Use hash-identifier "$P$BiVoTj899ItS1EZnMhqeqVbrZI4Oq0/"

Terminal output of hashcat command attempting to crack hash with wordlist

Ready to brute via hashcat

Terminal output of hashcat showing no cracked password

hashcat -m 400 o.hash /usr/share/wordlists/sqlmap.txt

I was not successfuly. Instead, let me try to use password as SSH user notch

Terminal output of sudo -l showing notch can run all commands as root

GFTObins perfectly fine actually or I will figure out through linpeas.

Understand what commands can notch run ->

Terminal output of sudo -l showing notch can run all commands as root

ITS OK. Notch can run everything as Blocky (AKA ROOT) do.

sudo -u#-1 /bin/bash from HackTricks

Terminal output of sudo -u#-1 /bin/bash showing root shell prompt

I took root privileges as you can see above.

Find flags ->

Terminal output showing root shell with flag file contents
Terminal output showing root shell with flag file contents

May The Pentest Be With You ! ! !