Your Cart
No products in the cart.

Sqlmap is an open-source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over database servers.
It comes with a powerful detection engine, many niche features for the ultimate penetration tester, and a broad range of switches lasting from database fingerprinting, over data fetching from the database, to accessing the underlying file system and executing commands on the operating system via out-of-band connections.
Also Read    Lynis – Open source security auditing tool – A Detailed Explanation
sqlmap is able to detect and exploit five different SQL injection types:
Boolean-based blind:
Time-based blind:
UNION query-based:
Stacked queries:
This is usually the toughest bit and takes longer than any other step. Those who know how to use Google Dorks know this already, but in case you don’t I have put together a number of strings that you can search in Google.
Just copy and paste any of the lines in Google and Google will show you a number of search results.
A Google dork is an employee who unknowingly exposes sensitive corporate information on the Internet. The word dork is slang for a slow-witted or inept person.
Google dorks put corporate information at risk because they unwittingly create back doors that allow an attacker to enter a network without permission and/or gain access to unauthorized information.
To locate sensitive information, attackers use advanced search strings called Google dork queries.
For every string shown above, you will get hundreds of search results. How do you know which is really vulnerable to SQLMAP SQL Injection?
There are multiple ways and I am sure people would argue which one is best but to me, the following is the simplest and most conclusive.
Let’s say you searched using this string inurl:item_id= and one of the Google search result shows a website like this:
Just add a single quotation mark ‘ at the end of the URL. (Just to ensure, ” is a double quotation mark and ” ‘ ” is a single quotation mark).
So now your URL will become like this:
If the page returns an SQL error, the page is vulnerable to SQLMAP SQL Injection. If it loads or redirect you to a different page, move on to the next site in your Google search results page.
See example error below in the screenshot. I’ve obscured everything including URL and page design for obvious reasons.
Examples of SQLi Errors from Different Databases and Languages
Server Error in ‘/’ Application. Unclosed quotation mark before the character string ‘attack;’.
Description: An unhanded exception occurred during the execution of the current web request. Please review the stack trace for more information about the error where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Unclosed quotation mark before the character string ‘attack;’.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/myawesomestore.com/buystuff.php on line 12
Error: You have an error in your SQL syntax: check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’’ at line 12
java.sql.SQLException: ORA-00933: SQL command not properly ended at oracle.jdbc.dbaaccess.DBError.throwSqlException(DBError.java:180) at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
Error: SQLExceptionjava.sql.SQLException: ORA-01756: quoted string not properly terminated
Query failed: ERROR: unterminated quoted string at or near “‘’’”
As you can see from the screenshot above, I’ve found an SQLMAP SQL Injection vulnerable website. Now I need to list all the databases in that Vulnerable database. (this is also called enumerating the number of columns). As I am using SQLMAP, it will also tell me which one is vulnerable.
Run the following command on your vulnerable website.
In here:
sqlmap   =     Name of sqlmap binary file
-u             =     Target URL (e.g. “http://www.gbhackers.com/products_showitem_gbhac.php?item_id=28434”)
–dbs       =     Enumerate DBMS databases
See screenshot below.
This commands reveals quite a few interesting info:
So, we now have two databases that we can look into. information_schema is a standard database for almost every MYSQL database. So our interest would be in clemcoindustries database.
Now we need to know how many tables this clemcoindustries database got and what are their names. To find out that information, use the following command:
this database got 8 tables.
and of course, we want to check whats inside user_info table using SQLMAP SQL Injection as that table probably contains usernames and passwords.
Now we need to list all the columns on the target table user_info of clemcoindustries database using SQLMAP SQL Injection. SQLMAP SQL Injection makes it really easy, run the following command:
This returns 5 entries from the target table user_info of clemcoindustries database.
This is exactly what we are looking for … target table user_login and user_password.
SQLMAP SQL Injection makes it Easy! Just run the following command again:
Guess what, we now have the username from the database:
We are almost there, we now only need the password for this user. Next shows just that.
You’re probably getting used to on how to use the SQLMAP SQL Injection tool. Use the following command to extract the password for the user.
But hang on, this password looks funny. This can’t be someone’s password. Someone who leaves their website vulnerable like that just can’t have a password like that.
That is exactly right. This is a hashed password. What that means, the password is encrypted and now we need to decrypt it.
I have covered how to decrypt passwords extensively on this Cracking MD5, phpBB, MySQL, and SHA1 passwords with Hashcat on Kali Linux post. If you’ve missed it, you’re missing out a lot.
I will cover it in short here but you should really learn how to use hashcat.
So the hashed password is 24iYBc17xK0e. How do you know what type of hash is that?
Luckily, Kali Linux provides a nice tool and we can use that to identify which type of hash is this. In the command line type in the following command and on prompt paste the hash value:
Excellent. So this is DES(Unix) hash.
First of all, I need to know which code to use for DES hashes. So let’s check that
So it’s either 1500 or 3100. But it was an MYSQL Database, so it must be 1500.
I saved the hash value 24iYBc17xK0e. in the DES.hash file. Following is the command I am running:
Interesting find: Usual Hashcat was unable to determine the code for DES hash. (not in its help menu). However both cudaHashcat and oclHashcat found and cracked the key.
Anyhow, so here’s the cracked password: abc123  24iYBc17xK0e. :abc123
we now even have the password for this user.
What's the pulse of Unified Endpoint Management and Security (UEMS) in Europe? Join us live to uncover the strategies that are defining endpoint security in the region.
Stay safe online with free daily cybersecurity updates. Sign up now!
GBHackers on security is a highly informative and reliable Cyber Security News platform that provides the latest and most relevant updates on Cyber Security News, Hacking News, Technology advancements, and Kali Linux tutorials on a daily basis. The platform is dedicated to keeping the community well-informed and up-to-date with the constantly evolving Cyber World.
[email protected]