Agent Sudo
In my opinion, the Agent Sudo room on TryHackMe is one of the best rooms for beginners. It focuses on various things related to enumeration, steganography as well as reverse image searching. There were some things that even I encountered for the first time.
So, let's begin!
[Task 1] Author note
We don't need to do anything more than just deploying the machine for this task and get the IP address for the box.
[Task 2] Enumerate
1. How many open ports?
This can be found out by simply running annmap
scan on the target machine. The results of the scan would look somewhat like:
From the above results, we can count the number of open ports easily.
3. How you redirect yourself to a secret page?
We can visit the machine IP to check if we get some useful information over there.
And we do find the answer to the question directly at the homepage which says that we need to use our codename as theuser-agent
while sending theGET
request to the machine. This can be done using curl
.
4. What is the agent name?
We know that one of the agent's name is R, so we can first create a request with R as our user-agent and check if get some other information. Some of the curl requests that we can try to access the site are given below:
With all the first 3 requests we would still go to the site that opens up with default user-agent but with the fourth one we get some different response:
With this, now we know how we modify the user-agent in order to access the site. We can either write a script to automate this process or do this manually. I wrote a simple script to dump the response with all the uppercase characters as user-agent:
From the output of this script, we can see that for request with C
as user-agent the response was different:
From this output, we get the agent's name which can be submitted as the answer to third question.
[Task 3] Hash cracking and brute-force
1. FTP password
From the last question, we know that Agent C's password is weak and also we know his name. So, we can now use hydra
to brute force their password:
With this, we found the password for one of the user's on the machine. Also, this password can be submitted as the answer to the first question.
2. Zip file password
We can access the FTP using the credentials we found in the last question and check the files to which we have access:
We can see that there are 3 image files present in the FTP. We can download all of them using the command mget *
. Once, downloaded, we can check the content of each of these files.
Let's begin with the text file first:
From this message, there are a few important points that we need to note:
If all these images are fake, there must be some real image.
The real image is stored inside Agent J's directory.
Agent J's account password is stored in these fake images (hints towards steganography).
Now, we have two images one is .png
and the other is .jpg
. Also, we know that jpg files can be used for hiding data using steganography. So, we can try to extract it's content using steghide
:
But as we don't know the passphrase, we won't be able to access its content.
We also have another png image on which we can run the binwalk
command:
And binwalk finds some hidden content in the image and extracts it to a folder _cutie.png.extracted
. We can see in the newly created directory that 4 files have been detected:
The To_agentR.txt
the file appears to be empty whereas the filefile
when checked with thefile
command shows simply content type as data. Even using thestrings
command does not provide any useful result. We are also having a zip
file but it appears to be locked with a password:
We can use fcrackzip
to crack the password for this zip file:
But it can be seen that the password was not found.
Switch
Meaning
-v
Verbose
-u
use unzip
to weed out wrong passwords
-D
use a dictionary
-p
use strings as password
So, the next thing we can do is use zip2john
to crack the password, which can be done as:
What we have done over here is:
First converted the zip to a format that can be understood by john using
zip2john
and stored it in a file namedfor_john
.Then we used
john
to crack the password infor_john
file and specified that the format of the value that is to be cracked iszip
And in this way, we get the password of the zip. This password is also the answer to the second question.
3. steg password
Now, that we have the password of the zip file, we can extract its content and read the file To_agentR.txt
.
We can see that there is an encrypted stringQXJlYTUx
in the message. We can decode it using CyberChef's magic method. From there, we can see that the string wasBase64
encoded. We can try to use this decoded value as the passphrase for cutie.jpg
the file:
And we were able to extract a new file. So, now we know the steg password as well that can be submitted as the password to the third question.
4. Who is the other agent (in full name)?
We can now read the message.txt
and see if there is some useful information.
We do find the name of the other user at the very beginning of this message. This name can be submitted as the answer to the fourth question.
5. SSH password
In the message.txt
the file itself, we can find the password for the user. We can use the same username and password to gain SSH access to the machine. Also, this password can be submitted as the answer to the fifth question.
[Task 4] Capture the user flag
1. What is the user flag?
To get the user flag, we can SSH into the user's account:
So, we found the user flag.
2. What is the incident of the photo called?
In the same directory, we can find a file Alien_autospy.jpg
. To view this file, we need to download this file on our local machine. This can be done by starting a python server on the target machine and using wget
on the local machine to download the file:
It can be seen that in the lower half we have started a python3 server on the target machine and in the upper half of the image we have used wget to download the file on our local machine.
On opening the image, we can find that it shows a dead alien. We can use Google Image Search to upload the file and find information related to the image.
Hint: You can easily get the first two words but for the third word think of some term similar to the second term in the image's filename.
Some Key Points to Take Away
Use
curl
to change the User-Agent.When you have a zip file:
Use
fcrackzip
to crack its passwordOR use
zip2john
along withjohn
to crack the password
Try to think of reverse searching the image if some details for the same are needed.
Last updated