EIP-1470 Smart Contract Weakness Classification (SWC)
No call decision · Security & privacy · EIP status Stagnant · created 2018-09-18
Proposes the SWC (Smart Contract Weakness Classification) system, which catalogs security vulnerabilities unique to smart contracts by number and name, similar to CWE.
Why it is needed
Right now there is no common terminology for referring to smart contract vulnerabilities. Audit reports, papers, and security analysis tools each call the same problem by a different name, so even security experts need time to figure out which technical root cause a vulnerability stems from and how severe it is. The general software security industry has used shared classification systems like CWE, SANS TOP 25, and OWASP TOP 10 to build educational materials and statistics and compare tool performance, but the Ethereum smart contract space has no such standard and cannot achieve the same effect.
What changes
Today
- No common terminology for smart contract vulnerabilities means names differ across audit reports, papers, and security tools
- Even experts spend a lot of time identifying the cause of the same vulnerability and comparing its severity
- Hard to compile vulnerability statistics into materials such as a list of the most common issues
After EIP-1470
- A vulnerability type can be identified by number and name, like SWC-101 (e.g. Integer Overflow and Underflow)
- Each SWC entry records a description, remediation, references, and its link to a parent CWE
- Security tools can be trained and validated using test cases made up of source code, bytecode, and a result configuration
Who is affected
- Smart contract developers: By checking the SWC ID attached to a warning from an audit report or tool, you can quickly see what type of bug it is and how to fix it.
- Security auditors and researchers: They can compare vulnerability findings from different sources using a common ID, making root cause analysis and classification work easier.
- Security analysis tool developers: They can train detection tools and validate performance using SWC test cases (source code, bytecode, result configuration).
In depth
Define terminology
The original text defines five terms. A Weakness is a software error that can lead to a Vulnerability on its own or combined with other weaknesses. A Vulnerability is an undesirable state created directly or indirectly by one or more Weaknesses. A Variant is a concrete weakness specific to Ethereum smart contracts, described down to the detail level, each assigned its own SWC ID. Relationships are the links between an SWC variant and existing CWE Base/Class types, and a Test Case is a real or crafted smart contract sample demonstrating one or more SWC variants.
Structure of an SWC definition document
An SWC definition is written in markdown format and has five properties. Title is the vulnerability name indicating the technical root cause, Relationships are the linked CWE Base/Class types, Description is the nature of the vulnerability and its impact on the contract system, Remediation is how to fix it, and References are links to related external material. Since a number and name alone are ambiguous, it is recommended that all five properties always be attached together.
How the relationship with CWE is established
SWC does not create a new CWE (Common Weakness Enumeration); it directly reuses the parts of CWE that already work well. CWE does not cover weaknesses unique to smart contracts, but it does describe related weaknesses at a higher level of abstraction, so SWC variants are linked to the closest parent Base or Class type in CWE. For example, SWC-101 (Integer Overflow and Underflow) is linked to CWE-682 (Incorrect Calculation). This relationship shows how SWC connects to the broader set of software security weaknesses, and is also used for visualization and generating insights from the dataset.
The three components of a test case
A test case includes both real-world samples and intentionally crafted samples, and consists of three elements. First, smart contract source code written in Solidity, Vyper, etc.; second, a machine-readable compilation artifact such as JSON or ethPM produced by an EVM compiler; and third, a test result configuration describing how many instances of which vulnerability variant are found in the given sample. This configuration follows a YAML schema and must include a description and an issues array, and each issue can state its locations using bytecode_offsets or line_numbers along with an id and count.
Actual implementation
The SWC scheme proposed by this EIP is actually in use in the SmartContractSecurity/SWC-registry GitHub repository, and a rendered GitHub Pages version of this registry is also publicly available. In other words, this document is not merely a theoretical proposal but serves as the grounding document for an actively operating registry.
Document type and current status
This EIP has type Informational, so it is not a rule that changes the Ethereum protocol itself, but a document proposing a shared classification system and terminology for the community to use. Since it does not concern fork inclusion, it is unrelated to any hard fork schedule. Its current status is Stagnant, meaning activity has stopped without further discussion or updates.