Flawfinder is specifically designed to be easy to install and use. After installing it, at a command line just type:
flawfinder directory_with_source_codeand you'll see a list of probable security problems, sorted so the most probable problems are listed first. If you're curious to see what that looks like, you can see the HTML output and text output produced by a simple test C program.
Unlike ITS4 (a similar program), flawfinder is open source software (as defined by the Open Source Definition) and it's fully Free Software (as defined by the Free Software Foundation's GNU project). Feel free to see Open Source Software / Free Software (OSS/FS) References or Quantitative Measures on OSS/FS for more information about OSS/FS. Flawfinder is released under the General Public License (GPL).
Flawfinder works on Unix-like systems today (it's been tested on GNU/Linux), and it should be easy to port to Windows systems. It requires Python 1.5 or greater to run (Python 1.3 or earlier won't work). It's already included in Debian and probably several other GNU/Linux distributions.
Others have found it useful. One user, Darryl Luff, said:
I just installed the 0.21 version of Flawfinder. I tried a few different code checking tools and it's by far the friendliest to use.Joerg Beyer said:
I just sent tons of C/C++ source through flawfinder 1.0. Thanks for the tool, it found several places that I have now fixed.
The current version of flawfinder is 1.01. If you want to see how it's changed, view its ChangeLog.
If you have trouble getting flawfinder here, you can download it from mirrors. For example, version 0.15 of flawfinder is available at http://packetstorm.securify.com/filedesc/flawfinder-0.15.tar.html.
If you're not sure you want to take the plunge to install the program, you can just look at the documentation in PDF or Postscript format. You can even go look at the flawfinder source code.
gunzip flawfinder-*.tar.gz tar xvf flawfinder-*.tar cd flawfinder-* su make install
For RPM files, install them as would normally install an RPM file. If you want to install the RPM file through a command line, this would be:
rpm -Uvh flawfinder-*.noarch.rpm
Flawfinder produces a list of ``hits'' (potential security flaws), sorted by risk; by default the riskiest hits are shown first. This risk level depends not only on the function, but on the values of the parameters of the function. For example, constant strings are often less risky than fully variable strings in many contexts. In some cases, flawfinder may be able to determine that the construct isn't risky at all, reducing false positives. Also, Flawfinder correctly ignores text inside comments and strings (except for flawfinder directives). Flawfinder knows about gettext (a common library for internationalized programs) and will treat constant strings passed through gettext as though they were constant strings; this reduces the number of false hits in internationalized programs. Thus, flawfinder gives better information - and better prioritization - than simply running "grep" on the source code.
Not every hit is actually a security vulnerability, and not every security vulnerability is necessarily found. In fact, note that flawfinder doesn't really ``understand'' the semantics of the code at all - it primarily does simple text pattern matching (though it does ignore comments and strings as it should). Nevertheless, flawfinder can be a very useful aid in finding and removing security vulnerabilities.
Until the time where we've figured out how to merge these dissimilar projects, I recommend that distributions and software development websites include both programs. Each has advantages that the other doesn't. For example, at the time of this writing Flawfinder is easier to use - just give flawfinder a directory name, and flawfinder will enter the directory recursively, figure out what needs analyzing, and analyze it. Other advantages of flawfinder are that it can handle internationalized programs (it knows about special calls like gettext(), unlike RATS), flawfinder can report column numbers (as well as line numbers) of hits, and flawfinder can produce HTML-formatted results. The automated recursion and HTML formatted results make flawfinder especially nice for source code hosting systems. The flawfinder database includes a number of entries not in RATS, so flawfinder will find things RATS won't. In contrast, RATS can handle other programming languages and runs faster. Both projects are essentially automated advisors, and having two advisors look at your program is likely to be better than using only one (it's somewhat analogous to having two people review your code for security).
Flawfinder, RATS, and ITS4 are all discussed in the Linux Journal article Source Code Scanners for Better Code, although note that flawfinder as of version 1.20 can also detect static character buffers. Another somewhat related tool is MOPS.
You might want to look at my Secure Programming HOWTO web page.
You can also view my home page.