TryHackMe — IDE
[Room: https://tryhackme.com/room/ide]
[Level: Easy]
(Note to self: explore new tools)
As always, we begin with a rustscan on the target ip and all the ports.
Let’s break down the command:
-a : ip address of victim
-r : range to ports to scan
— accessible : a nice way to not print the banner (Not required)
There are 4 open ports (21,22,80,62337). The next step is to check what services are running on those ports.
Few interesting things:
— ftp(21) allows anonymous login
— http(62337) is running on non-standard port
We start with ftp to see if there are anything of note.
Both username and password are ‘anonymous’.
There is a file named ‘-’. We download that to check its content.
(Note: Rename the ‘-’ file to something else or you won’t be able to read it.)
There seems to be two users: john and drac
john’s password seemed to have been reset.
Next we check the web server on port 62337 in browser(forgot to screenshot). There is a login page. If we use burpsuite to intercept the request, we can see than a POST request is being made to controller.php(/components/user/controller.php).
The service seems to be cordiad 2.8.4. There is an RCE exploit for this service, but a username and a password is required. john’s password was reset, but I did not find the default password for this service. So, I bruteforced it using hydra.
Syntax:
hydra -l john -P /usr/share/wordlists/rockyou.txt <VICTIM_IP> -s 62337 -V http-form-post ‘/components/user/controller.php?action=authenticate:username=^USER^&password=^PASS^:Incorrect Username or Password’ -f -t 20The blurred part contains the password for the user. There is a exploit available for this service here. (I renamed it to ‘exploit.py’)
Download the exploit and execute it as follows:
python3 exploit.py [URL] [USERNAME] [PASSWORD] [YOUR_IP] [PORT_TO_LISTEN_ON] [PLATFORM]Then, it will tell you to run two commands. Open two different terminals and and run them.
Then, in the terminal where you executed the python script, type ‘y’.
If it is succesful, a shell will appear in the third terminal you opened.
Then, I navigated to /home and found one user, ‘drac’. Inside their home directory, the permission on the ‘.bash_history’ file is not something you would normally see. Normally, only users themselves will have access to their ‘.bash_history’ file.
Get Vin’s stories in your inbox
Join Medium for free to get updates from this writer.
When we read it’s content, it spits out the password for the user ‘drac’.
Before changing user to drac, we have to upgrade our shell. (here)
Question 1: user.txt
Our next step is to escalate our privilege. I found this privilege escalation vector.
The first step is to check if there is suid bit set in the binary ‘pkexec’.
We can use ‘find’ to do this. And there is.
Next, we have to check if the current user is in the sudo/admin group. We are.
I should now be able to use ‘pkexec’ to spawn a root shell, is what I thought.
It failed, but there is a work aroun for this.
We need to open two ssh sessions. For that, we will first have to generate ssh keys.
Now, copy the contents of the ~/.ssh/id_rsa file and paste it to a file in your attacker machine. We will use this file to open the ssh sessions.
Let’s change the permission on the file. I copied the content into ‘privkey’ file.
Now, we use that file to ssh into the victim machine as the user ‘drac’. We have to open two different sessions:
Now, we have to get the PID of our first ssh session:
Then, in the second session, we use ‘pkttyagent’ to start a textual authentication agent for the first ssh-session:
In the first session, we use pkexec to spawn a root shell.
In session 2, we will prompted for the user’s password.
After entering the password, there will be a root shell waiting for us in the first session.
Question 2: root.txt
Enjoy :)





![[IronHold] — Spring Boot Source Code Analysis: Finding Credentials, SQL Injection, PrivEsc, and…](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*2yaTo73YRGo1GknAUJNfPg.jpeg)



