The CWE top 25 is a list of the most common software defects that give rise to CVE being reported.
Mitre, the organisation behind the Common Vulnerabilities and Exposures database, has scanned some 25,000 CVE reports logged within their database and the NIST National Vulnerability Database in order to compile the list for 2019. By taking into account both the number of CVE reported and their severity, the relative risk of different kinds of software vulnerability can be ranked. The full Common Weakness Enumeration list can be found here.
Last updated in 2011, the new list is actually based on the CVE raised in 2017 and 2018.
The top three most dangerous software errors are:
1 – Improper Restriction of Operations within the Bounds of a Memory Buffer
This type of defect most often occurs in languages such as C and C++ where the programmer has to manually manage the allocation of their own memory within the software.
A simple example is a Buffer Overflow. In this situation an amount of data is accepted into an input buffer (location in memory) and copied to another location (the output buffer) without first checking that the amount of data in the input is smaller than the amount of memory allocated to the output buffer. If the amount of copied memory is larger than the output buffer size, the copy operation continues and overwrites the memory adjacent to the output buffer. Where an attacker controls the contents of the data being copied it can then cause program crashes, corruption of data or even the execution of code introduced by the attacker.
2 – Improper Neutralisation of Input During Web Page Generation (‘Cross-site Scripting’)
Cross Site Scripting, or XSS, vulnerabilities can happen when:
- A web application allows arbitrary data to be input and stored
- The web application then displays that data on a webpage without modification
- The resulting webpage is viewed by a web browser and implicitly trusts all the content which has been delivered from the same web server
The most common XSS attack motivation is to harvest information from user cookies stored in the browser and send these to the attacker who can then use the information to help execute the next stage of an attack.
There are three flavours of XSS attack:
A reflected XSS attack occurs when the server reads data from an HTTP request and reflects it back to the browser in the response where it is executed by the browser.
A persistent XSS attack occurs when the attacker is able to store their attack code in the web-applications database – as a forum post for example. Then when that data is included in a webpage viewed by another users, the code is executed by the users browser.
3 – Improper Input Validation
When software does not validate (or incorrectly validates) the data input by a user or API call and that data is later used to control the execution of the software, vulnerabilities occur which can be exploited.
For example, a programmer of server-side code may incorrectly assume the data received from the client which comes from either cookies or hidden forms on a web-page is not able to be modified. If an attacker uses a proxy or custom application to alter the input data it can cause the server-side software to perform unexpected operations – such as altering the discount on an order in an ecommerce site or changing the account that will be updated with the supplied data.
Unvalidated data can also cause program crashes or enable other attacks to take place such as SQL injections.
Implications of the CWE top 25 list
Security Managers who appreciate the risks described in the CWE top 25 list are able to make more informed choices about how to allocate limited resources for security testing and monitoring. Because the CWE list is weighted to include the severity or impact of a vulnerability – not simply the number of times it has been reported – it is possible to get an appreciation of the risks posed by different types of vulnerability.