Coding practices - Web site security

In this blog post, I will be focusing on how to secure your website through established coding practices. If you are using an MVC framework (like CakePHP, Symfony, Zend etc) or any CMS systems (like Drupal, Wordpress etc), most of these security measures might already be in place for you. Nevertheless, it would be good to know.

  • Cross-site scripting
  • Cross-site scripting attacks are attacks that target the end user instead of your actual site. Vulnerable web applications that don’t check or validate properly incoming data let arbitrary code to run on a client computer (such as Javascript). The end result can be anything from stealing cookie data or redirecting to a different site. 
    Let us imagine that you are implementing a comment feature on your website, that lets viewers of your website leave comments. If you aren't careful in validating your in coming data, users of your website can be redirected to a different location. For example, consider the following comment: Good work! If a user visits the comments page now it will be redirected to example.com website. To prevent this, you could use PHP strip_tags method 
  • SQL injection
  • This is a subset of the an unverified/unsanitized user input vulnerability. The harm occurs when a query is run based on the user input without proper validation. For example, consider the following login form example. 
    <form> <input name='username' type='text'> <input name='password' type='password'> </form> 
    On the server side, the user is validated using the following query, "SELECT * FROM users WHERE username='$_GET['username']' and password='$_GET['password']'" At first, the above query looks fine. Now if the user enters the following text -"xyz' OR '1=1'", then the user can login to the site with some dummy password 'xyz', with this he can login to any user account. This makes the whole site vulnerable. The solution for the above problem is - 
    1. mysql_real_escape_string() This escapes all potentially dangerous characters in the string provided by adding a '\' and returns the escaped string such that it may be safe to put into a MySQL query. 
    2. Use parameterized statements Example: $p = $db->prepare("SELECT * FROM users WHERE username = ?"); $db->execute( $p, array($_GET['username']) );
  • Other kinds of attacks
  • SQL injection and Cross-site injection are just 2 of the website vulnerabilities, in addition there are other attacks like buffer overflow attack, brute-force attacks etc. Carefully devising strategies for user input validation is the best way to counter these attacks.
Posted
 

iPhone/iPod Touch viewport specs

iPhone view port specs

Posted
 

Notes from IU iPhone Conference

Keynote by Sheve Hayman

- Talk about some demo iphone native web apps.

- iPhone capabilities:
1. Flipping (is hardware accelerated transformation)
2. Location sensing capabilities
3. In HTML5, browsers can figure this out
4. You can now write apps that work in airplane mode (i.e., offline mode). This is because of cache features in HTML5. This reduces the difference between native and web apps

Read the rest of this post »

Posted
 

Fix MacFusion on Snow Leopard | Racker Hacker

First off, credit for this fix goes to Geoff Watts from his two tweets.

If you’re using Snow Leopard, you’ll find that the current version of MacFusion refuses to complete a connection to a remote server. You can fix this in two steps:

First, quit MacFusion.

Second, open System Preferences and then open the MacFUSE pane. Check the “Show Beta Versions” box and click “Check For Updates”. Go ahead and update MacFUSE.

Third, open up a terminal and do the following:

rm /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshnodelay.so

Your MacFusion installation should now be working on Snow Leopard. I’ve tested SSH and FTP connectivity so far, and they both appear to be working. Thanks again to Geoff for the fix!

Relieved to find a fix for the macfusion mount problem on Snow Leopard

Posted