---
id: "cwe_id"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["software"]
langs: ["common"]
quality: 85
url: "http://registry.apicrafter.io/datatype/cwe_id"
---

# CWE identifier (`cwe_id`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Identifier of an entry in MITRE's Common Weakness Enumeration (CWE), the catalog of software and hardware weakness types: CWE- followed by a number without leading zeros. CVE records and security advisories use it to name the root cause of a vulnerability, for example CWE-79 for cross-site scripting. Wikidata stores the number without the CWE- prefix.

- Personal data (PII): no
- Categories: Software development (software)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^CWE-[1-9][0-9]*$
```

## Examples

- `CWE-79` — Improper Neutralization of Input During Web Page Generation (cross-site scripting)
- `CWE-89` — Improper Neutralization of Special Elements used in an SQL Command (SQL injection)
- `CWE-079` (invalid example) — Leading zero

## Mappings

- wikidata: `P3624`

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/Common_Weakness_Enumeration>
- doc: <https://cwe.mitre.org/data/definitions/79.html>
- doc: <https://github.com/CVEProject/cve-schema/blob/main/schema/CVE_Record_Format.json>

## Quality

Score 85/100. Missing: translation, detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/cwe_id.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/software/cwe_id.yaml>
