A group of software people from various firms brought together by the NSA have sat around and come up with a list of the most dangerous 25 programming errors . If you been a developer for more than 5 minutes you have probably come across half of these, but this can be used as a handy checklist.
In the words of Paul Kurtz, executive director of a group called the Software Assurance Forum for Excellence in Code "Now, with the Top 25, we can spend less time working with police after the house has been robbed and instead focus on getting locks on the doors before it happens"
Here's my cheap and cheerful run down of through the list.
Each heading links to the site where there is more detail on each , which includes discussion, prevention and mitagations, attack patterns against the error.
15-Jan-08: I haven't had time to comment on each error in the list, but I will do at some point
1. Improper Input Validation
e.g. Alpha characters aren't allowed to be entered in numeric fields, stuff like that
2. Improper Encoding or Escaping of Output
Using stored procs and using correct character encoders
3. Failure to Preserve SQL Query Structure (aka 'SQL Injection')
Make sure a user can't enter sql into a text field that will
4. Failure to Preserve Web Page Structure (aka 'Cross-site Scripting')
5. Failure to Preserve OS Command Structure (aka 'OS Command Injection')
6. Cleartext Transmission of Sensitive Information
7. Cross-Site Request Forgery (CSRF)
8. Race Condition
9. Error Message Information Leak
10. Failure to Constrain Operations within the Bounds of a Memory Buffer
11. External Control of Critical State Data
12. External Control of File Name or Path
13. Untrusted Search Path
14. Failure to Control Generation of Code (aka 'Code Injection')
15. Download of Code Without Integrity Check
16. Improper Resource Shutdown or Release
17. Improper Initialization
18. Incorrect Calculation
19. Improper Access Control (Authorization)
20. Use of a Broken or Risky Cryptographic Algorithm
21. Hard-Coded Password
22. Insecure Permission Assignment for Critical Resource
23. Use of Insufficiently Random Values
24. Execution with Unnecessary Privileges
25. Client-Side Enforcement of Server-Side Security