Security research often requires a wide variety of tools and approaches. Open source tools can offer an accessible and powerful way to enhance security-testing capabilities. If you work in the security space, here are several open source tools that might be worth adding to your security tool arsenal.
Doxygen Documentation Generator
Doxygen is a documentation generator for a variety of popular programming languages. It allows users to extract the code structure from source files and highlight relationships between the code elements. This tool essentially provides a visual representation of your code, and it can help provide a deeper, more comprehensive understanding of particularly complex code bases. Doxygen allows users to analyze the flow of the code and can, for example, help visually inspect whether assets flow through input validation functions at expected execution stages.
Being able to visually examine large or complex code bases can supplement existing manual code reviews and fuzzing, and it can help pinpoint issues that you might have otherwise overlooked. (Here’s a short list of steps you can follow to create a call graph with Doxygen.) For example, have you ever wondered how the Linux sudo command works? Here’s a graphic representation of the code made with Doxygen.
Z3 Constraint Solver
Next is Z3, a constraint solver tool that can complement software analysis, verification, and fuzzing tools. It provides bindings for several programming languages, including C/C++ and Python. Z3 tries to find solutions that satisfy a specific set of defined constraints. This can become useful, for example, to cross-check input validation constraints to find potential escapes that could result in unwanted states.
While manual code review and fuzzing can help identify problematic states, Z3 adds comprehensive mathematical and logical verification into the mix, which provides an extra level of review for the code. You can use this tool to model a feature or a particular block of code to test out the constraints and discover potential hidden issues like buffer overflow, integer wraparounds, improper access to memory, and more. For example, Trail of Bits published a blog post describing how it used Z3 to find the Heartbleed vulnerability. The post walks through turning real code into functions and those functions into Z3 constraints, which results in a combination of values that overflows a CPU register and successfully calls a memory allocation routine with an invalid value, as visualized below.
LibFuzzer Fuzzing Engine
The third tool is an open source fuzzer called libFuzzer. (It’s worth noting that American fuzzy lop, or AFL, has been a prevalent choice for years, and libFuzzer is growing in popularity.) These types of tools are valuable to security research and assurance efforts in order to complement existing input-validation testing efforts. LibFuzzer typically looks for inputs that will cause a system to crash or hang. The fuzzing engine can take initial inputs and enable additional permutations to progressively explore the program. LibFuzzer makes it relatively straightforward to create a harness through which it can interact with and run fuzzed inputs against your program.
Another great benefit is libFuzzer’s ability to intercept compare operations to determine which values would allow reaching a broader set of coverage. This avoids the need to hard-code code constants or magic numbers to get past conditional checks, and simplifies the work of the fuzz tester.
Gcov Code Coverage Tool
The final tool, Gcov, is part of a tool category called code coverage, which goes hand-in-hand with fuzzers. Since fuzzers can run continuously for days or weeks at a time, it can be challenging for users to understand just how much of the code base they’ve covered, including which lines of code have been accessed (and which haven’t). Code coverage tools provide a detailed view of a fuzzer’s progress over time, allowing fuzzer adjustments that maximize the fuzzer’s code coverage to help ensure that most aspects of the code flow/code base are verified. This helps increase confidence in the results. Here’s a quick example that shows the lines covered in blue and the lines that weren’t hit in red.
Strengthen Your Security with Open Source Solutions
The research and testing community is always on the hunt for better tools that can be used in the fight to build and deploy more resilient and reliable technology. There are many open source options that are not only simple but can be highly effective complements to your existing security toolkit.
This article touched on Doxygen, Z3, libFuzzer, and Gcov, but there are a wide range of other tools and frameworks to explore, such as address sanitizers, source-code analysis tools, and domain-specific fuzzers, among others. Take some time to assess new open source solutions that can strengthen your security arsenal and improve your security research and assurance efforts.
Maggie Jauregui, Security Researcher, Programmable Solutions Group at Intel
Maggie Jauregui is a firmware and hardware FPGA security researcher for Intel’s Programmable Solutions Group. Throughout her career, she has presented and delivered training presentations on firmware … View Full Bio