BOOK THIS SPACE FOR AD
ARTICLE ADSQL injection (SQLi) is one of the most common and dangerous vulnerabilities found in web applications, allowing attackers to manipulate the back-end database by injecting malicious SQL queries. This article will guide you on how to find SQL vulnerabilities, tools for both Kali Linux and Windows environments, and how beginners can find their first SQL injection vulnerability in less than 10 minutes.
SQL Injection is a type of attack where a hacker inserts malicious SQL code into input fields of a website (like login forms, search bars, etc.) that can modify or retrieve sensitive data from the database.
Step 1: Identify Input Fields
Begin by identifying the input fields where the web application communicates with the database. These fields might include:
Login formsSearch boxesContact formsURL parameters (such as id=123)Step 2: Testing for SQL Injection
You can test if the input fields are vulnerable to SQL injection by using common payloads like:
‘ OR 1=1--' OR 'a'='aadmin'--If you submit any of these payloads and see unexpected behavior (like logging in without credentials or seeing errors), the input may be vulnerable.
For example:
Username: admin'--Password: (leave empty)
If this logs you in, it indicates that the website’s input is improperly sanitized, allowing SQL code to run.
Step 3: Look for SQL Errors
When testing with these payloads, sometimes the website will display an error, such as:
MySQL error: You have an error in your SQL syntaxMS SQL error: Microsoft OLE DB Provider for SQL Server errorThese errors provide hints that the website may be vulnerable to SQL injection.
On Kali Linux:
SQLMapSQLMap is the most powerful and automated tool for detecting and exploiting SQL injections. You can run a scan with SQLMap by providing the target URL. SQLMap will try various injection points to identify and exploit SQLi vulnerabilities.How to use:sqlmap -u "http://example.com/page?id=1" --dbsThe above command will check if the URL parameter id is vulnerable to SQL injection and attempt to retrieve the database names.Burp Suite
Burp Suite is a comprehensive web vulnerability scanner that also allows manual testing. In its Intruder and Repeater tools, you can inject SQL payloads into requests and analyze the server responses for potential vulnerabilities.Nmap
Using nmap with NSE (Nmap Scripting Engine), you can find basic vulnerabilities. While Nmap is typically for network scanning, certain scripts like http-sql-injection can help identify SQL injection points.Command:nmap --script http-sql-injection -p 80 http://example.com
On Windows:
HavijHavij is a Windows-based SQL injection tool with an easy-to-use interface. After inputting the target URL, Havij automates the process of finding and exploiting SQL injection vulnerabilities.Acunetix Web Vulnerability Scanner
Acunetix is a popular web vulnerability scanner that can detect various security issues, including SQL injection. It’s an ideal choice for Windows users.
Here’s a step-by-step method for beginners to find SQL injection vulnerabilities quickly:
Use SQLMapChoose a target website (it’s important to have permission to test it) that has URL parameters, like:http://example.com/product.php?id=5Run SQLMap:sqlmap -u "http://example.com/product.php?id=5" --dbsSQLMap will quickly scan the URL for SQL vulnerabilities and attempt to extract database information.Manual Testing on Login Forms Look for login forms on the website and test simple payloads:In the username field, type:' OR 1=1--Leave the password blank and submit the form. If you’re logged in, the site is likely vulnerable to SQL injection.Burp Suite For those more comfortable with a GUI, Burp Suite’s Intruder tool lets you intercept HTTP requests and inject SQL payloads to see how the server responds. This can help detect SQL vulnerabilities quickly.
The earnings for finding SQL injection bugs depend on where you report the bug and how critical it is. Here’s a breakdown:
Bug Bounty PlatformsHackerOne: SQL injection bugs can earn between $500 to $10,000+, depending on the severity and the company involved.Bugcrowd: Similar rewards, with payouts often starting at $500 for critical SQL injection bugs.Private Companies: Some companies offer direct bug bounty programs, where you can report vulnerabilities on their websites and receive rewards.Public Sector: In government-run bug bounty programs, payouts for SQL injection vulnerabilities can range from $100 to $5,000+ depending on the criticality.