A 2012 New Year’s Resolution for Developers

Posted by Jason Taylor on January 17, 2012 at 9:36 AM
Find me on:

People often believe that if a developer is capable of creating clean, functional code that they will by default be writing secure code. Unfortunately, this is not always the case.

Security vulnerabilities can result from poor code, functional bugs can be security bugs too, but the trickiest security issues result from code that does more than you expect.. The application may test all of its functional tests but in addition it may have additional unintended functionality that can result in a vulnerability. For instance, a web site with a SQL Injection vulnerability could work perfectly well for a normal user and then work a little too well for a malicious user! It's important to think of abuse cases, not just use cases. Consider what are threats to this application? How would an attacker visualize (and subsequently attack) it? How do I code defensively against these threats?

Although there are many skills and abilities that may be on your personal development wish-list, if you want to write secure code, consider adding the following skills to your repertoire:

  1. Ability to create a mental threat model
    Should include all assets worth protecting and possible threats
  2. Sound knowledge of secure coding standards (known good patterns that work.)
    Ideally this takes the form of both a repository of best practices and a library of secure routines you can call into.
  3. Understand and map input paths and trust boundaries.
    Enables you to make decisions on how much to trust the data your code is processing.
  4. Know (or have a reference of ) patterns of bad code and checklists to check against.
    These are useful to keep in mind while coding as well as to check during a review. In pair programming the second developer can keep these in mind while the first developer is writing code.
  5. Know how your application functions and interacts with its environment.
    You can’t understand how they’d be attacked if you don’t know how they work. Applications ultimately transmit data and operate on hardware, in a network, etc. So you need to understand protocols, dependencies, communications (encryption), etc.

Topics: application security

Jason Taylor

Written by Jason Taylor

Jason Taylor leads the strategic direction for all of Security Innovation’s engineering and technology initiatives. He was the designer of our "Creating Secure Code" methodology which has been implemented at many of the world's largest technology organizations. He is a Microsoft Developer MVP for Security and has co-authored ten security guides with the Microsoft Patterns & Practices team.