Box Stats
Box Info | Details |
---|---|
Box Name : | Warzone |
Series : | Warzone |
Difficulty : | Medium |
Release Date : | 24 Oct 2020 |
OS : | GNU/Linux |
Maker : | AL1ENUM |
Download : | Warzone |
Summary
Hello all! This box took me around 5-6 hours to pwn it for real, it’s based on java stuff and i’ve no idea about java. I still don’t know how did i pwn it haha, i guess im very lucky. I suggest you to try it out for sure!! I’ll not say much now, let’s pwn it!
Enumeration/Reconnaissance
Let’s start as always with nmap.
1 |
|
Let’s start the enumeration with port 5000, if we check the source code of the main page we can see a cipher:
1 |
|
Tried some basic stuff like base64,rot13 etc but no luck. I fired up my favorite Cipher Identifier Lot of results, i tried them all but only 1 worked the Rail fence cipher!
Tried the GET AUTH CREDENTIALS
with lot of ways like GET-AUTH-CREDENTIALS
but no luck, in the end was a path haha.
http://$ip:5000/get/auth/credentials
We can see a table with usernames & encrypted passwords:
Let’s move now into FTP enumeration since we have anonymous allowed, we can see 2 files a .txt
& .jar
one. Let’s download them.
1 |
|
Note.txt: Attention, please encrypt always your password using the warzone-encrypt.jar
The .jar
file is a compressed version of java class files. If we run it asks from us to enter a password to encrypt it:
1 |
|
Shell as commando
Now we need a java decompiler to move on, to understand the code of it and reverse it. I’ve no idea about java and stuff so i googled for one and i found this one JD-GUI You can simply install it using this command: apt-get install jd-gui
decompiler
: takes a compiled application and produces source code
There are 3 interesting stuff here:
Main.class
has the main code that encrypt the password:
AES.class
has the background code that does all the job:
Obfuscated.class
has the IV & the key:
We have to rewrite the Main.class
& change the AES.class
to decrypt. As i said i have no idea about java, never coded in my life but with lot of google and basic java tutorials i found the solution. Also eclipse helped me a lot, fixed my mistakes haha.
You can download eclipse from here Eclipse primary use is for developing java applications.
I googled for similar codes that do AES decrypt and i found the perfect example that helped me a lot! link
Let’s open eclipse and create 2 classes, the Main & AES. Let’s work on AES first. Copy & Paste all code until the void init()
Also remove the import Other.Obfuscated;
We will change this code:
1 |
|
Into this with the help of the article & eclipse that fixed the variables & added throws:
1 |
|
Now let’s move into Main, that will go like this:
1 |
|
You can find full codes here: Main.class AES.class
Now we can get the plaintext passwords:
1 |
|
Now we save the all usernames into a file and the passwords too and we perform a brute force attack on SSH:
1 |
|
We have shell as commando!
1 |
|
Shell as captain
Under /home/captain/Desktop
there is a hidden .crypt
directory:
1 |
|
readme.txt
says this message:
Hey captain i gave you the scripts that i run to encrypt my password, it's exactly the same process
and exactly the same path under our Desktop
I do the same for your password, don't run it again trust me.
-Your friend root
The python script:
1 |
|
We can really easy reverse it, .c
contains the encrypted password. First install the simplecrypt module: pip3 install simple-crypt
We can see that after encryption there is a base64 encoding so we have to first base64 decode and then decrypt. The final code:
1 |
|
1 |
|
We have the password of captain and we can switch:
1 |
|
Shell as root
If we check sudo -l
we can run jjs
as root:
1 |
|
gtfobins provide the answer, but sudo
doesnt work just crash the shell. So we have to do the file read way. Before in readme.txt
we can see this exactly the same path under our Desktop
so we can read root’s .c
file!
1 |
|
1 |
|
We use the same script to decrypt it and we have shell as root:
1 |
|
1 |
|
Reading the flag(s)
1 |
|
One of the BEST vulnhub boxes i ever did.
Thank You
Thank you for taking the time to read my writeup. If you don’t understand something from the writeup or want to ask me something feel free to contact me through discord(0xatom#8707) or send me a message through twitter 0xatom
Until next time keep pwning hard!