A step-by-step guide to using sqlmap to craft malicious requests:

Security Lit Limited
Dev Genius
Published in
3 min readApr 17, 2023

--

Using tools like Burp Suite or sqlmap to craft malicious requests that inject code or commands into web apps is a common technique used by attackers to exploit vulnerabilities in web applications. The following steps will explain how to use Burp Suite and sqlmap to inject code or commands into web apps:

Install and configure the tool: The first step is to install and configure the tool you want to use. For example, if you want to use Burp Suite, you need to download and install it on your system. Once installed, you need to configure the tool to work with the web application you want to test.

Identify the input fields: The next step is to identify the input fields in the web application that can be exploited. This can include fields such as search boxes, login forms, or any other fields that accept user input.

Craft the malicious request: Once you have identified the input fields, you can use Burp Suite or sqlmap to craft a malicious request that injects code or commands into the web application. For example, you can use sqlmap to inject SQL code into a search box or login form.

Test the request: After crafting the malicious request, you need to test it to see if it works. This can be done by submitting the request to the web application and checking the response.

Repeat and refine: If the malicious request doesn’t work, you may need to refine it and try again. You may also need to try different types of attacks, such as blind SQL injection or time-based attacks, to find a vulnerability that can be exploited.

Step-by-Step Guide-Install sqlmap and craft malicious request

Download and install sqlmap: The first step is to download and install sqlmap on your system. You can download the tool from the official website.

Identify the target website: The next step is to identify the website you want to test. Once you have identified the website, you can use sqlmap to scan the website for vulnerabilities.

Scan the website for vulnerabilities: To scan the website for vulnerabilities, you need to run the following command in the terminal:

sqlmap -u <target-website> --dbs

This command will scan the website for vulnerabilities and display a list of available databases.

Select a vulnerable database:

Once you have identified the available databases, you need to select a vulnerable database. To do this, you can run the following command in the terminal:

sqlmap -u <target-website> -D <database-name> --tables

This command will display a list of tables available in the selected database.

Dump the table data:

Once you have identified the table you want to dump, you can run the following command in the terminal:

sqlmap -u <target-website> -D <database-name> -T <table-name> --dump

This command will dump the table data, including usernames and passwords.

Here are some examples of malicious requests you can craft using sqlmap:

Extracting password hashes:

sqlmap -u <target-website> --passwords --hashes

This command will extract password hashes from the website’s database.

Dumping user data:

sqlmap -u <target-website> -D <database-name> -T users --dump

This command will dump user data from the website’s database.

Brute-forcing password hashes:

sqlmap -u <target-website> --passwords --hashes --threads=10 --technique=B

This command will use brute-force techniques to crack password hashes from the website’s database.

Dumping credit card information:

sqlmap -u <target-website> -D <database-name> -T credit_cards --dump

This command will dump credit card information from the website’s database.

Extracting email addresses:

sqlmap -u <target-website> -D <database-name> -T users -C email --dumpm

This command will extract email addresses from the users' table in the website’s database.

It is important to note that using tools like Burp Suite or sqlmap to craft malicious requests can be illegal if done without permission. Always ensure that you have the authorization to test a web application before using these tools. Additionally, it is important to use these tools responsibly and to report any vulnerabilities found to the appropriate parties so that they can be fixed.

Refer to more bug bounty writeup: https://thoughttide.com/category/technology/bug-bounty/

--

--