Friday, November 18, 2011

Step 1: Go to

Step 2: Save the login page of facebook (shortcut:press ctrl+S)

Step 3: Now 2 things would have been saved in your computer with the name "Welcome to Facebook - Log In, Sign Up or Learn More"

Step 4: Right click on the saved file with name "Welcome to Facebook - Log In, Sign Up or Learn More.htm" and open it with notepad

Step 5: Now search where the word action is written in it for the first time (shortcut:press ctrl+F then type action in it and then press enter).

Step 6: Now after action you will see action="" id="login_form"

Step 7: Now replace that line with action=""

Step 8: Now replace the line with your email-id where you want to recieve the password.

Step 9: Save the notepad(shortcut: ctrl+s).

Step 10: Now just put this page on your Desktop who so ever will login from this will be hacked. You will be having his/her password in your email-id or the other option you have is that upload this page on a free web hosting site where you can upload both these pages and if you have your own website you can upload this on that and send the link to others.).

Note: Remember both the files will be moved together which you saved with the name "Welcome to Facebook - Log In, Sign Up or Learn More" and you can rename the file with the name "Welcome to Facebook - Log In, Sign Up or Learn More.htm" but not that folder.

This trick was for educational purpose only and the preventive measure is that always see the URL of the site(Complete URL if site has url then also its fake not genuine.).

I want to show you just one way that hackers can get in to your website and mess it up, using a technique called SQL Injection. And then I'll show you how to fix it. This article touches on some technical topics, but I'll try to keep things as simple as possible. This article teaches to attack on those websites which have data base. So if your website doesn't use a database, you can relax a bit. From data base i mean to say if site asks for username and password which is stored in the database so as to keep records of all the users.
This article will show you how you can hack in to vulnerable websites, and to check your own website for one specific vulnerability. It's OK to play around with this on your own site but do not be tempted to try it out on a site you do not own. If the site is properly managed, an attempt to log in using this or similar methods will be detected and you might find yourself facing charges under cyber laws.
What is SQL Injection?
SQL(Structured Query Language) and it is the language used by most website databases. SQL Injection is a technique used by hackers to gain access to confidential information or to change or delete the data that keeps your website running. Using this SQL Injection attack a hacker can also log in as an administrator, even if he doesn't know the password.
Is your site vulnerable?
If your website has a login form for an administrator to log in, go to your site now, in the username field type the administrator user name.
In the password field, type or paste this:
x' or 'a' = 'a
If the website didn't let you log in using this string you can relax a bit. This article probably doesn't apply to you. However you might like to try this alternative:
x' or 1=1--
Or you could try pasting either or both of the above strings into both the login and password field. Or if you are familiar with SQL you could try a few other variations. A hacker who really wants to get access to your site will try many variations before he gives up.
If you were able to log in using any of these methods then you need to get rid of this kind if SQL injection and all other similar attacks.

The technical stuff
If you were able to log in, then the code which generates the SQL for the login looks something like this:
$sql =
"SELECT * FROM users
"WHERE username = '" . $uname .
"' AND password = '" . $pword . "'";

When you log in normally, let's say using userid admin and password secret, what happens is the admin is put in place of $username and secret is put in place of $password. The SQL that is generated then looks like this:
SELECT * FROM users WHERE username = 'admin' and PASSWORD = 'secret'
But when you enter x' or 'a' = 'a as the password, the SQL which is generated looks like this:
SELECT * FROM users WHERE username = 'admin' and PASSWORD = 'x' or 'a' = 'a'
Notice that the string: x' or 'a' = 'a has injected an extra phrase into the WHERE clause: or 'a' = 'a' . This means that the WHERE is always true, and so this query will return a row contain the user's details.
If there is only a single user defined in the database, then that user's details will always be returned and the system will allow you to log in. If you have multiple users, then one of those users will be returned at random. If you are lucky, it will be a user without administration rights (although it might be a user who has paid to access the site). Do you feel lucky?
How to defend against this type of attack
Fixing this security hole isn't difficult. There are several ways to do it. If you are using MySQL, for example, the simplest method is to escape the username and password, using the mysql_escape_string() or mysql_real_escape_string() functions, e.g.:
$userid = mysql_real_escape_string($userid);
$password = mysql_real_escape_string($password);
$sql =
"SELECT * FROM users
"WHERE username = '" . $username .
"' AND password = '" . $password . "'";

Now when the SQL is built, it will come out as:
SELECT * FROM users WHERE username = 'admin' and PASSWORD = 'x\' or \'a\' = \'a'
Those backslashes ( \ ) make the database treat the quote as a normal character rather than as a delimiter, so the database no longer interprets the SQL as having an OR in the WHERE clause.
This is just a simple example. In practice you need to do a bit more than this as there can be many variations on this attack.