Open source is eating the world, or so Marc Andreesen famously once claimed.
This is a good thing overall. Open-source communities are growing in number and popularity. Organizations of every size are embracing it, including the U.S. Department of Defense, and many are encouraging employees to contribute code to the open-source communities. After all, a well-supported open-source community reduces support costs and risks.
But if we are going to rely on open source so widely (and we are), we have an obligation as security professionals to understand what we’re deploying.
Code hygiene refers to the “cleanliness” of an application – in particular, minimizing vulnerabilities and code complexity. Good code hygiene requires visibility into all the components used to build the application, along with information on characteristics that are important to us for a particular use case. Several activities in the software development lifecycle support good code hygiene, including threat modeling and automated testing (i.e., static and dynamic analysis).
The shortcoming of each of these activities is that they only provide a point-in-time snapshot of code hygiene, and can’t account for a changing threat space.
Think of it this way: you go to the dentist and get a clean bill of health (no cavities, your gums are fine, and even your dog isn’t put off by your halitosis). That’s great news, but it doesn’t mean you should stop brushing or flossing, or start opening beer bottles with your teeth. Ongoing diligence is required. If we learn tomorrow that carrots cause cavities, we need to adjust our dental care strategies.
The same is true with open-source security. Security-conscious organizations will consider third-party components, including open-source ones, as potential risks. Appropriate diligence will include assessing the historical vulnerability density of the projects and community activity. While getting a clean bill of health for your open-source review is good, the threat landscape is dynamic. More than 4,000 new vulnerabilities were disclosed by the National Vulnerability Database in open-source components in 2014 alone. The fact that your open-source code bases are free from vulnerabilities today doesn’t mean you can ignore them for the next year.
Know Your Code
A fundamental rule of security is that you must be aware of the threats you face to defend against those threats. Because open source is so easy to add to a code base, organizations often have little visibility into the components they are using, and the associated risk that comes along for the ride.
Even within organizations with mature policies for open source use, controls that enforce those polices are often missing. In the typical organizations we speak with, security personnel are often in the dark about which open-source projects are used. Most rely on manual processes which are unreliable, inaccurate, and unenforceable.
For example, a large financial services institution I spoke with recently was very specific about their policies for using third-party code. They insisted on a listing of licenses, alternative libraries, code complexity, and vulnerability history before approving any open source for internal use. All good, right?
They also acknowledged, however, that their policies were “unenforceable”; no controls existed to ensure that only the specific versions of approved projects were used, or even that unapproved components could not enter the code base. Much more common is the defense contractor who asks each development lead “what did you use?” so they can update their end-user license agreements. In both cases, the results of the queries end up in spreadsheets, often never to be opened again.
Christmas for attackers…
The announcement of open-source vulnerabilities like Heartbleed, Shellshock, and Poodle are like Christmas to attackers. They combine the characteristics of a target-rich environment, publicly disclosed vulnerabilities, and a “pull” support model (you, as the user, are responsible for knowing about and updating the open source you use). We’re even polite enough to publish exploits for most of these, and YouTube videos to show how to use them. To avoid being the latest victim, talk to your head of application development and find out:
- What policies exist for open source?
- Can they produce a list of components in your applications, and how did they create that list?
- What controls do they have to ensure nothing gets through?
- How are they tracking vulnerabilities for all components over time?
We all know that security is ephemeral. An important part of maintaining security is understanding what open source code you’re consuming, and how that is affecting the health of your applications over time.