KHAGAN AYDIN

The OWASP Top 10 for 2017, Explained

Three new risks, two retirements, and a lesson in how the list is made.

· 13 min read

The final 2017 edition of the OWASP Top 10 came out on November 20. It is the first new edition in four and a half years, and it arrived late, after a draft in April drew enough criticism to send the project back to its data. That history matters, because it explains what is on the list now and how much weight each item can carry.

This is the companion to my walk through the 2013 edition. Below: how the list was made, what changed, what each of the ten means in practice, and the first defense I would put in place for each one. Longer essays on the individual items will follow.

How this list was made

The first draft went out for public comment in April 2017. It kept most of the 2013 list and added two entries: Insufficient Attack Protection at number seven and Underprotected APIs at number ten. Both drew heavy pushback, for the same reason. Neither describes a mistake a developer writes into code. The first was really a demand that applications detect and block attacks while they run, which read to many in the field like a product category. The second named an architecture, not a weakness. People also questioned how independent the project’s leadership was.

OWASP changed the process. In June, the project’s longtime leaders handed it to a new team, and working sessions at OWASP’s summit that month settled a new method: most places ranked by data, up to two chosen by practitioners looking ahead. The call for vulnerability data was reopened until September 18, with a public survey alongside it. A second draft followed in October, and the final list in November.

The final edition rests on two kinds of evidence.

Data. The call for data drew more than 40 submissions. The team could use data from 23 contributors, covering about 114,000 applications. Eight of the ten places come from this data.

A survey. In 516 responses, practitioners ranked the emerging weaknesses they expect to matter most over the next few years. Two places, Insecure Deserialization and Insufficient Logging and Monitoring, came from that vote.

Each item is then rated on four things: how easy it is to exploit, how common the weakness is, how easy it is to detect, and how bad the technical damage is. The “how common” part comes from the data, as the share of applications where the weakness turned up at least once.

Here is the point most summaries skip. The data measures how many applications had a weakness, as found by the tools and testers who sent it in. It does not measure how often a weakness is exploited, or how much it costs when it is. And tools find what they are built to find. XML External Entities (XXE) earned its place mainly on data from static analysis tools, which are good at spotting an XML parser with risky settings. Missing logs do not show up in a scanner’s report, which is exactly why that item had to come from a survey. Read every rank on this list with that in mind.

What changed since 2013

2013 2017
A1 Injection A1 Injection
A2 Broken Authentication and Session Management A2 Broken Authentication
A6 Sensitive Data Exposure A3 Sensitive Data Exposure
(new) A4 XML External Entities (XXE)
A4 Insecure Direct Object References and A7 Missing Function Level Access Control A5 Broken Access Control
A5 Security Misconfiguration A6 Security Misconfiguration
A3 Cross-Site Scripting A7 Cross-Site Scripting
(new) A8 Insecure Deserialization
A9 Using Components with Known Vulnerabilities A9 Using Components with Known Vulnerabilities
(new) A10 Insufficient Logging and Monitoring
A8 Cross-Site Request Forgery dropped
A10 Unvalidated Redirects and Forwards dropped

Four things to take from the table.

Two access control items became one. In 2013, reading another user’s record by changing an ID and calling a function you should not reach were separate entries. They are the same failure: the server never checked whether this user may do this thing to this object. Merging them into Broken Access Control is the most sensible change in the edition.

Two items left, and neither is solved. Cross-Site Request Forgery dropped because many frameworks now ship protection against it, and the data found it in only about 5 percent of applications. Unvalidated redirects showed up in about 8 percent and lost their place to XXE. Neither number means the bug is harmless. Five percent of all applications is a great many applications, and in each of them the attack works exactly as it always did. If your stack does not protect forms by default, or someone switched the protection off for one endpoint, everything in my essay on CSRF still applies. The same goes for open redirects.

Three items are new. XXE comes from the data. Insecure Deserialization and Insufficient Logging and Monitoring come from the survey, so they are a forecast by practitioners rather than a measurement. I think the forecast is right, for reasons below, but treat those two ranks as a warning, not a count.

The way we build changed. The release notes say plainly why the list was rewritten: single page applications in Angular and React, microservices in Node.js and Spring Boot, and old code that never expected the internet now sitting behind an API. Underprotected APIs did not survive as its own item. Instead, the final text treats an API as one more door into every risk on the list, which is the right way to think about it.

