# 2024 CWE Top 25 Most Dangerous Software Weaknesses
> Superseded by the 2025 edition: MITRE's 2024 CVE-data ranking of software weaknesses, counted with View-1003 normalisation that favoured broad parent entries.
- Publisher: MITRE / CISA · Edition: 2024 · Released: 2024-11-20 · Status: final
- Items: 25 · Licence of the source: MITRE CWE Terms of Use (copyright MITRE)
- Official page: https://cwe.mitre.org/top25/archive/2024/2024_cwe_top25.html
- Source: https://cwe.mitre.org/top25/archive/2024/2024_cwe_top25.html (read 2026-11-03)
- Canonical page: https://llms-technical-reviews.com/security/cwe-top25-2024/
## Items at a glance
- **CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')** — themes: injection, output
- **CWE-787 Out-of-bounds Write** — themes: output
- **CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')** — themes: injection
- **CWE-352 Cross-Site Request Forgery (CSRF)** — themes: access
- **CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')** — themes: injection, access
- **CWE-125 Out-of-bounds Read** — themes: data-leak
- **CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')** — themes: injection
- **CWE-416 Use After Free** — themes: output
- **CWE-862 Missing Authorization** — themes: access
- **CWE-434 Unrestricted Upload of File with Dangerous Type** — themes: output
- **CWE-94 Improper Control of Generation of Code ('Code Injection')** — themes: injection, output
- **CWE-20 Improper Input Validation** — themes: injection
- **CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')** — themes: injection
- **CWE-287 Improper Authentication** — themes: identity
- **CWE-269 Improper Privilege Management** — themes: access
- **CWE-502 Deserialization of Untrusted Data** — themes: injection, output
- **CWE-200 Exposure of Sensitive Information to an Unauthorized Actor** — themes: data-leak
- **CWE-863 Incorrect Authorization** — themes: access
- **CWE-918 Server-Side Request Forgery (SSRF)** — themes: access
- **CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer** — themes: output
- **CWE-476 NULL Pointer Dereference** — themes: resource
- **CWE-798 Use of Hard-coded Credentials** — themes: identity
- **CWE-190 Integer Overflow or Wraparound** — themes: output
- **CWE-400 Uncontrolled Resource Consumption** — themes: resource
- **CWE-306 Missing Authentication for Critical Function** — themes: identity, access
## Review
## What this list is

This edition has been replaced by the [2025 CWE Top 25](https://llms-technical-reviews.com/security/cwe-top25-2025/). Use that one for current work. This page stays as a record, including the six entries that left the list in 2025.

The 2024 CWE Top 25 Most Dangerous Software Weaknesses is MITRE's ranking, sponsored by CISA, of the 25 CWE entries most often found as the root cause of published vulnerabilities, weighted by severity. It is final. Like the 2025 list, it is a catalogue of precise coding mistakes, not a risk list. Each CWE rolls up into a broader OWASP category, such as [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection) for the injection entries and [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control) for the authorization ones. It covers all kinds of software, so memory-safety bugs in C and C++ sit next to web flaws.

## How it was made

The 2024 list page says the ranking was built from 31,770 CVE Records. It shows a score, the number of mapped CVEs in CISA's Known Exploited Vulnerabilities (KEV) catalogue, and the rank change against 2023 for each entry. The archived 2024 pages reviewed here do not restate the date window or the formula. The 2025 methodology describes the same basic score: normalised frequency times normalised average CVSS severity. It also explains the main difference from earlier years. Up to and including 2024, every CWE mapping was first folded into View-1003, a simplified set of 130 weaknesses that the NVD uses. A precise child CWE was therefore counted under its parent. That is why broader entries such as CWE-119, CWE-287 and CWE-269 rank higher here than in 2025.

## The items

### CWE-79 Cross-site Scripting

Rank 1, score 56.92, 3 in KEV, up from 2 in 2023. Official name: "Improper Neutralization of Input During Web Page Generation". **What it is:** input rendered into a page without context-aware encoding, so it runs as script in other users' browsers. **Do:** encode output by default, set a strict CSP, and sanitise any HTML you must allow. **Related:** [CWE-79 Cross-site Scripting](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-79-cross-site-scripting) (still first in 2025), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection).

### CWE-787 Out-of-bounds Write

Rank 2, score 45.20, 18 in KEV, down from 1. **What it is:** C or C++ code that writes past a buffer's bounds, often through an unchecked length or an off-by-one loop. It leads to crashes and code execution. It fell to fifth in 2025. MITRE suggests this was partly because its overflow children were counted separately. **Do:** memory-safe languages for new code, bounded APIs, fuzzing. **Related:** [CWE-787 Out-of-bounds Write](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-787-out-of-bounds-write). No OWASP Top 10:2025 category; OWASP covers memory bugs as X02:2025 Memory Management Failures, outside its ten.

### CWE-89 SQL Injection

Rank 3, score 35.88, 4 in KEV, unchanged from 2023. Official name: "Improper Neutralization of Special Elements used in an SQL Command". **What it is:** queries built by string concatenation, so input changes the query's structure. **Do:** use parameterised queries everywhere and least-privilege database accounts. **Related:** [CWE-89 SQL Injection](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-89-sql-injection), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection).

### CWE-352 Cross-Site Request Forgery (CSRF)

Rank 4, score 19.57, 0 in KEV, up from 9. **What it is:** a state-changing request that relies only on the browser's cookies, so another site can trigger it as the victim. **Do:** anti-CSRF tokens, `SameSite` cookies and Origin checks. **Related:** [CWE-352 Cross-Site Request Forgery (CSRF)](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-352-cross-site-request-forgery-csrf), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control).

### CWE-22 Path Traversal

Rank 5, score 12.74, 4 in KEV, up from 8. Official name: "Improper Limitation of a Pathname to a Restricted Directory". **What it is:** a file path built from input, where `../` or an absolute path escapes the intended directory. **Do:** map input to IDs, canonicalise and check the path against the base directory, and use minimal file rights. **Related:** [CWE-22 Path Traversal](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-22-path-traversal), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control).

