Until now, we've just considered injections in the GET requests and parameters, if you have not yet completed them then click the below links:
Introduction to SQLMap: A Brief Overview
This article provides a concise introduction to SQLMap, a powerful open-source penetration testing tool used for detecting and exploiting SQL injection vulnerabilities in web applications. It covers the basics of SQLMap and its usage, making it an essential read for cybersecurity enthusiasts.
Detecting and Exploiting SQL Injection Vulnerabilities
This comprehensive guide delves into the detection and exploitation of SQL injection vulnerabilities in web applications. It provides step-by-step instructions on identifying SQL injection vulnerabilities and leveraging them to gain unauthorized access to databases. This resource is invaluable for web developers and security professionals seeking to bolster their understanding of SQL injection attacks.
Dumping The Data
Dumping Data in Error-Based SQL Injection Scenario
This guide provides insights into dumping data in error-based SQL injection scenarios, an essential technique for extracting sensitive information from vulnerable databases. It offers step-by-step instructions and practical examples to help security professionals understand and exploit error-based SQL injection vulnerabilities effectively.
Let us now look at an injection in a POST parameter and exploit the same with the SQL Map.
It will redirect to a login Portal, as below screenshot:
In the Username field, we try to insert a stray character to break the query as we did before.
Let's see what happens, when we click on Submit button.
Upon submitting the work, we get a typical MySQL error. Now, we need to check exactly which POST parameter is affected.
To view the request we will use a Firefox add-on known as Live HTTP Headers which can be easily installed from the Firefox add-on gallery.
Now, Launch the HTTP Header Live extension, and refresh the page to load the entries.
So, based on the output of Live HTTP Headers, the affected parameter is "uname".
Let's use SQLMap's --data switch to exploit this POST-based scenario.
Now, we'll enforce the parameter to check to uname and pass the POST parameters inside --data. Let's try this out in SQLMap.
Here's what you'll see:
Look at that, SQLMap exploited the same level of easiness as it did in the GET-based injections.
Another way of exploiting this is by capturing the POST request and manually specifying the parameter.
Now we've saved the request. We'll utilize the -r switch to read the HTTP request from the aforementioned file and then specify the vulnerable parameter, which in our case is uname through the -p switch.
And again! Through this technique, we achieved the same result but in a different manner.
I demonstrated this through a file because
this can be used when exploiting SQL injections that are not straightforward;
when the payload is SOAP (XML-based) or JSON then we can use the same -r switch
and feed the request to SQL Map through a file and exploit the injection.