A1. Injection

Number one again, as in 2010 and 2013. What changed is where it lives. The 2017 text names SQL, NoSQL, operating system commands, object relational mappers (ORMs, the libraries that build SQL for you), LDAP, expression languages and OGNL, the expression language inside Apache Struts. A login endpoint that passes a JSON body straight into a MongoDB query is injectable without a single quote character:

POST /login
Content-Type: application/json

{"username": "admin", "password": {"$ne": ""}}

If the code drops both fields into the query as they arrive, the database reads the password field as a condition, “not equal to empty,” which any stored password satisfies. The attacker is logged in as admin.

First defense: keep data out of the command. Parameterized queries for SQL, as in my 2013 essay on SQL injection. Argument lists instead of shell strings. And for JSON input, check that every field has the type you expect before it gets near a query.

A2. Broken Authentication

Session management dropped out of the name, but not out of the item. The emphasis moved to credential stuffing: attackers take username and password pairs leaked from other sites and replay them against yours, by the million, with scripts. Your password storage can be perfect and accounts still fall, because the user’s password was already public.

In June 2017 the United States National Institute of Standards and Technology published new password guidance, Special Publication 800-63B. It says to stop forcing regular password changes and stop demanding mixes of character types, and to start checking new passwords against lists of passwords already exposed in breaches. The 2017 Top 10 points to it.

First defense: multi-factor authentication wherever you can offer it, limits on failed logins per account and per source, and a breached password check at signup and at every password change. The 2013 basics in my essay on authentication still hold underneath.

A3. Sensitive Data Exposure

Up from sixth to third. The usual findings have not changed: data sent without encryption, old protocols and ciphers, weak password hashing, keys stored next to the data they protect. What changed is the cost. The European Union’s General Data Protection Regulation applies from May 25, 2018. In most cases it requires a breach to be reported to the regulator within 72 hours of becoming aware of it, and its fines can reach 4 percent of worldwide annual turnover.

First defense: a map of where personal data lives, including the copies nobody counts, such as logs, backups, analytics exports and test databases loaded from production. A 72-hour clock assumes you can say quickly what was taken, and you cannot do that if you do not know what you hold. Delete what you have no reason to keep. The controls in my 2015 essay (TLS with Strict Transport Security, slow salted password hashing, keys stored apart from the data) then protect what remains.

A4. XML External Entities (XXE)

New. An XML document can declare an entity, a named placeholder, whose value is a file path or a URL. A parser that resolves it fetches the file and pastes its contents into the document:

<?xml version="1.0"?>
<!DOCTYPE order [ <!ENTITY x SYSTEM "file:///etc/passwd"> ]>
<order><note>&x;</note></order>

If the application shows the note back to the user, the attacker is reading the server’s files. Point the entity at an internal address instead and the server makes requests into your own network for the attacker. Nest entities inside each other and a few hundred bytes of XML expand until the server runs out of memory.

The catch is that XML hides in places nobody calls XML: SOAP web services, SAML single sign on messages, uploaded SVG images and Office documents, which are zipped XML. Many parsers resolve external entities by default.

First defense: switch off document type declarations in every parser you use. In Java:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);

Every XML library has an equivalent setting. Find each parser in your code and libraries, and set it.

A5. Broken Access Control

The merged item. It covers changing an ID to reach someone else’s record, browsing straight to an admin page that has no server-side check, raising your own role by editing a cookie or token, and APIs that let any website call them with the user’s credentials. Scanners are weak here, because only a person who knows the business knows who should see what. Tools miss it and developers rarely test for it, which is why it stays common.

First defense: deny by default, and check on the server, on every request, whether this user may perform this action on this record. Put the check in one shared place so a new endpoint cannot forget it. Then test with two accounts at different privilege levels and replay one account’s requests with the other’s session. The 2013 essays on direct object references and function level access control are two halves of this item.

A6. Security Misconfiguration

Down one place, and wider than before. The 2013 version was about default passwords, debug modes and stack traces. Those are still here, joined now by the cloud. In January 2017 attackers wiped and held to ransom more than 27,000 MongoDB databases that were reachable from the internet with no password. In July, it came out that records on about six million Verizon customers had sat in a cloud storage bucket that a vendor had left open to anyone with the address.