### CWE-125 Out-of-bounds Read

Rank 6, score 11.42, 3 in KEV, up from 7. **What it is:** reading past a buffer's end, usually because the code trusted a length field in the input. It leaks memory or crashes the process. **Do:** check bounds against the real buffer size, and fuzz. **Related:** [CWE-125 Out-of-bounds Read](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-125-out-of-bounds-read). No OWASP Top 10:2025 category.

### CWE-78 OS Command Injection

Rank 7, score 11.30, 5 in KEV, down from 5. Official name: "Improper Neutralization of Special Elements used in an OS Command". **What it is:** input placed in a shell command line, so metacharacters run extra commands. **Do:** call programs with argument arrays and no shell, and allow-list the values. **Related:** [CWE-78 OS Command Injection](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-78-os-command-injection), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection), [MCP05:2025 Command Injection & Execution](https://llms-technical-reviews.com/security/owasp-mcp-top10/#mcp052025-command-injection--execution).

### CWE-416 Use After Free

Rank 8, score 10.19, 5 in KEV, down from 4. **What it is:** C or C++ code that keeps using memory after it has been freed, which attackers can turn into code execution. **Do:** clear ownership rules or smart pointers, AddressSanitizer in tests, fuzzing, and memory-safe languages where possible. **Related:** [CWE-416 Use After Free](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-416-use-after-free). No OWASP Top 10:2025 category.

### CWE-862 Missing Authorization

Rank 9, score 10.11, 0 in KEV, up from 11. **What it is:** the code authenticates the caller but never checks that they may perform the action. **Do:** deny by default, and require an explicit permission check on every route and tool. **Related:** [CWE-862 Missing Authorization](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-862-missing-authorization) (fourth in 2025), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control), [API5:2023 Broken Function Level Authorization](https://llms-technical-reviews.com/security/owasp-api-top10-2023/#api52023-broken-function-level-authorization).

### CWE-434 Unrestricted Upload of File with Dangerous Type

Rank 10, score 10.03, 0 in KEV, unchanged. **What it is:** an upload feature that accepts executable or active file types and stores them where they can be run or served. **Do:** check type by content, rename files, store them outside the web root, and serve them from a separate domain. **Related:** [CWE-434 Unrestricted Upload of File with Dangerous Type](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-434-unrestricted-upload-of-file-with-dangerous-type), [A06:2025 Insecure Design](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a062025-insecure-design).

### CWE-94 Improper Control of Generation of Code ('Code Injection')

Rank 11, score 7.13, 7 in KEV, up from 23. **What it is:** input that becomes code the application runs, through `eval`, templates or dynamic imports. This now includes running model-generated code. **Do:** never evaluate input, and sandbox any generated code with no secrets or network. **Related:** [CWE-94 Improper Control of Generation of Code ('Code Injection')](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-94-improper-control-of-generation-of-code-code-injection), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection), [ASI05 Unexpected Code Execution (RCE)](https://llms-technical-reviews.com/security/owasp-agentic-top10-2026/#asi05-unexpected-code-execution-rce).

### CWE-20 Improper Input Validation

Rank 12, score 6.78, 1 in KEV, down from 6. **What it is:** a broad class for input accepted without checks on type, range, length or format. It is often the first step of more specific bugs. **Do:** validate against strict schemas at every trust boundary. **Related:** [CWE-20 Improper Input Validation](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-20-improper-input-validation) (18th in 2025), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection).

### CWE-77 Command Injection

