Avengers Write up
Hello there fellow avenger, today I will help you walk through the Avengers Machine on TryHackMe:- https://tryhackme.com/room/avengers
It is a fairly easy machine, So let's begin
Avengers Assemble!!
Problem 1:- Cookies
There were 2 ways to get this flag;
and then we can open the /js/script.js URL to get flag1:-
Problem 2:- HTTP headers
Alright, for this problem we simply have to navigate to the Network tab of the developer's tool as done in the previous problem and look for the HTTP response header:-
After gathering the 2 flags I snooped around the website in order to find something of value;
and interestingly we found something that can be used somewhere:-
Looks like rocket left groot's password openly on the homepage
Problem 3:- Enumeration and FTP
After footprinting around the website a little we get into the next phase of hacking i.e. scanning and enumeration;
For this we will use our trusty friendly scanner called nmap
nmap -sC -sV <machine's IP> -oA <filename>
-sC - will do a script scan
-sV - will probe for open ports and services running on the machine
-oA will save the output of the scan in all formats
This is my personal preference for this machine, you can play around with nmap and try all different types of combinations
So, the output of our nmap scan looks something like this:-
We found that there are 3 ports open on this machine,
port 21- FTP
port 22 - SSH
port 80- HTTP
we login to FTP using the command:-
ftp <machine's IP>
We are asked for a login ID and password;
As we found Groot's password on the homepage we can try it to login on the FTP share
ID:groot
password: ********
and voila! We have access to the FTP shares of the machine
Navigate around the share and you can find flag3.
Problem 4:- Gobuster
Further enumeration requires us to list the directories hosted on the machine, for this, we'll use a fast and handy directory discovery tool called Gobuster.
Gobuster will brute force directories on the machine. It is a fast command-line tool.
the following command is used to perform directory discovery operation:-
gobuster dir -u http://<machine' IP>/ -w <preferred wordlist>
dir - dir tag is used to tell gobuster that we want to perform directory discovery
-u - this tag specifies the URL on which we want to perform an operation
-w - this tag specifies the wordlist we want to use
the output will look something like this:-
On checking out the all the URL's discovered by GoBuster;
/portal seems to be the one which has a login portal:-
Problem 5:- SQL Injection
SQL (Structured Query Language) is a database query language and SQL injection is a type of attack in which we manipulate SQL queries to reveal database name, table name, data present in the table columns such as usernames and passwords or we can simply manipulate the query to login on a website as we will do in this situation.
' OR 1=1 --
for username field as well as the password
This query will read out by the browser in the database as:-
select * from USERS where username = " 'OR 1=1 -- " and password = " 'OR 1=1 --"
which can be translated as "Hey database as you know 1=1 condition will always be true so let me login through this portal".
Problem 6:- Remote Code Execution and Linux
As we can see in the home page that we have a field that will execute commands remotely on the machine for us
We will check what directory are we working in using the pwd command:-
ls command will give the following output:-
ls command will display the files and folder present in our current directory i.e avengers directory
to check for all the hidden files and folder use ls -la command
The flag doesn't seem to be in this directory;
So we'll use cd command to change directories and concatenate it with ls command:-
Looks like we found flag5, now all we have to do is read it's contents.
But wait this machine has disabled cat command which is used to read the contents of a text file;
To overcome this problem we can use 2 ways;
1. cat command in reverse tac:-
2. We can also use less command which is an alternate to cat:-
Hence, this way we found the 5th flag and completed the box!!!

















Comments
Post a Comment