CWE is a shared list of the common types of mistake that make software and hardware unsafe.
This guide is for students, junior developers and anyone who has seen a code like "CWE-79" in a report and wondered what it meant. You do not need to write code to find it useful: security reports, tool results and supplier answers often use these names.
In short
- A CWE entry names a type of mistake, such as letting typed-in text run as code. A CVE names one real flaw in one product.
- Many real flaws share the same few types of mistake, so learning the types helps you stop whole groups of flaws at once.
- Each year a Top 25 list ranks the weakness types behind the most common and most severe recent flaws.
- Use the names to talk clearly with developers, testers and suppliers, and to choose what to learn or check first.
What you will learn
- Type of mistake (weakness)
- a kind of error in how software is built that could, in the right conditions, let an attacker cause harm.
- Real flaw (vulnerability)
- one actual weak spot in one product that an attacker could use.
- Weakness list (CWE)
- the shared, numbered list of weakness types, short for Common Weakness Enumeration.
What is CWE?
Think of how doctors name illnesses. One patient's notes describe one case of flu. The word "flu" names the illness that many patients share.
In security, a CVE is like one patient's notes. It records one real flaw in one product. A CWE entry is like the name of the illness. It names the type of mistake behind many flaws.
CWE is a list of common software and hardware weaknesses, built by a community of experts.[1] A weakness is a flaw in how something is built that could lead to a real, usable flaw under certain conditions.[1] Each entry has a number and a name. Most entries also explain what can go wrong and how to avoid it.[5]
Where the comparison stops working: an illness is usually caught. A software weakness is usually built in, often by accident while the software is being written.[2]
How single flaws get their names and scores is covered in CVE and CVSS for Beginners.
Why does it matter?
Fixing flaws one at a time is slow. Knowing the type of mistake helps people avoid it in the next piece of software too.
If you are learning to code
What could happen: you repeat a well-known mistake, such as trusting what users type, in your first real app.
Check this: learn the top few weakness types and look for them when you review your own code.
If you are new to a testing or IT role
What could happen: a scan report lists dozens of findings with CWE names, and you cannot tell which matter.
Check this: group the findings by weakness type, so repeated mistakes stand out.
If you buy or manage software
What could happen: a supplier says their product is "tested" without saying what for.
Check this: ask which weakness types their testing covers, and how they stop common ones.
What does it look like?
Here is a made-up summary from a code scanning tool. A junior developer might see one like it after a test run.
Example only. All values are made up.
Project: booking-site.example.invalid Finding 1: CWE-79 Cross-site Scripting (1) File: search_page (EXAMPLE), line 0000 (2) Note: search text shown on page without cleaning (3) Finding 2: CWE-89 SQL Injection (4) File: login_form (EXAMPLE), line 0000 Finding 3: CWE-79 Cross-site Scripting (5) File: reviews_page (EXAMPLE), line 0000
- The weakness number and short name. The number lets you look up the full entry.
- Where the tool thinks the problem is. In a real file, this line would contain the actual file name and line number.
- What the tool saw: text typed by a visitor goes straight onto a web page.
- A different weakness type: typed text could change a database command.
- The same type again, in another file. Repeats suggest a habit worth fixing everywhere.
Why this is risky: each finding is one place where an attacker might slip in harmful text. Fixing one file leaves the same mistake in the others.
The safer way: look up the weakness entry and learn its suggested fix. Then apply that fix everywhere the same type appears.
How does it work?
- Experts describe a type of mistake. They give it a number, a name, a description, likely effects and ways to reduce it.[5]
- Entries sit in a family tree. Some describe broad groups of mistakes. Others describe narrower kinds that are still not tied to one product.[5]
- Real flaws are linked to types. When a CVE record is published, it can name the weakness type behind it. Groups such as the US cyber agency CISA can add these links too.[4]
- Tools and people use the names. Developers, researchers and tool makers use CWE as a common language for finding and fixing weaknesses.[2]
- A yearly ranking is made. The Top 25 list looks at recent CVE records and ranks weakness types by how often they appear and how severe the linked flaws were.[4]

The 2025 ranking used about 39,000 CVE records published between June 2024 and June 2025.[4] Each weakness type gets a score that multiplies how often it appears by how severe its flaws were on average.[4] So a type that is common but mild, or severe but rare, ranks lower.
The top three in the 2025 list were cross-site scripting, SQL injection and cross-site request forgery.[3] In plain words, the first lets typed text run in someone's browser. The second lets typed text change a database command. The third tricks a browser into sending a request the user did not mean to send.