First defense: build every environment from the same scripted, hardened configuration, with nothing installed that the application does not use, and check that configuration automatically, the way you test code. Both of this year’s examples came down to configuration nobody looked at, so put the cloud in that check too: which storage buckets anyone can read, and which databases answer from the internet. More in my 2015 essay.

A7. Cross-Site Scripting

Down from third to seventh, and still everywhere. The 2017 text calls it the second most common issue on the list, found in around two thirds of all applications. It ranks lower because the rating counts its usual impact as moderate (severe for stored XSS), not because it went away. Frameworks such as React and the current Ruby on Rails escape output by default, which helps. The bugs that remain sit in the escape hatches those frameworks provide and in single page applications that write data from the URL straight into the page.

First defense: use the framework’s automatic escaping and treat every bypass as a decision that needs review. A Content Security Policy that blocks inline script limits the damage when one still slips through. The context rules in my 2014 essay have not changed.

A8. Insecure Deserialization

New, from the survey. Serialization turns an object into bytes so it can be stored or sent. Deserialization turns the bytes back into a live object. Java, PHP, Python, Ruby and .NET all have built-in formats for this. If an attacker controls the bytes, the attacker chooses which classes get created and what data they hold, and with the right classes available in the application, that becomes running code on your server.

This is not theoretical. In November 2015 a security firm published working exploits against WebLogic, WebSphere, JBoss and Jenkins through one widely used library, Apache Commons Collections, building on a conference talk from earlier that year. Any Java application with that library on its classpath, accepting serialized data, was exposed.

A testing tip: Java serialized data starts with the bytes AC ED 00 05, which is rO0AB once Base64 encoded. Search your traffic, cookies and hidden fields for that prefix.

First defense: do not accept serialized objects from anyone you do not trust. Use a plain data format such as JSON with no type information in it. If you cannot avoid it, sign the data and check the signature before you decode anything. Java’s January 2017 updates added filters that limit which classes may be deserialized; use them as a layer, not as the fix.

A9. Using Components with Known Vulnerabilities

Same place, but this year it stopped being abstract. On March 7, Apache fixed a flaw in Struts, CVE-2017-5638, that let an attacker run commands by placing an OGNL expression in the Content-Type header of a request: an injection bug, shipped inside a component. Attacks on unpatched servers were reported within days. Equifax’s online dispute portal ran an unpatched version, and attackers were inside from mid-May. By October 2, the company put the number of affected people at about 145.5 million. The fix was public for more than two months before the intruders arrived.

First defense: treat the time from a public fix to your patched production as a number you measure and keep to days. That takes an inventory of every library and version, including the ones your libraries pull in, checked against public vulnerability databases on every build with a tool such as OWASP Dependency-Check, and tests good enough that a library upgrade can ship without weeks of manual checking. My 2014 essay covers the traps, including a scanner configured so that it can never fail the build.

A10. Insufficient Logging and Monitoring

New, from the survey, and the one I would have voted for. The 2017 text cites an IBM figure: in 2016, finding a breach took an average of 191 days. Many are found by someone outside the company: a bank seeing fraud, a customer, a journalist. At Equifax the gap was about eleven weeks, from mid-May until the company noticed suspicious traffic on July 29.

The best test for this item comes from the list itself. After your next penetration test, ask your operations team what they saw. If the logs did not record the test clearly enough to say what the testers did, or no alert fired, you would not have seen a real attack either.

First defense: log logins, failed logins, access control failures and server-side input validation failures, each with the user, the source and the time. Send the logs off the server, where an intruder cannot erase them. Alert on patterns, such as one account failing to log in a hundred times or one source trying a thousand accounts. And write down who acts when an alert fires, because an alert nobody owns is a log entry.

Reading the 2017 list

The Top 10 is an awareness document, not a standard. When a contract says an application must be “OWASP Top 10 compliant,” it says very little, because no test can prove an application free of a whole category. If you need requirements a tester can check one by one, OWASP publishes the Application Security Verification Standard; put that in the contract instead.

Look at the new entries side by side and one pattern stands out. XXE is a document that turns out to contain instructions to fetch files. Insecure deserialization is data that turns out to choose which code runs. Both are injection under another name: input the application treated as data, which was really a command. Half of this list is about trusting input. The one new item that is not, logging, is about finding out when that trust was misplaced, before someone outside the company tells you.