CWE explained: weakness types behind CVEs
A CVE ID names one vulnerability in one product. A CWE ID names the kind of mistake behind it: SQL injection, a heap buffer overflow, a missing authorization check. CWE helps you see patterns in your findings and in your own code.
What CWE is
CWE (Common Weakness Enumeration) is a catalog of software and hardware weakness types maintained by MITRE. Each entry has an ID, a description, examples, typical consequences and ways to prevent it. Entries have an abstraction level:
- Pillar and Class: broad, such as CWE-664 (improper control of a resource through its lifetime).
- Base: specific enough to point at a fix, such as CWE-89 (SQL injection).
- Variant: tied to a language or technology.
The catalog groups entries into views. The Research Concepts view (CWE-1000) is the full tree. The Software Development view (CWE-699) is organised for developers. CWE-1003 is a reduced view for mapping published vulnerabilities, used by the National Vulnerability Database.
CWE in CVE records
A CVE record lists its weakness types under "problem types". The CNA sets them, and the CISA ADP container may add one. The famous Linux cases:
| CVE | CWE |
|---|---|
| CVE-2021-44228 Log4Shell | CWE-502 Deserialization of Untrusted Data, plus CWE-400 and CWE-20 |
| CVE-2024-3094 xz backdoor | CWE-506 Embedded Malicious Code |
| CVE-2024-6387 regreSSHion | CWE-364 Signal Handler Race Condition |
| CVE-2023-4911 Looney Tunables | CWE-122 Heap-based Buffer Overflow |
| CVE-2014-0160 Heartbleed | CWE-125 Out-of-bounds Read (added by CISA) |
| CVE-2014-6271 Shellshock | CWE-78 OS Command Injection (added by CISA) |
Older records often do not have a CWE from the CNA. The NVD uses two placeholders when it cannot map one: NVD-CWE-Other and NVD-CWE-noinfo.
Read the CWE of a record from the CVE List:
curl -s https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2023/4xxx/CVE-2023-4911.json \
| jq -r '.containers.cna.problemTypes[].descriptions[] | "\(.cweId) \(.description)"'
CWE-122 Heap-based Buffer Overflow
The CWE Top 25
Every year MITRE publishes the "CWE Top 25 Most Dangerous Software Weaknesses". The 2025 list is ranked from the 39,080 CVE records published between 2024-06-01 and 2025-06-01, and starts with:
| Rank | CWE | Weakness | CVEs in KEV |
|---|---|---|---|
| 1 | CWE-79 | Cross-site scripting | 7 |
| 2 | CWE-89 | SQL injection | 4 |
| 3 | CWE-352 | Cross-site request forgery | 0 |
| 4 | CWE-862 | Missing authorization | 0 |
| 5 | CWE-787 | Out-of-bounds write | 12 |
| 6 | CWE-22 | Path traversal | 10 |
| 7 | CWE-416 | Use after free | 14 |
| 8 | CWE-125 | Out-of-bounds read | 3 |
| 9 | CWE-78 | OS command injection | 20 |
| 10 | CWE-94 | Code injection | 7 |
The score multiplies how often a weakness is mapped to a CVE in the NVD by the average CVSS score of those CVEs. The KEV column tells another story: OS command injection ranks 9th, but of all 25 entries it has the most CVEs on the KEV list. For a server owner, the KEV column is the more useful one.
How to use CWE
For your own code. If you write web applications, the Top 25 is a short checklist. Cross-site scripting, SQL injection, CSRF, missing authorization and path traversal are the first five web entries; each CWE page lists prevention methods. Content-Security-Policy, covered in HTTP security headers, limits the damage of cross-site scripting but does not fix it.
For findings on your servers. CWE says little about urgency. A CWE-787 out-of-bounds write can be a remote code execution in a TLS library or a crash in a file parser nobody feeds untrusted input. Rank by exploitation and exposure, and use the CWE to understand what kind of fix to expect: a memory safety bug needs a new package, a missing authorization check can sometimes be mitigated in a reverse proxy.
With care. Mapping a CVE to a CWE is done by people, often fast. Broad entries such as CWE-20 (improper input validation) say little. When the CWE and the description disagree, trust the description.
Look up any entry at https://cwe.mitre.org/data/definitions/<number>.html, for example CWE-79 at https://cwe.mitre.org/data/definitions/79.html.
Sources
- CWE, MITRE (catalog, abstraction levels, views CWE-1000, CWE-699, CWE-1003)
- 2025 CWE Top 25 Most Dangerous Software Weaknesses (ranks, KEV counts) and its methodology (time window, score from frequency and average CVSS)
- CVE records with their problem types: CVE-2021-44228, CVE-2024-3094, CVE-2024-6387, CVE-2023-4911, CVE-2014-0160, CVE-2014-6271
- NVD: CWE over time and placeholders
Check your servers every day
The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.