Rank 13, score 6.74, 4 in KEV, up from 16. Official name: "Improper Neutralization of Special Elements used in a Command". **What it is:** the parent of CWE-78. Input changes any command passed to another interpreter. **Do:** pass structured arguments, not strings. **Related:** [CWE-77 Command Injection](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-77-command-injection) (23rd in 2025), [A05:2025 Injection](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a052025-injection).

### CWE-287 Improper Authentication

Rank 14, score 5.94, 4 in KEV, down from 13. **What it is:** a broad entry for any weak or bypassable proof of identity: a token not verified, a flawed password-reset flow, a check that can be skipped. It left the Top 25 in 2025 (31st). MITRE says this was likely because its more specific children were no longer counted under it. **Do:** use one well-tested authentication framework, with MFA for sensitive accounts. **Related:** [A07:2025 Authentication Failures](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a072025-authentication-failures), [API2:2023 Broken Authentication](https://llms-technical-reviews.com/security/owasp-api-top10-2023/#api22023-broken-authentication).

### CWE-269 Improper Privilege Management

Rank 15, score 5.22, 0 in KEV, up from 22. **What it is:** privileges assigned, kept or dropped wrongly, for example a service that never drops root after start-up, or a user who can grant themselves a role. It fell to 29th in 2025. MITRE's own example: counted with its children, it would likely have had enough CVEs to stay in the list. **Do:** least privilege, and review role-assignment paths. **Related:** [A06:2025 Insecure Design](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a062025-insecure-design), [ASI03 Identity and Privilege Abuse](https://llms-technical-reviews.com/security/owasp-agentic-top10-2026/#asi03-identity-and-privilege-abuse).

### CWE-502 Deserialization of Untrusted Data

Rank 16, score 5.07, 5 in KEV, down from 15. **What it is:** native object deserialization (Java serialization, Python `pickle`, unsafe YAML) applied to input an attacker controls, which leads to code execution. **Do:** use data-only formats with schemas and safe model-file formats. **Related:** [CWE-502 Deserialization of Untrusted Data](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-502-deserialization-of-untrusted-data), [A08:2025 Software or Data Integrity Failures](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a082025-software-or-data-integrity-failures).

### CWE-200 Exposure of Sensitive Information to an Unauthorized Actor

Rank 17, score 5.07, 0 in KEV, up from 30. **What it is:** data reaches someone without the right to see it, through full-object API responses, verbose errors or debug endpoints. **Do:** explicit response schemas, generic errors, and data classification. **Related:** [CWE-200 Exposure of Sensitive Information to an Unauthorized Actor](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-200-exposure-of-sensitive-information-to-an-unauthorized-actor), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control), [API3:2023 Broken Object Property Level Authorization](https://llms-technical-reviews.com/security/owasp-api-top10-2023/#api32023-broken-object-property-level-authorization).

### CWE-863 Incorrect Authorization

Rank 18, score 4.05, 2 in KEV, up from 24. **What it is:** an authorization check exists but is wrong. It checks the wrong role or resource, or trusts a client-supplied flag. **Do:** central policy, identity taken only from the server-side session, negative tests per permission. **Related:** [CWE-863 Incorrect Authorization](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-863-incorrect-authorization), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control).

### CWE-918 Server-Side Request Forgery (SSRF)

