How can I find security vulnerabilities in my source code?

The original, and still the best, method for finding security vulnerabilities in source code is to read and understand the source code.

Source code security vulnerabilities will vary between languages and platforms.

Items to look for in C code include:

Potential vulnerabilityFunction calls to examine for vulnerabilities
Buffer overflowsgets(), scanf(), sprintf(), strcat(), strcpy()
Format string vulnerabilitiesprintf(), fprintf(), vprintf(), snprintf(), vsnprintf(), syslog()
Race conditionsaccess(), chown(), chgrp(), chmod(), mktemp(), tempnam(), tmpfile(), tmpnam()
Random number acquisition vulnerabilitiesrand(), random()
Shell metacharacter vulnerabilitiesexec(), popen(), system()


Automated Source Code Security Vulnerability Scanners

There are intelligent tools available to help you examine large amounts of source code for security vulnerabilities.

ToolDescription
FlawfinderExamines source code and reports possible security vulnerabilities
RATS from Secure Software SolutionsScans C, C++, PERL, PHP and Python source code for potential security vulnerabilities.
ITS4 from CigitalScans source code looking for potentially vulnerable function calls and preforms source code analysis to determine the level of risk
PScanA limited problem scanner for C source files
BOONBuffer Overrun detectiON
MOPSMOdelchecking Programs for Security properties
CqualA tool for adding type qualifiers to C
MCMeta-Level Compilation
SLAMMicrosoft
ESC/Java2Extended Static Checking for Java version 2
SplintSecure Programming Lint
MOPEDA Model-Checker for Pushdown Systems
JCAVEJavaCard Applet Verification Environment
The Boop ToolkitUtilizes abstraction and refinement to determine the reachability of program points in a C program
BlastBerkeley Lazy Abstraction Software Verification Tool
UnoSimple tool for source code analysis
PMDScans Java source code and looks for potential problems
C++ TestUnit testing and static analysis tool

For more information regarding source code scanners, read Source Code Scanners for Better Code in the Linux Journal.

For more information regarding secure programming, read the Secure Programming for Linux and Unix HOWTO.

Writing Secure Code Building Secure Software Secure Coding Secure Programming Cookbook
Find source code vulnerabilities in your code with the help of these books on secure programming from Amazon.com



Vulnerability Management for Dummies

Our friends at Qualys are offering free copies of the electronic version of Vulnerability Management for Dummies to Tech-FAQ readers.

Vulnerability Management for Dummies:

  • Explains the critical need for vulnerability management
  • Details the essential best-practice steps of a successful vulnerability management program
  • Outlines the various vulnerability management solutions - including the advantages and disadvantages of each
  • Highlights the award-winning QualysGuard vulnerability management solution
  • Provides a ten point checklist for removing vulnerabilities from your key resources
Bookmark How can I find security vulnerabilities in my source code?
Virus Scan
Try a free virus scan at Kaspersky today.

Latest Blog Posts


Copyright 2008 Tech-FAQ. All rights reserved.