Sinisterly
How To Stop SQL Injection On Your Website - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Hacking (https://sinister.ly/Forum-Hacking)
+--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials)
+--- Thread: How To Stop SQL Injection On Your Website (/Thread-How-To-Stop-SQL-Injection-On-Your-Website)

Pages: 1 2


How To Stop SQL Injection On Your Website - HrDe - 09-26-2011

Website Hacking always hot topic between Hacker,some days before i am tell you how to hack a website by SQL Injection with picture.

For watch old Post Click Here

Spoiler:
[Image: sql_injection.gif]


Today post about How to Safe your site against SQL Injection Attack because security of website too important for save your Data Base by access unauthorised person.

If your site SQL vulnerable then a hacker go to site login page and type tha administrator username and in the password field type or paste like this..

x' or '1'='1

If the site vulnerable then it login and you change all settings but how this code work.If you are able to log in then the code on side ...

$sql=
"SELECT*FROM users
"WHERE username="" . $username .
" AND password="" . $password ."";

then your code work as...

SELECT *FROM users WHERE username='admin' and PASSWORD='HrDe' or '1'='1

Here x' or '1'='1 has injected an extra phrase into the WHERE clause that means WHERE is always true,and this query will return a row contain the user's details.

If single user defined in the DB,then user's details will always returned else multiple users then one of those user will be returned at random.

Spoiler:
[Image: hacked.PNG]




How to safe website by Deface ?

How to fix vulnerable hole on your website,it's not difficult.Many ways to do it.If you work with MySQL then simply you fix it by using the
mysql_escape_string()
or
mysql_real_escape_string() function for example....

$userid=mysql_real_escape_string($userid);
$password=mysq;_real_escape_string($password);
$sql=
"SELECT*FROM users
"WHERE username="" . $username .
" AND password="" . $password ."";

This work as...

SELECT*FROM users WHERE username='admin' and PASSWORD='x\' or \'a\' =\'a

It backslashes(\) make the DB treat query like a normal character rather than as a delimiter,by it DB no interprets the SQL an OR in the WHERE clause.


http://hackarde.blogspot.com/2011/09/how-to-stop-sql-injection-on-your.html





RE: How To Stop SQL Injection On Your Website - Coppa - 09-26-2011

Very nice post,some hacker post about hack but never any one post on how to secure by hack.Thank


RE: How To Stop SQL Injection On Your Website - Carlduke - 09-26-2011

nice share! finally some secure by hacks Biggrin


RE: How To Stop SQL Injection On Your Website - HrDe - 10-26-2011

(09-26-2011, 08:13 PM)Carlduke Wrote: nice share! finally some secure by hacks Biggrin
Thanx bro



RE: How To Stop SQL Injection On Your Website - The Alchemist - 10-26-2011

This was a nice post. Thanx bro..


RE: How To Stop SQL Injection On Your Website - insecure - 10-26-2011

yo good approach.....but why u sharing anti hack arrangements in a hacker board lol


RE: How To Stop SQL Injection On Your Website - HrDe - 05-01-2012

(09-26-2011, 07:37 PM)Coppa Wrote: Very nice post,some hacker post about hack but never any one post on how to secure by hack.Thank

Welcome bro :yes: u like my thread, thanks for it.


RE: How To Stop SQL Injection On Your Website - Shining White - 05-01-2012

This is the Cool Share as my view defnitly ,
I guess also adding Extra ,'"+ +"' , Same to the This
as Sage said about XSS ,
i never thought about XSS :o :o :o ,
Thanks for the Sharing


RE: How To Stop SQL Injection On Your Website - editify - 05-02-2012

Nice tutorial, very cool share.
Thanks Bro


RE: How To Stop SQL Injection On Your Website - HrDe - 05-29-2012

(10-26-2011, 11:06 AM)The Alchemist Wrote: This was a nice post. Thanx bro..

Always welcome uBiggrinBiggrinBiggrinBiggrin