Rank 19, score 4.05, 2 in KEV, unchanged. **What it is:** the server fetches a user-supplied URL without limits, which reaches metadata services and internal hosts. **Do:** use an egress proxy with an allow-list, block private and metadata ranges after DNS resolution, and disable redirects. **Related:** [CWE-918 Server-Side Request Forgery (SSRF)](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-918-server-side-request-forgery-ssrf), [A01:2025 Broken Access Control](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a012025-broken-access-control), [API7:2023 Server Side Request Forgery](https://llms-technical-reviews.com/security/owasp-api-top10-2023/#api72023-server-side-request-forgery).

### CWE-119 Memory Buffer Errors

Rank 20, score 3.69, 2 in KEV, down from 17. Official name: "Improper Restriction of Operations within the Bounds of a Memory Buffer". **What it is:** the general parent for reads and writes outside a buffer. MITRE discourages it for mapping because more precise children fit better. In 2025 it fell to 39th, and three of those children, [CWE-120 Classic Buffer Overflow](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-120-classic-buffer-overflow), [CWE-121 Stack-based Buffer Overflow](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-121-stack-based-buffer-overflow) and [CWE-122 Heap-based Buffer Overflow](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-122-heap-based-buffer-overflow), entered the list. **Do:** the memory-safety controls under CWE-787. **Related:** no OWASP Top 10:2025 category.

### CWE-476 NULL Pointer Dereference

Rank 21, score 3.58, 0 in KEV, down from 12. **What it is:** use of a pointer that can be null without a check. It mostly causes crashes and denial of service. **Do:** check every return value that can be null, and use static analysis and fuzzing. **Related:** [CWE-476 NULL Pointer Dereference](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-476-null-pointer-dereference) (13th in 2025), [A10:2025 Mishandling of Exceptional Conditions](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a102025-mishandling-of-exceptional-conditions).

### CWE-798 Use of Hard-coded Credentials

Rank 22, score 3.46, 2 in KEV, down from 18. **What it is:** passwords, API keys or private keys written into source code, firmware or images, often the same on every installed copy. It fell to 35th in 2025. **Do:** load secrets from a secret store at runtime, scan code and images for secrets, and rotate anything that has leaked. **Related:** [A07:2025 Authentication Failures](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a072025-authentication-failures), [NHI2:2025 Secret Leakage](https://llms-technical-reviews.com/security/owasp-nhi-top10-2025/#nhi22025-secret-leakage), [M1 Improper Credential Usage](https://llms-technical-reviews.com/security/owasp-mobile-top10-2024/#m1-improper-credential-usage).

### CWE-190 Integer Overflow or Wraparound

Rank 23, score 3.37, 3 in KEV, down from 14. **What it is:** arithmetic that exceeds the type's range and wraps around. A typical case is a size calculation that becomes small, so a later allocation is too short and a heap overflow follows. It fell to 30th in 2025. MITRE does not attribute this one to the normalisation change. **Do:** checked arithmetic for sizes and counts, and fuzzing. **Related:** no OWASP Top 10:2025 category; OWASP lists it under X02:2025 Memory Management Failures.

### CWE-400 Uncontrolled Resource Consumption

Rank 24, score 3.23, 0 in KEV, up from 37. **What it is:** a broad entry for requests that can use unbounded CPU, memory, disk or connections. It fell to 32nd in 2025, while the related, more specific [CWE-770 Allocation of Resources Without Limits or Throttling](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-770-allocation-of-resources-without-limits-or-throttling) entered the list. MITRE also notes that it is discouraged for mapping. **Do:** limits, quotas, timeouts and rate limiting per user. **Related:** [API4:2023 Unrestricted Resource Consumption](https://llms-technical-reviews.com/security/owasp-api-top10-2023/#api42023-unrestricted-resource-consumption), [LLM06:2026 Unbounded Consumption](https://llms-technical-reviews.com/security/owasp-llm-top10-2026/#llm062026-unbounded-consumption).

### CWE-306 Missing Authentication for Critical Function

Rank 25, score 2.73, 5 in KEV, down from 20. **What it is:** an important function, such as a management API or a debug port, that needs no login at all. **Do:** authenticate every endpoint by default, and keep management interfaces off public networks. **Related:** [CWE-306 Missing Authentication for Critical Function](https://llms-technical-reviews.com/security/cwe-top25-2025/#cwe-306-missing-authentication-for-critical-function), [A07:2025 Authentication Failures](https://llms-technical-reviews.com/security/owasp-top10-web-2025/#a072025-authentication-failures), [MCP07:2025 Insufficient Authentication & Authorization](https://llms-technical-reviews.com/security/owasp-mcp-top10/#mcp072025-insufficient-authentication--authorization).

## What changed

Against 2023 (which is not reviewed on this site), the 2024 pages give each entry's earlier rank. Two entries were outside the 2023 Top 25: CWE-200 (from 30) and CWE-400 (from 37). The largest climbs were CWE-94 (23 to 11), CWE-352 (9 to 4) and CWE-269 (22 to 15). The largest falls were CWE-476 (12 to 21), CWE-190 (14 to 23) and CWE-20 (6 to 12). The archived pages reviewed here do not say which 2023 entries left. For the move to 2025, see the [2025 edition](https://llms-technical-reviews.com/security/cwe-top25-2025/) and the [What changed page](https://llms-technical-reviews.com/security/changes/).

## What it misses

The same limits apply as in 2025. It ranks what appears in CVE records, which depends on CNA mapping habits, not on what is in a given codebase. The score ignores exploitation, and KEV counts are shown only beside it. It has nothing specific to LLM or agent systems. The 2024 edition adds one problem of its own: View-1003 normalisation folded precise children into broad parents. So abstract entries such as CWE-119, CWE-287, CWE-269 and CWE-400 rank higher than their own mapping counts justify, and the specific bug you need to fix is hidden behind them.

## Our take

Keep this edition for history and for comparisons only. For training, code-review checklists and static analysis coverage, use the 2025 list, which counts precise weaknesses as reported. If you built a programme on the 2024 list, nothing on it became safe. The six entries that left in 2025 still rank between 29 and 39. Keep authentication, privilege management, hard-coded credentials and integer overflow in your checks.
Attribution: item codes and names are from "2024 CWE Top 25 Most Dangerous Software Weaknesses" by MITRE / CISA (MITRE CWE Terms of Use (copyright MITRE)). The review text is ours.