Good Evening Guys,
We, Securium Solutions will be posting Walk-through of several CTF machines in the upcoming days. Stay tuned for latest updates.
Today we started our CTF series with a beginner level CTF machine named as FristiLeaks-1.3
Go through all the steps for clear understanding.
Switched on the Vulnerable Fristi Machine, then did Ping Sweep from Kali Machine with the help of Nmap tool to detect the IP of the vulnerable machine and found it with the help of very low latency. “nmap -sP IP”
![FristiLeaks:1.3 – CTF [SOLVED] 1 Screenshot from 2020 01 09 15 55 48](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-15-55-48.png)
Used the target IP with Directory Buster and nmap to find the Directories and open ports and services running on the target machine.
![FristiLeaks:1.3 – CTF [SOLVED] 2 Screenshot from 2020 01 09 16 02 07](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-02-07.png)
![FristiLeaks:1.3 – CTF [SOLVED] 3 1](https://securiumsolutions.com/wp-content/uploads/2020/01/1.png)
It is found that it is having robots.txt and port 80 is open with http server running in it. Tried to gather some information from those.
In robots.txt, three directories were found with the same picture and nothing found in page source and in the images also.
![FristiLeaks:1.3 – CTF [SOLVED] 4 Screenshot from 2020 01 09 16 03 39](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-03-39-1024x576.png)
![FristiLeaks:1.3 – CTF [SOLVED] 5 Screenshot from 2020 01 09 16 04 07](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-04-07-1024x576.png)
I tried to find some info from the picture if it has something, but end up with nothing.
![FristiLeaks:1.3 – CTF [SOLVED] 6 Screenshot from 2020 01 09 16 06 14](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-06-14.png)
Then i tried to access the http server which is running on port 80 through browser by using IP in URL.
![FristiLeaks:1.3 – CTF [SOLVED] 7 Screenshot from 2020 01 09 16 12 25](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-12-25-1024x576.png)
When i Tried to view the page source, i found an user named “eezeepz“
![FristiLeaks:1.3 – CTF [SOLVED] 8 Screenshot from 2020 01 09 16 12 47](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-12-47-1024x576.png)
In the same page i found a base64 encoded file, decoded it but i thought it will be a text file then i came to know it’s an png file. So i renamed it and end up with a picture contains multiple number of K
![FristiLeaks:1.3 – CTF [SOLVED] 9 Screenshot from 2020 01 09 16 14 04](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-14-04-1024x576.png)
![FristiLeaks:1.3 – CTF [SOLVED] 10 Screenshot from 2020 01 09 16 15 31](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-15-31.png)
I used online OCR coverter to convert the picture into plain text.
![FristiLeaks:1.3 – CTF [SOLVED] 11 Screenshot from 2020 01 09 16 16 14](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-16-14-1024x576.png)
We can easily guess there is a directory called fristi, because first page of the server indicates the words there itself, then I used the found username eezeepz and password of KeKkeKKeKKeKkEkkEk
![FristiLeaks:1.3 – CTF [SOLVED] 12 Screenshot from 2020 01 09 16 16 31](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-16-31-1024x576.png)
I got a File upload feature right at my face after login with upload restrictions.
![FristiLeaks:1.3 – CTF [SOLVED] 13 Screenshot from 2020 01 09 16 17 30](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-17-30-1024x576.png)
I used a PHP reverse Shell Script from online source but end up with a very unstable shell through NetCat
![FristiLeaks:1.3 – CTF [SOLVED] 14 Screenshot from 2020 01 09 16 17 38](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-17-38-1024x576.png)
Then I used msfvenom for php payload then used with the different extension of .php.png to bypass upload restrictions. Then listened in msfconsole for the reverse shell, got the meterpreter of the machine easily…Kudos to MSF ….lol
![FristiLeaks:1.3 – CTF [SOLVED] 15 Screenshot from 2020 01 09 16 24 56](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-24-56-1024x576.png)
REMEMBER: File name of your payload is important to run your payload in the browser from the /uploads folder.
![FristiLeaks:1.3 – CTF [SOLVED] 16 Screenshot from 2020 01 09 16 25 27](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-25-27-1024x576.png)
It is clear that we have our uid=apache, so we need to find a way to escalate our privileges to root. I found a file notes.txt in the /var/www folder, there i was guided to home directory.
![FristiLeaks:1.3 – CTF [SOLVED] 17 Screenshot from 2020 01 09 16 37 20](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-37-20-1024x576.png)
In the home directory I found three directories such as Admin, eezeepz, fristigod. In eezeepz directory another notes.txt in which its stated about the privileges that I can use like chmod, cat, echo and some other commands.
![FristiLeaks:1.3 – CTF [SOLVED] 18 Screenshot from 2020 01 09 16 40 01](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-40-01-1024x576.png)
It is also written that normal user have an option to run any file with root permission if we can save a binary file in the /tmp folder with the name of “runthis”. The script will run with root privileges every minute.
![FristiLeaks:1.3 – CTF [SOLVED] 19 Screenshot from 2020 01 09 16 41 37](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-41-37-1024x576.png)
What I did here, I Just gave the Admin Folder Permission to 777 by adding a small script in a file and saved it in the /tmp folder, So when it is executed Admin folder can be accessible by anyone, Obviously US(Attacker).
![FristiLeaks:1.3 – CTF [SOLVED] 20 Screenshot from 2020 01 09 16 49 23 1](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-49-23-1.png)
Now I got the privilege to access the home folder with ease, then I found three sensitive files such as cryptpass.py, cryptedpass.txt, whoisyourgodnow.txt
![FristiLeaks:1.3 – CTF [SOLVED] 21 Screenshot from 2020 01 09 16 49 02](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-49-02.png)
In cryptedpass.py I found that the other two files are encrypted with base64 and rot13.
![FristiLeaks:1.3 – CTF [SOLVED] 22 Screenshot from 2020 01 09 16 55 48](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-16-55-48.png)
![FristiLeaks:1.3 – CTF [SOLVED] 23 Screenshot from 2020 01 09 18 39 10](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-18-39-10.png)
This is where I got some help from online resources to crack this encoding with the help of python code. LOL
The code for decoding the encryption is mention in the below screenshot.
![FristiLeaks:1.3 – CTF [SOLVED] 24 Screenshot from 2020 01 09 18 45 11](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-18-45-11.png)
![FristiLeaks:1.3 – CTF [SOLVED] 25 Screenshot from 2020 01 09 18 49 41](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-18-49-41.png)
We can use python shell also for decrypting it and found another password which is possibly would be fristigod user password
![FristiLeaks:1.3 – CTF [SOLVED] 26 Screenshot from 2020 01 09 17 02 22](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-17-02-22.png)
When I try to SU fristigod, i came to know i can use it only on tty shell.
![FristiLeaks:1.3 – CTF [SOLVED] 27 Screenshot from 2020 01 09 17 04 03](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-17-04-03.png)
Then i used the tty shell command to open a tty shell python -c ‘import pty; pty.spawn(“/bin/sh”)’
Then I used SU to upgrade my privilege.
![FristiLeaks:1.3 – CTF [SOLVED] 28 Screenshot from 2020 01 09 18 59 08](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-18-59-08.png)
In the directory of fristigod, there are two hidden files one is the bash_history file in that we can know that doCom folder from the path /var/fristigod is executing with root privileges.
![FristiLeaks:1.3 – CTF [SOLVED] 29 Screenshot from 2020 01 09 17 10 26](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-17-10-26.png)
Navigating to /var/fristigod and executing that file with sudo permission using fristi privileges and changing the permission to root privileges (ie. 777)
![FristiLeaks:1.3 – CTF [SOLVED] 30 Screenshot from 2020 01 09 19 02 24](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-19-02-24.png)
Then Navigated to root directory to extract the final flag which is named as fristileaks_secrets.txt. cat the file to read the final flag as Y0u_kn0w_y0u_l0ve_fr1st1
![FristiLeaks:1.3 – CTF [SOLVED] 31 Screenshot from 2020 01 09 17 16 36](https://securiumsolutions.com/wp-content/uploads/2020/01/Screenshot-from-2020-01-09-17-16-36.png)
Finally Cracked First machine for securium solutions.
We hope we can see lots and lots of CTF walkthrough in the upcoming days, stay tuned guys.
Bye Bye, Meet you with another blog.
Thank you, Have a nice day.