A worked example
Rania Pereira is a junior developer at Juniper Printers, a made-up firm that sells printing online. In her first month, a code scan of the order website returns 14 findings.
At first the list looks scary. Then Rania sorts it by weakness type. Nine findings share one name: cross-site scripting. Three are SQL injection. Two are other types.
She looks up the cross-site scripting entry. It explains that the problem is showing text typed by visitors on a page without cleaning it first.[5] The entry also lists ways to reduce it.
Rania sees that all nine findings come from one habit. Each page puts search terms or reviews straight onto the screen. Her team agrees to use one shared, tested way to clean text before it is shown. They update all nine places, then run the scan again. The cross-site scripting findings drop off the report.
Next, she checks that the three SQL injection findings are on the 2025 Top 25 list.[3] They are, so the team fixes those next.
This does not make the website free of flaws. A scan finds only the patterns it knows. But the team fixed a habit, not just a list of lines, so new pages are less likely to repeat it.
Myths and mistakes
| What people think | What is true |
|---|---|
| CWE and CVE are the same thing. | A CWE entry names a type of mistake. A CVE names one real flaw in one product. |
| If my code avoids the Top 25, it is secure. | The Top 25 covers what was common and severe in recent reports. Other weakness types can still affect your software.[4] |
| A CWE number tells me how dangerous a finding is. | The number names the type. How serious one finding is depends on where it is and what an attacker could reach. |
| CWE is only for expert security teams. | It is free to use, and it is written for developers, designers and tool makers as well as researchers.[1] |
What can I do this week?
- Open the current Top 25 list and read the names of the first ten weakness types.
- Read one full entry, such as cross-site scripting, and note its suggested ways to reduce it.
- Sort a recent scan report by weakness type, and look for the type that repeats most.
- Ask your team or supplier which weakness types their code review or testing looks for.
Checklist
- I can explain the difference between a weakness type and a single flaw.
- I know where to look up a CWE number and read its entry.
- Our scan reports show the weakness type for each finding.
- We group findings by type to spot repeated habits.
- We fix every place a repeated weakness appears, not just the first.
- We check the newest Top 25 list each year when it is published.
Common questions
Who looks after CWE?
MITRE, a US not-for-profit, runs the list for the US Department of Homeland Security. Experts from industry, universities and government add to it.[1] The list is free to use in research, teaching and tools, which is why so many scanners show its names.
How is the Top 25 different from the OWASP Top 10?
They answer different questions. The Top 25 ranks single weakness types using a year of real flaw records. The OWASP Top 10 groups web application risks into ten broader areas. Both are useful for deciding what to learn or test first.
Does every flaw have a CWE?
Many published CVE records name one, but not always the most precise type. The team behind the 2025 ranking had to review and re-map thousands of records whose links were too broad.[4] Treat a CWE label in a report as a helpful clue, not the final word.
Do I need to learn all the numbers?
No. Most people learn the names of the most common types and look up the rest when needed. Knowing what cross-site scripting or SQL injection means is more useful than remembering their numbers. The numbers mainly help tools and reports stay exact.
Where next?
Ready for the detail? Read the practitioner guide: CWE Top 25 Guide. It goes further into the full 2025 ranking, how CWE entries are grouped and mapped, and how to use the list in a secure development programme.
Also useful:
- CVE and CVSS for Beginners
- The OWASP Top 10 for Beginners
- SQL Injection for Beginners
- Cross-Site Scripting for Beginners
Related NHI Mgmt Group resources: CVE, CWE and CPE Guide · CVE vs CWE vs CAPEC · Memory-Safe Languages for Beginners · Input Validation for Beginners
Key terms
- Weakness
- A type of mistake in how software or hardware is built that could lead to a real flaw.
- Common Weakness Enumeration (CWE)
- The shared, numbered list of software and hardware weakness types.
- CWE Top 25
- A yearly ranking of the weakness types behind the most common and severe recent flaws.
- CVE
- A shared ID for one publicly known flaw in a product.
- Cross-Site Scripting (XSS)
- A weakness where text typed by one visitor can run as code in another visitor's browser.
- SQL Injection
- A weakness where typed text can change the commands a program sends to its database.
Sources and further reading
- About CWE. MITRE, CWE Program. https://cwe.mitre.org/about/index.html, accessed 28 Nov 2026.
- New to CWE. MITRE, CWE Program. https://cwe.mitre.org/about/new_to_cwe.html, accessed 28 Nov 2026.
- 2025 CWE Top 25 Most Dangerous Software Weaknesses. MITRE, CWE Program, December 2025. https://cwe.mitre.org/top25/archive/2025/2025_cwe_top25.html, accessed 28 Nov 2026.
- 2025 CWE Top 25 Methodology. MITRE, CWE Program. https://cwe.mitre.org/top25/archive/2025/2025_methodology.html, accessed 28 Nov 2026.
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'). MITRE, CWE Program. https://cwe.mitre.org/data/definitions/79.html, accessed 28 Nov 2026.