You’ll find this vm in Vulnhub https://www.vulnhub.com/entry/adroit-101,647/
Also to HackMyVm https://hackmyvm.eu/machines/machine.php?vm=Adroit
- Difficulty : Hard
- Hint : just one useless little dot
Youtube Video
Useful tools
- sudo apt-get install jd-gui (must)
- sudo apt-get install openjdk-11-jdk (optionally)
- eclipse IDE Java Developer (optionally)
Port Scan
FTP
reading the structure.PNG
We are able to collect important information from the image the vm running mysql
and the database name is adroit
Jd-gui, reading the adroitclient.jar
- From
AdroitClient.class
we have got the secret, the credentials and the hostname
- Edit
/etc/hosts
1 |
|
MySQL UNION injection
- Syntax
1 or 1=1 UNION ALL SELECT NULL,concat(TABLE_NAME) FROM information_schema.TABLES WHERE table_schema='adroit'--
Reading columns names from the users table_schema
- Syntax
1 or 1=1 UNION ALL SELECT NULL,concat(column_name) FROM information_schema.COLUMNS WHERE TABLE_NAME='users'--
Reading username and password from table users
- Syntax
1 or 1=1 UNION ALL SELECT NULL,concat(0x28,username,0x3a,password,0x29) FROM users--
Decrypting the password ( AES encryption )
username : writer
encrypted password : l4A<REDACTED>Kr015+OEC3aOfdrWafSqwpY=
- Note You are able to decrypt the password using online tools or other languages.
Eclipse
- File -> New -> Java Project -> Project name :
Decrypt
-
Expand the
Decrypt
project file -> Choose thesrc
file + right click -> New -> Class -> Name :Cryptor
- Back to
jg-gui
, we open again theadroitclient.jar
, we copy the whole classCryptor
and we paste it to our Eclipse Cryptor class
Cryptor.class
Creating the Main class
- Expand the
Decrypt
project file -> Choose thesrc
file + right click -> New -> Class -> Name :Main
, check the checbox toinclude static main
- Result
1 |
|
- Hint : one 0 in not 0 but O
So, the writer he changed
one character of the encrypted password to avoid the unwanted decryption The encrypted password contains two zeros, after changing the substring Kr0
to KrO
it returns the password
- previous encrypted password :
l4A<REDACTED>Kr015+OEC3aOfdrWafSqwpY=
- correct encrypted password :
l4A<REDACTED>KrO15+OEC3aOfdrWafSqwpY=
UPDATED Main.class
-
Result :
just.write<REDACTED>
-
SSH Connection, user.txt
Root priv esc
The user writer he is able to run the testingmyapp.jar
under the /tmp
dir as root If we check the /tmp dir there is no file named testingmyapp.jar. So, we are able to create our malware
reverse shell testingmyapp.jar
ECLIPSE Creating our testingmyapp.jar
- File -> New -> Java Project -> Project name :
testingmyapp
- Expand the
testingmyapp
project file -> Choose the src file + right click -> New -> Class -> Name :Explo
Explo.class Reverse shell
WAY TO ROOT
Changing compiler level
First we need to change java compiler version of the testingmyapp
project from 14
to 11
, because the Adroit vm can execute jar file with 11
version
Export testingmyapp to testingmyapp.jar
- Click on the testingmyapp -> Right click -> Export -> Java -> Runnable JAR file -> Launch configuration -> Explo - testingmyapp -> Finish
Uploading the testingmyapp.jar to the adroit machine
- My machine
- Adroit machine
Final Step
- Adroit machine
- Adroit machine
- Adroit vm created by me, i enjoy the Process.