Source Code Security Audit Tools

This page will give you some hints about which tools might be used to gather useful information during a code review such as debuggers, static and dynamic code analysis tools etc.

cscope

With the help of cscope, reviewers can comfortable search for symbols in the source code of programs. It allows to search for definitions/declarations and calls of certain functions, macro definitions etc.. Most Linux and BSD distributions ship cscope.

http://cscope.sourceforge.net/

ctags

Ctags builds a cross-reference file (similar to cscope) from a source code tree called a “tag-file”. This allows reviewers with the help of a tag-file supporting editor (such as vim) to follow function calls while auditing and to step down into functions just as one would do at runtime with gdb. Despite its name, ctags supports a plenty of languages, not just C.

http://ctags.sourceforge.net/

exec-notify

exec-notify globally shows which programs are executed on a system. This allows to track down shell escaping problems in larger applications which execute external programs every now and then or in bootup scripts.

http://www.suse.de/~krahmer/exec-notify.c

findbugs

FindBugs looks for bugs in Java programs. It is based on the concept of bug patterns. A bug pattern is a code idiom that is often an error.

http://findbugs.sourceforge.net

gdb

The GNU Debugger - “gdb” - is a general purpose debugger which also helps in source code reviews if you want to estimate whether a certain vulnerability is really exploitable. This is not always the case since the generated binary code makes exploitation impossible for example due to stack alignments or optimizations.

http://sourceware.org/gdb/

inotify

inotify can observe directories like /tmp for changes, e.g. insecure creation of files etc.

http://www.suse.de/~krahmer/inotify.cc

insight

insight is a Tcl/Tk based graphical frontend to gdb with many features and an intuitive interface. What sets insight apart from other gdb GUIs is its active and continuous development, and its integration with sourcenav (see below).

http://sourceware.org/insight/

JLint

A static analysis tool to find race conditions, locking errors, null pointer uses, and a number of other problems in Java programs.

http://artho.com/jlint/index.shtml

kscope

kscope uses the index file generated by cscope and gives developers a graphical frontend to generate call-graphs, search and edit functions etc.. A very convenient tool to browse large software projects such as the Linux kernel.

http://kscope.sourceforge.net/

lsof

List open files - “lsof” - is a tool to gather information about processes' open file descriptors (not only files itself). This information includes the name and PID of the process, the type of file and so on. Many Linux and BSD distributions ship lsof.

ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/

ltrace

ltrace allows to trace the execution of library calls in programs and processes. By carefully observing the order and arguments of certain calls such as open(3) or chown(3) one can spot simple kinds of race conditions.

http://ltrace.alioth.debian.org/

PMD

PMD scans Java source code for potential problems.

http://pmd.sourceforge.net/

sourcenav

sourcenav, or the Source-Navigator, is a source code analysis tool. It aids the process of code visualization during code reviews by displaying the relationships between functions and generating call trees. Also, it helps in analyzing the propagation of a change in the code to other source modules.

http://sourcenav.sourceforge.net/

strace

strace, similar to ltrace, allows to trace the execution of system calls in programs and processes. This helps to determine whether arguments are passed correctly during runtime, for example to chroot(2) or execve(2). Most Linux distributions ship strace and install it by default. BSD systems have a similar tool called “truss”.

http://sourceforge.net/projects/strace/

Other Resources

The Debian Security Audit Project maintains a list of Security Auditing Tools, mostly for automated static source code analysis, along with Automated Audit Examples.

 
tools.txt · Last modified: 2009/09/23 03:05 by krahmer
 
Recent changes RSS feed Creative Commons License Donate to DokuWiki Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Powered by OpenVZ Powered by Openwall GNU/*/Linux Bookmark and Share