Skip to main content

Posts

Showing posts with the label CTF

Natas Level 15 Writeup: Blind SQLi

1. Objective  Find the password for natas level 16. URL: http://natas15.natas.labs.overthewire.org 2. Introduction After opening the webpage, we see a search form. The website allows us to search for users and responds with either "This user doesn't exist" or "This user exists" depending on whether the user was found or not.  user     natas16    3. Exploration Clicking on the View source code link we are able to view the logic of the server side code. The following code snippets shows that the provided username is searched for in the database and the corresponding result is returned      $query = "SELECT * from users where username=\"".$_REQUEST["username"]."\"";      if(mysqli_num_rows($res) > 0) {         echo "This user exists."; } else {      echo "This user doesn't exist."; } Ju...

Natas Level 14 Writeup: SQL Injection

1. Objective  Find the password for natas level 15. URL: http://natas14.natas.labs.overthewire.org   2. Introduction After opening the webpage, we see a login form. We need to get the correct credentials or somehow bypass the login page in order to proceed to the next level.   3. Exploration Clicking on the View sourcecode link we are able to view the logic of the server side code. The following code snippet is used to query the database to check if the username and password are valid $query = "SELECT * from users where username=\"".$_REQUEST["username"]."\" and password=\"".$_REQUEST["password"]."\""; However, we immediately notice that the input is not being sanitized and is being used directly in the query via string concatenation. These shows us that there is potential for sq injection        SQL injection is a cyber attack that exploits vulne...

Natas Level 13 Writeup: File Upload Vulnerability 2

1. Objective Find the password for natas level 13. 2. Introduction The first thing we see is a form that gives us the ability to upload 'JPEG' images.    Unlike the previous level, we get a message informing us that they will only be accepting image files. This hints to the fact that measures have been put in place to prevent us from uploading php files. Let's  see if this measures are sufficient 3. Exploration Let's use the 'View source code' button to check what clues we can find there. The process that takes place on the server. A file name is generated before the page is served to the user The filename is stored in a hidden field called filename When a user uploads a file, the server checks if the filename field is present It prepares for the file to be saved in the upload folder Check if the size of the file is greater than 1000 bytes Reject the fil...

Natas Level 12 Writeup: File Upload Vulnerability

  1. Objective Find the password for natas level 13. 2. Introduction The first thing we see is a form that gives us the ability to upload 'JPEG' images.    If proper checks have not been put in place to validate the uploaded file, it is highly likely that we may have a File Upload Vulnerability.  A File Upload Vulnerability is a security issue that arises when proper checks are not implemented to validate uploaded files. In this level, we explore the possibility of exploiting such a vulnerability. 3. Exploration Let's use the 'View source code' button to check what clues we can find there. The process that takes place on the server. A file name is generated before the page is served to the user The filename is stored in a hidden field called filename When a user uploads a file, the server checks if the filename field is present It prepares for the file to be saved in the ...

Natas Level 10 Writeup: Command Injection 2

URL: http://natas10.natas.labs.overthewire.org 1. Objective  Find the password for natas 11 2. Method      Open the Website:                Visit the provided URL in your browser.                Check the Source Code:      Bypassing the Filter:                Use command substitution $(command) to bypass the filter.                Enter the search term a $(find /etc/natas_webpass -name natas11 2>/dev/null) .     Explore the Output:                Examine the output, revealing files like index-source.html .      Find t...

Natas Level 9 Walkthrough: Code Injection

URL: http://natas9.natas.labs.overthewire.org Objective Gain access to the password for natas10. Procedure: Open the website and inspect the PHP source code. Identify the vulnerable passthru function in the source code: passthru("grep -i $key dictionary.txt"); Realize the potential for command injection by exploiting this vulnerability. Find the current directory by searching for: zzz; pwd; ls Explanation: Utilize the semicolon to separate different commands. Use zzz to ensure that grep returns no result. Include pwd to print the current working directory. Add ls to list the contents of the directory, avoiding issues with the word "dictionary.txt" hanging on its own. Use the find command to locate any file related to natas10: zzz; find / -type f -name natas10 2>/dev/null; ls ...

Natas Level 8 Writeup: String manipulation

URL: http://natas8.natas.labs.overthewire.org Introduction Natas Level 8 introduces a captivating web security challenge where the primary objective is to unveil the password for the succeeding level, natas9. Initial Exploration Begin the challenge by accessing the website through the provided URL.    Delve into the source code, scrutinizing it for potential hints and vulnerabilities. Decoding the Password Upon inspecting the PHP source code, identify the presence of an encoded password. The encoding process involves converting the secret to base64, reversing the string, and then converting it to hex. To retrieve the original secret, these steps must be reversed. To decode the password, follow these steps: Copy the encoded password. Utilize a tool like CyberChef or a preferred method. In reverse order, perform the following operations: Convert the string from hex. Reverse the resulting string to obtain a base64 string. Convert from base64 to reveal the original secret. Succes...