The vast majority of security breaches encountered today are a direct result of insecure code. Consequently, the protection of computer systems critically depends on the rigorous identification of vulnerabilities in software, a tedious and error prone process requiring significant expertise. Unfortunately, a single flaw suffices to undermine the security of a system and thus the sheer amount of code to audit plays into the attacker’s cards. We present a method to effectively mine large amounts of source code for vulnerabilities. To this end, we introduce a novel representation of source code called a code property graph that merges concepts of classic program analysis, namely abstract syntax trees, control flow graphs and program dependence graphs, into a joint data structure. This comprehensive representation enables us to elegantly model templates for common vulnerabilities with graph traversals that, for instance, can identify buffer overflows, integer overflows, format string vulnerabilities, or memory disclosures. This demo aims to show that graph databases and the typical program representations developed in compiler construction are a match made in heaven, allowing large code bases to be mined for patterns using complex descriptions encoded in simple, and not so simple graph database queries. We introduce the open-source code analysis platform Joern that implements our approach. Joern parses C/C++ code using a fuzzy parser capable of generating code property graphs from possibly incomplete C/C++ code. These graphs are then stored in a Neo4J graph database that can be queried using an extensible query language based on the graph traversal language Gremlin. While initially developed with vulnerability discovery in mind, it is our hope that the code property graph may be useful in other areas of software engineering and computer security where robust parsing is in order. We will therefore give a detailed tour of the information made accessible by Joern before we demonstrate the tool's capabilities as a bug-hunting tool with a real world code base.
Link to the paper
Joern web page