The alarming state of secure coding neglect
A survey reveals a deep divide between developer aspirations for security and organizational practices.
A survey reveals a deep divide between developer aspirations for security and organizational practices.
Crack in rock (source: rkit via Pixabay)
Only a quarter to a half of organizations do what their own programmers say is needed for the security of their code: automated code scans, peer security code reviews, and further code reviews by security experts. That’s one of the key findings in a survey of 430 professionals—mostly everyday programmers—carried out during December 2016 and January 2017 by O’Reilly Media along with the Software Improvement Group (SIG), an international consultancy firm specializing in software quality measurement and advice. [1]
Key findings include:
Let’s pause to consider the hostile environment in which code is running, and the dangers raised by insecure code:
These examples were chosen because of the extensive news coverage they generated; hundreds of others could be added.
Although programmers ideally are trained to code securely, that by itself is insufficient to prevent security flaws. According to Rob van der Veer, a security consultant at SIG with experience as a computer scientist and CEO of various software firms, programmers are typically rewarded for adding features, which are highly visible to managers, sales teams, and customers. Anything programmers don’t make visible, for example, security, is less important.
With an idea of how important specialized security activities are, let’s now turn to the survey and illustrate how it informs our key findings.
About 80% of respondents believed it important to show code to independent security experts, while another 16% said that it would be enough for developers to check each other’s code regularly. It’s notable that only 4% believe penetration testing, the most common kind of security assessment, to be sufficient. Penetration testing consists of creating common attacks, manually or through automated tools, to see whether an attacker can gain unauthorized access to the system. Although acknowledging its value, van der Veer cited several limitations of penetration testing:
Nearly 50% of respondents said independent expert reviews are worth their price, but their organizations lack the budget for it. A little more than 10% said the service was not worth the price, and a similar number said that suitable experts were unavailable. Fewer than 20% of respondents actually conduct such reviews.
Respondents were also asked whether various other security practices were in place. Choices included: 1) they were sufficiently in place, 2) they were somewhat in place, 3) they should have been in place but were not, and 4) they weren’t relevant. The details below tell the same basic story in every case—only a minority of respondents think the practice is sufficiently in place, and a large chunk always reports they want to perform the practice and cannot do it at all.
Static code analysis tooling
This was reported as being used by 25% of respondents. One-third of those who didn’t use it said it was too expensive. The rest of the non-users were fairly evenly divided among other explanations: tools were not available for their technology, were too hard to use, had too many false positives, or were not usable in Agile development.
Code reviews
Respondents were polled about several different types of reviews. We don’t know how much overlap there is between the types.
In all these cases, less than half the time are the code reviews considered sufficiently in place.
Time limitations were also identified by several respondents, who complained that start-ups could not devote extra time to security or that customers did not value security enough to tolerate extra time for it. While one could forgive small companies for a lack of resources—and perhaps for racing toward product release without leaving time for a security check—in this survey:
One would expect companies of these sizes to have room for security code reviews, if they were a priority.
Organizations do somewhat better in setting standards than in following through. For instance, respondents indicated that 69% of organizations have company-wide security requirements, while 60% impose guidelines for secure coding. These numbers are higher than those shown in the previous section for security practices—but still come nowhere near being universal. And as before, fewer than half of the respondents said that the standard-setting is done sufficiently.
Since this is the first time we’ve conducted this survey, we don’t don’t know whether organizations have evolved and might have improved their security practices. However, the low usage of security reviews and testing tells us that many more Sonys will generate lurid news stories before management realizes the importance of security.
Why is there such a large gap between the aspirations of programmers and their actual practices? The experience of Software Improvement Group consultants provides a possible answer: although programmers in the cubicles appreciate the importance of expert feedback on their code, top-level managers reject their requests. According to van der Veer, executives and boards of directors fail to provide the time or money needed to carry out inspections.
Each time a new security breach hits the news, one might expect other organizations to be “scared straight.” (This term comes from an old initiative to reduce criminal behavior among teenagers by making them tour jails—an initiative that also failed.) The costs of dealing with breaches, no matter how demoralizing, never seem to justify the extra time and money that good security requires. Additionally, although a security flaw is sometimes traceable to a single line of code—as in Apple’s famous “curly braces” bug—breaches are often a simultaneous failure on several levels of the software stack and its implementation. So each company may be able to shift blame onto other actors, and even the user.
Therefore, instituting secure coding practices seems to require a massive culture change over many years—similar to the culture changes that led to Agile programming, test-driven development, continuous integration, and related quality practices. And like those, security proponents will probably have to demonstrate improvements to the bottom line: less maintenance, improved customer satisfaction, or other measurable incentives to bring everyone on board.
Hopefully, the organizations that get the message early will thrive.
This post is a collaboration between SIG and O’Reilly. See our statement of editorial independence.