Are you looking for some useful tips to improve your web projects security? In this post I suggest you some interesting points about this topic.
Hacking is very interesting topic you can improve programming skill.
SQL Injection
SQL Injection like this
Login Java Code
String userid = request.getParameter("userid");
String password = request.getParameter("password");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:projectDB");
query = "SELECT * FROM Users WHERE user_id ='" + userid + "' AND password ='" + password +"'";
PreparedStatement ps = connection.prepareStatement(query);
ResultSet users = ps.executeQuery();
if(users.next()){
//some thing here
}
else{
}
Injection Works like thisString password = request.getParameter("password");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection("jdbc:odbc:projectDB");
query = "SELECT * FROM Users WHERE user_id ='" + userid + "' AND password ='" + password +"'";
PreparedStatement ps = connection.prepareStatement(query);
ResultSet users = ps.executeQuery();
if(users.next()){
//some thing here
}
else{
}
query = "SELECT * FROM Users WHERE user_id ='' OR 1=1; /* AND password ='*/--'";
Login PHP Code;
Username = ' OR 1=1;//
Password = ....
$myusername=$_POST['usr'];
$mypassword=$_POST['pwd'];
$sql="SELECT * FROM users WHERE user='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
//some code
}
else {
}
Injection Works like this$mypassword=$_POST['pwd'];
$sql="SELECT * FROM users WHERE user='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
//some code
}
else {
}
$sql="SELECT * FROM users WHERE user=''OR 1 = 1;//' and password='....'";
How to avoid these mistakes Use addSlashes() function adding slashes(/) to the string in java and php
//Java Code
addSlashes(String userid);
// PHP Code
$myusername=addslashes($_POST['usr'];);
Hacker is intelligent than programmer. So always hide the file extension (eg: *.jsp,*.php,*.asp).addSlashes(String userid);
// PHP Code
$myusername=addslashes($_POST['usr'];);
http://xyz.com/login.php to http://xyz.com/login
http://xyz.com/login to http://xyz.com/signin.do
In Java redirect this URL links using Web.xml file and inn php write .htaccess file in root directory.
My Best Hacking Training Site Hackthissite.org
Hacker's Game full control with Unix based commands. Play and learn many more hacking things
Nice Informative Article
ReplyDeleteI have a couple of questions too ...
You might find something interesting at:
http://in.geocities.com/siddharth_bhatta
http://armageddonsaviour.blogspot.com
My Yahoo Questions
http://in.answers.yahoo.com/my/qa/index;_ylt=Alv.xyiI1hgdYcm11_adlwiQHQx.;_ylv=3?link=question&more=y
My Yahoo Answers
http://in.answers.yahoo.com/my/qa/index;_ylt=AuXQriu_hTRCNuoPCOcCjVGQHQx.;_ylv=3?link=answer&more=y
Other Questions
http://in.answers.yahoo.com/my/my;_ylt=AsX16KVZ5jK1zeXmaVN3w6IAAAAA;_ylv=3?link=starred&more=y
Hey can u guide me how to prevent hizacking sessions in php.
ReplyDeleteHI I WANT TEST STRENGTH AND SECURITY OF LOGIN PAGE BUT IT ACCEPTS 5 CHAR IN USER NAME .
ReplyDeleteHOW CAN I CHECK ? I NEED TO KNOW ABOUT BOT ATTACKS
PLEASE REPLY ME IN [email protected]
Your Suggestions and Opinions needed here ...
ReplyDeletehttp://armageddonsaviour.blogspot.com/2008/12/has-anybody-cared-to-inform-dte.html
http://armageddonsaviour.blogspot.com/2008/12/correct-this-image-problem-on-welcome.html
doesnt work in Java/MySQL, however
ReplyDeleteSELECT * FROM user where name='' OR 1=1 OR 1='' and password='*/--'
this works :D
Or you could just use a PreparedStatement.
ReplyDeleteHey how about including XSS Cross Site Scripting Vulnerability article on your blog?
ReplyDeleteIf you say, I can send you a ppt on it ... (related to hacking)
One more topic I need your help since security interests you ...
I would also appreciate, if you share your viewpoints on OpenID for future perspective
http://armageddonsaviour.blogspot.com/2008/08/netizens-worldwide-want-openid-at-every.html
http://armageddonsaviour.blogspot.com/2008/08/beware-powerscrapcom-is-not-safe-i-need.html
well frnd it very or trick and doesnot work any more...
ReplyDeleteexellent, thz
ReplyDeleteARIEL.MACINTOSH™