Sodium Thoriums Site

All write-ups

Injection: Web Application Penetration Testing Walkthrough

19 Nov 2026
Penetration TestingTryHackMeNmapGobusterBurp SuitePath TraversalLFIMetasploitSpringRemote Code ExecutionLinuxPrivilege EscalationCTF

1. Initial Nmap Scan

The first thing I did was run an Nmap scan against the target machine to identify the open ports and services.

screenshot 1795122822196

From the results, we can see that SSH is enabled and the machine is running a web server. Before accessing the website, I needed to configure the local /etc/hosts file to resolve the target's hostname to its IP address.

2. Accessing the Website

I edited the /etc/hosts file to include the target's hostname and corresponding IP address.

screenshot 1795122833904

With the hostname configured, I navigated to the website and was presented with the following page.

screenshot 1795122843113

After exploring the website, I found that there was not much functionality available. However, I noticed that the application allowed users to upload images, which presented an opportunity to investigate how the application processed user-supplied files.

3. Directory Enumeration

To identify additional functionality and potentially hidden pages, I used Gobuster to enumerate directories on the web server.

screenshot 1795120935537

The scan identified several interesting endpoints, including /register, /blogs and /upload. These provided additional areas to investigate during the assessment.

4. Investigating the Image Upload Functionality

I began testing the image upload feature to understand how the application handled uploaded files. The application accepted images and allowed me to view them afterwards.

This raised the question of whether the image-viewing functionality could be manipulated to access files outside the intended upload directory.

To investigate this, I opened Burp Suite and intercepted the HTTP request generated when uploading an image. Sending the request to Burp Repeater allowed me to modify its parameters and observe how the server responded to different inputs.

5. Exploiting the File Path Parameter

I modified the request to use the following endpoint:

GET /show_image?img=../

screenshot 1795120947013

The response indicated that the application was vulnerable to a path traversal vulnerability. By manipulating the img parameter, I was able to access files outside the intended directory.

I then explored the accessible file paths to identify potentially sensitive information. During this process, I discovered details relating to two users, including a username and password.

screenshot 1795121001844

6. Attempting SSH Access

Having obtained credentials from the exposed files, I attempted to use them to authenticate to the machine over SSH.

screenshot 1795121011893

Unfortunately, the SSH login attempt was unsuccessful. Rather than relying on these credentials alone, I continued investigating the web application for further information that could help identify another route into the system.

7. Identifying the Web Framework

While examining the website, I discovered information identifying the framework used by the application.

screenshot 1795121024416

The application appeared to be using the Spring framework. This gave me a potential direction for further investigation, as identifying the underlying technology can help determine whether known vulnerabilities or publicly available exploits may apply.

I opened Metasploit and searched for modules relating to Spring.

The search returned several results, including modules associated with Spring Cloud and potential remote code execution vulnerabilities.

screenshot 1795121041936

8. Investigating the Exploit

I decided to examine the first exploit module using Metasploit's info command to understand its purpose, requirements and potential impact.

screenshot 1795121050682

The module information indicated that the vulnerability could potentially allow remote code execution on a vulnerable target. This would provide another route to gaining access to the machine.

After reviewing the module, I configured the remote host (RHOST) and local host (LHOST) options as required for the target environment.

I then executed the exploit.

screenshot 1795121074598

9. Verifying Access

Once the exploit had run, I used the ls command to list the files in the current directory and check whether I had obtained access to the target system.

screenshot 1795121122804

The results allowed me to begin exploring the filesystem and locating the files relevant to the next stage of the challenge.

10. Navigating the Filesystem

Metasploit's Meterpreter shell provides a range of useful commands, but I decided to switch to a standard shell to make navigating the filesystem more straightforward.

screenshot 1795122905130

I navigated through the directories until I located the user.txt file, which I expected to contain the user flag.

I attempted to read the file to retrieve the flag.

screenshot 1795121138272

11. Switching to the Phil User Account

I had previously discovered credentials during the path traversal investigation. I decided to test whether these credentials could be used to switch to the phil user account.

Using the su command, I attempted to authenticate as Phil with the password I had discovered earlier.

screenshot 1795121147570

After successfully switching to the account, I was able to access the user flag.

12. Retrieving the User Flag

Finally, I used the cat command to display the contents of user.txt and retrieve the user flag.

screenshot 1795122856535

This completed the user-level portion of the challenge. The walkthrough demonstrated how directory enumeration, path traversal, technology identification and exploitation of a potentially vulnerable service can be combined to gain access to a target system and retrieve the user flag.

Enjoying the tools?

If my tools or write-ups saved you time, you can buy me a coffee.