CWE-193: Off-by-one Error
low-riskA product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.
Abstraction: Base
Common Consequences
Availability
→
DoS: Crash, Exit, or Restart
Integrity
→
Modify Memory
Confidentiality
→
Execute Unauthorized Code or Commands
Detection Methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Real-World Examples (10)
| CVE | CVSS | EPSS | KEV |
|---|---|---|---|
| CVE-2021-3156 | 7.8 | 92.3% | Y |
| CVE-2021-3156 | 7.8 | 92.3% | Y |
| CVE-2003-0466 | 9.8 | 90.8% | — |
| CVE-2021-23017 | 7.7 | 73.5% | — |
| CVE-2021-23017 | 7.7 | 73.5% | — |
| CVE-2023-44444 | 7.8 | 51.8% | — |
| CVE-2003-0356 | 9.8 | 28.4% | — |
| CVE-2022-34970 | 9.8 | 24.0% | — |
| CVE-2004-0005 | 9.8 | 22.3% | — |
| CVE-2003-0252 | 9.8 | 16.1% | — |
10
/ 100
low-risk
Active Threat
7/50 · Minimal
Exploit Availability
3/50 · Minimal