RED-TryHackMe
Note: I completed this machine in different chunks of time. That’s why the IP of the victim machine is different.
Nmap Scan
Two open ports were found. SSH opened at port 22 had 8.2, I simply ignored it because it was one of the latest versions of SSH. Next one was port 80 on which http is running. That means I had to get initial access through the web.
When I ran scripts of nmap, I found an interesting thing which was LFI.
I ran 10.10.194.228/index.php?page=file:///etc/passwd and found content of /etc/passwd file.
Here two users found i.e red and blue.
I tried to open .ssh, bash_history. Fortunately, the bash_history directory gave me some text. I found a hashcat command running having a rule for creating different passwords from one password.
I opened the .reminder file and found a password.
I tried this password to login blue and red users through this password found in .reminder file but couldn’t.
I used the below command to create passwords using the rules of hashcat as shown below.
After that I bruteforce the ssh using this password list for a user named blue and found the password.
I logged in and got the first flag.
THM{Is_thAt_all_y0u_can_d0_blU3?}
Get A1iw4r3’s stories in your inbox
Join Medium for free to get updates from this writer.
Now I tried to get the red user but could not succeeded.
After some minutes shell got closed, I thought there were a script running behind which closed the session of blue user and change password which I got through brute forcing the SSH.
I again brute forced the SSH through hydra to get a new password.
After getting new session, I check the /etc/crontab for cronjob but couldn’t find any user defined script running.
I copied the pspy file to the victim machine to check the script running on it. Surprisingly I found a amazing thing that was bash reverse shell script running in background which was transferring shelling to redrules.thm.
I tried to send my machine with hostname “redrules.thm” into the /etc/hosts and succeeded.
I switched on the listening of netcat at port 9001 which was mentioned in bash reverse shell and got red user shell.
2nd flag is given below
THM{Y0u_won’t_mak3_IT_furTH3r_th@n_th1S}
After getting the second flag, I started privilege escalation, I looked the .git directory. I got into it and found pkexec file with suid.
I found the pkexec exploit at given github link, I just changed the path of pkexec at the end of the exploit.
https://github.com/Almorabea/pkexec-exploit/blob/main/CVE-2021-4034.py
Change the path
After transferring the exploit to the victim machine, I ran this exploit and got the root user shell.
Third flag is given below.
THM{Go0d_Gam3_Blu3_GG}








