The 2023 list of the most dangerous software weaknesses (CWEs) includes critical flaws related to memory management, input validation, and access control. Web security is a major theme, with SQL injection and XSS making the top 3. This post examines trends and practical takeaways from the latest CWE Top 25.
The 2023 edition of the CWE Top 25 Most Dangerous Software Weaknesses classification sees the same top 3 weaknesses as last year – all veterans of the list since its inception in 2009. The list is ranked according to the impact and frequency of the resulting vulnerabilities in 2021 and 2022, giving a pretty good idea of where the biggest dangers lie. We haven’t looked at the SANS/CWE Top 25 since 2021, so let’s go through the methodology, the biggest movers (spoiler: includes SQL injection), and ways to use the list in practice, especially in web security.
The full CWE database is compiled and maintained by the MITRE Corporation. The top 25 project was called the SANS/CWE Top 25 in previous years, but the involvement or name of the SANS Institute is no longer mentioned on the CWE site.
The most impactful weakness by far is Out-of-bounds Write, which can allow for buffer overflows and other attacks that overwrite memory, typically to achieve code execution. While only possible in programs that use a language with direct memory management (most often C/C++), this weakness is a clear #1 both in terms of the aggregated score and prevalence in known exploited vulnerabilities (see below for the CWE Top 25 methodology). In total, five types of memory management errors have made the list, including three in the top 10.
The #2 and #3 spots are occupied by cross-site scripting (XSS) and SQL injection – two of the oldest web security flaws that are clearly not going away. In terms of scores, the top three are way ahead of anything else on the list, with SQL injection scoring 34.27 and the next weakness less than 17. Again, this indicates that reported vulnerabilities (CVEs) resulting from these flaws are both numerous and severe. There are a total of four web-specific weaknesses on the list (also CSRF and SSRF) and at least 10 other flaws that are commonly exploited in web application attacks.
Notable changes since our last look at the list in 2021 include big upward moves for several flaws typical of web applications, with SQL injection moving up from #6 to #3, server-side request forgery (SSRF) jumping five places to #19, and command injection advancing from #25 to #16 as the biggest single mover. Towards the end of the list, four CWEs have dropped off, including XML external entity injection (XXE), while four others have moved into the top 25, most notably code injection. Overall, only the ordering has changed in the top 10, indicating that very similar attack patterns are used, targeting similar weaknesses.
Items in the CWE database are various software and hardware weaknesses that, if implemented in production, can lead to vulnerabilities. The CVE database, on the other hand, lists known and reported vulnerabilities in specific products. A common security weakness like SQL injection (CWE-89) will be listed as the cause of hundreds of different CVEs involving an SQL injection attack (such as CVE-2023-34362 for MOVEit Transfer).
Tl;dr: CWEs are what could go wrong. CVEs are what did go wrong.
Work on the Top 25 for 2023 started by mapping each of the 43,996 CVE records for vulnerabilities reported in 2021 and 2022 to one or several CWEs as root causes. Each time a specific CWE was a root cause for a CVE, the score for that CWE was increased based on the prevalence and severity of the CVE. The formula used ensures that weaknesses only get a high score if they lead to vulnerabilities that are both frequent and severe. Special focus was given to issues from the Known Exploited Vulnerabilities (KEV) Catalog created in November 2021 by the Cybersecurity and Infrastructure Security Agency (CISA).
One important aspect of the methodology is that, where relevant, entire attack chains are counted, not just single root causes. If a reported CVE includes an attack that exploits more than one type of weakness, that CVE will be counted for all the CWEs. Most real-world attacks rely on chaining to escalate from initial access to final compromise, and every step along the way is required for the attack to work – see our analysis of the MOVEit Transfer attack for a recent example. Treating each weakness in a chain as the root cause provides a more realistic picture of how software flaws translate to vulnerabilities.
Both the CWE Top 25 and the OWASP Top 10 are compiled by analyzing CWEs and CVEs but differ in scope and methodology. The CWE Top 25 applies to all types of software and lists CWEs based on the frequency and severity of resulting CVEs. The OWASP Top 10 is only for web applications and aims to group CWEs into broader categories that are then ranked. Recent years have seen the OWASP Top 10 risk categories become increasingly high-level.
There are many ways to slice and dice the top CWEs, but all the listed weaknesses fall into one of three broad categories:
Because the CWE scores are directly correlated with CVEs from 2021 and 2022, the Top 25 reflects the major vulnerabilities reported during that period. Accordingly, the list is skewed in favor of the most severe and widespread vulnerabilities, which are most likely to be reported. If you browse the CVE database or (even better) CISA’s KEV catalog, you will notice that the majority of severe vulnerabilities are for various network appliances, with buffer overflows and other memory-access attacks commonly listed as the root cause. This explains the (continued) top position of out-of-bounds writes, as such weaknesses are both severe and reported in a relatively large proportion of CVEs.
The major practical takeaways for software developers correspond to the three overarching themes across the top 25:
For web applications, the clear takeaway is to make sure you test for and eliminate at the very least SQL injection and cross-site scripting flaws. With major CVEs currently under exploitation for both SQLi (like CVE-2023-34362 in MOVEit) and XSS (like CVE-2023-24488 in Citrix Gateway), systematic security testing from development through staging and into production is a must.
To learn how to build security testing into your application security program, read the free Invicti white paper on enterprise web security best practices.