Week 1: OSINT Chalange Writeup
Intro
The first-week challenge covers the basics of OSINT research, opening remote connections and password cracking. I will try to cover most of the methods we can use to get through Jack’s cat and Ben’s secure passwords. Without further ado, let’s begin.
Challenge 1: Web Username
The first one was very tricky for me as I am not a cat person and don’t enjoy cat pictures… Anyway, as we go to the landing page, we can see that there are home(1) and login(2) pages and some information(3) about some employees.
As the challenge is OSINT related, we can try to find some accounts or any information on the internet related to these people. After a little bit of googling, I managed to find Dixon’s Twitter account. Following the chronology and the contest of the tweets, we can see that Dixon has started working for Insanity Accounting a while after he created his account. From one of the tweets, we can see a picture of his cat… and the username we were looking for on peace of paper under the cat……
Challenge 2: Web Hashed Password
The second challenge is more obvious. If we take a look over this tweet, we can see that Dixon messed up something and decided to share a link with us.
The link will take us to deleted tweet, but that doesn’t mean we can’t see it. By using WayBack we can see the content of the tweet.
And we got our second flag.
Challenge 3: What is Dixson’s password?
For challenge 3, we are given a new hash as the one from challenge 2 is incorrect.
To crack the hash we can use either hashcat
, johnny
, CrackStation, Cain&Abel
, etc. As hashcat
is the best password brute force tool, in my opinion, I will use it, but CrackStation will do just fine for this password.
|
|
Result: 9a900403ac313ba27a1bc81f0932652b8020dac92c234d98fa0b06bf0040ecfd:qwertyuiop
Challenge 4: User Flag
Great! We have credentials.
|
|
Now we can try logging in.
Sweet! eval()
= free shell.
By running the following code, we can execute commands on the target machine: eval('__import__("subprocess").getoutput("<COMMAND>")')
.
We can get the flag by running eval('__import__("subprocess").getoutput("cat /home/intern/user.txt")')
, but it would be more interesting if we get bind or reverse shell. There are many different ways of opening any of these shells, but as the system has nc
, I will go with it.
So, I will use reverse shell using ngrok to bypass my home router firewall and to keep my public IP private and pwncat
for more stable shell.
On our machine
|
|
On the victim’s machine
|
|
And voila! We have a shell. Even if the shell gets closed for some reason (internet drops, we press Ctl-C
by accident, etc.), the only thing we need to do is to open a new listener (pwncat -l 0.0.0.0 4444
), and we will get connected.
The only thing left is to get the user flag.
|
|
Challenge 5: Root Flag
Now, on the root flag!
No further enumeration is required than cat /etc/shadow
.
|
|
Great! We have hashed. Now, we can try some brute-forcing. However, this would get us nowhere unless we pay attention to the notes
left in the /home/intern/
directory.
|
|
Now we can use this info and hashcat rules to crack the password. So, if we already have one password we can use it as a template. Let’s begin with the names. We can put them into a wordlist.
|
|
Now we can use a little bit of hashcat-fu and generate a new wordlist from our names. For this purpose, we can use rules. If you are not familiar with hashcat rules, check out their documentation The rules I am going to use to generate the new wordlist are pretty much going to replace symbols like “s” with “$”, “a” with “4”, and so on. That is the content of the file I am going to use:
|
|
The command to generate it is:
|
|
And once we have generated our new wordlist, we can try brute-forcing the password with a mask attack that is going to look like this:
|
|
This mask will append -
or _
to the end of each word with folowing all the ears from 1900
to 2099
.
After less then a second we will have our result.
Result: $6$czitf7EkuZDKvo1G$Fzuxy.As6BxQhNyUV0zq9z0ehkb3yhzSAOFekJ1jpf.J3/3wJ.v.ARwzq28tQp2XEI81tl.hb6bWWY29JLxnX0:C0ll1n_1989
Now we just need the root flag.
Bare in mind that to be able to gain live shell (TTY), you need to run: /usr/bin/script -qc /bin/bash /dev/null
.
From there:
|
|