CWEweakness
CWE-682 Incorrect Calculation
High
Official page ↗
- Abstraction
- Pillar
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- High
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.
Common consequences
• Availability: DoS: Crash, Exit, or Restart — If the incorrect calculation causes the program to move into an unexpected state, it may lead to a crash or impairment of service.
• Integrity, Confidentiality, Availability: DoS: Crash, Exit, or Restart, DoS: Resource Consumption (Other), Execute Unauthorized Code or Commands — If the incorrect calculation is used in the context of resource allocation, it could lead to an out-of-bounds operation (CWE-119) leading to a crash or even arbitrary code execution. Alternatively, it may result in an integer overflow (CWE-190) and / or a resource consumption problem (CWE-400).
• Access Control: Gain Privileges or Assume Identity — In the context of privilege or permissions assignment, an incorrect calculation can provide an attacker with access to sensitive resources.
• Access Control: Bypass Protection Mechanism — If the incorrect calculation leads to an insufficient comparison (CWE-697), it may compromise a protection mechanism such as a validation routine and allow an attacker to bypass the security-critical code.
Potential mitigations
• [Implementation] Understand your programming language's underlying representation and how it interacts with numeric calculation. Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, "not-a-number" calculations, and how your language handles numbers that are too large or too small for its underlying representation.
• [Implementation] Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.
• [Implementation] Use the appropriate type for the desired action. For example, in C/C++, only use unsigned types for values that could never be negative, such as height, width, or other numbers related to quantity.
• [Architecture and Design] Use languages, libraries, or frameworks that make it easier to handle numbers without unexpected consequences.
Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++).
• [Architecture and Design] Use languages, libraries, or frameworks that make it easier to handle numbers without unexpected consequences.
Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++).
• [Implementation] Examine compiler warnings closely and eliminate problems with potential security implications, such as signed / unsigned mismatch in memory operations, or use of uninitialized variables. Even if the weakness is rarely exploitable, a single failure may lead to the compromise of the entire system.
Detection methods
• Manual Analysis: This weakness can be detected using tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session.
Specifically, manual static analysis is useful for evaluating the correctness of allocation calculations. This can be useful for detecting overflow conditions (CWE-190) or similar weaknesses that might have serious security impacts on the program.
• 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.)
• Fuzzing: Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
Observed examples
• CVE-2026-7270: Chain: calculation expression does not use parentheses to address operator precedence (CWE-783), causing an incorrect calculation (CWE-682) leading to a buffer overflow (CWE-787).
• CVE-2020-0022: Chain: mobile phone Bluetooth implementation does not include offset when calculating packet length (CWE-682), leading to out-of-bounds write (CWE-787)
• CVE-2017-8932: "carry propagation" bug in cryptography
implementation on x86-64 architecture adds a carry bit
from a previous unrelated operation.
• CVE-2010-1378: Chain: incorrect calculation (CWE-682) allows attackers to bypass certificate checks (CWE-295)
• CVE-2004-1363: substitution overflow: buffer overflow using environment variables that are expanded after the length check is performed
Related
Attack pattern · CAPEC (2)
Observed example · CVE (5)
- CVE-2026-7270 An operator precedence bug in the kernel results in a scenario where a buffer overflow causes attacker-controlled data to overwrite… vulnerability
- CVE-2020-0022 In reassemble_and_dispatch of packet_fragmenter.cc, there is possible out of bounds write due to an incorrect bounds calculation. vulnerability
- CVE-2017-8932 A bug in the standard library ScalarMult implementation of curve P-256 for amd64 architectures in Go before 1.7.6 and 1.8.x before 1.8.2… vulnerability
- CVE-2010-1378 OpenSSL in Apple Mac OS X 10.6.x before 10.6.5 does not properly perform arithmetic, which allows remote attackers to bypass X.509… vulnerability
- CVE-2004-1363 Buffer overflow in extproc in Oracle 10g allows remote attackers to execute arbitrary code via environment variables in the library name,… vulnerability
Can precede · CWE (1)
- CWE-170 Improper Null Termination weakness
Referenced by CAPEC · weakness (2)
Referenced by CVE · weakness (169)
- CVE-2026-116541 Netty netty-tcnative before 2.0.84.Final contains a denial of service vulnerability in the tcn_write_to_bytebuffer BIO write callback that… vulnerability
- CVE-2026-115786 A mailbox quota-accounting vulnerability in Zimbra Collaboration Suite (ZCS) allows an authenticated user to consume another user’s mailbox… vulnerability
- CVE-2026-114117 Vyper 0.3.8 through 0.5.0b1 contains an optimizer miscompilation in which (msg.value | K) or (len(msg.data) | K), where K is any nonzero… vulnerability
- CVE-2026-20236 As part of Cisco's ongoing commitment to proactive security and product quality, the Cisco owned Open Source Snort 3 Software engineering… vulnerability
- CVE-2026-101963 An Incorrect Calculation vulnerability in the routing protocol daemon (rpd) of Juniper Networks Junos OS and Junos EVO allows a remote BGP… vulnerability
- CVE-2026-109410 A vulnerability has been found in macrozheng mall 1.0.3 dcaa93b. vulnerability
- CVE-2026-106438 An incorrect calculation in Decimal128 string parsing in the MongoDB C Driver can accept certain over-precision inputs containing leading… vulnerability
- CVE-2026-107721 fast-jwt provides fast JSON Web Token (JWT) implementation. vulnerability
- CVE-2026-76470 As part of Cisco's ongoing commitment to proactive security and product quality, the Cisco networking engineering team has conducted a… vulnerability
- CVE-2026-106420 Incorrect calculation in API in Google Chrome on on Windows prior to 155.0.8059.39 allowed a remote attacker leveraging social engineering… vulnerability
- CVE-2026-97071 Incorrect Calculation vulnerability in VillaTheme CURCY woo-multi-currency allows Integer Attacks.This issue affects CURCY: from n/a… vulnerability
- CVE-2026-88371 ZBar commit 2ea2ca58 contains an undefined-behavior vulnerability in the Code 128 decode6() function. vulnerability
- CVE-2026-18459 Incorrect Calculation vulnerability in RTI Connext Professional (Core Libraries) allows Abuse Existing Functionality. vulnerability
- CVE-2026-20335 As part of Cisco's ongoing commitment to proactive security and product quality, the Cisco Secure Adaptive Security Appliance Software,… vulnerability
- CVE-2026-86736 snipe-it before 8.7.0 contains an incorrect calculation vulnerability in checkout request handling that allows authenticated users to… vulnerability
- CVE-2026-20275 As part of Cisco's ongoing commitment to proactive security and product quality, the Cisco IOS XR Software engineering team has conducted a… vulnerability
- CVE-2026-53670 PREVAIL is a Polynomial-Runtime EBPF Verifier using an Abstract Interpretation Layer. vulnerability
- CVE-2026-53671 PREVAIL is a Polynomial-Runtime EBPF Verifier using an Abstract Interpretation Layer. vulnerability
- CVE-2026-53706 PREVAIL is a Polynomial-Runtime EBPF Verifier using an Abstract Interpretation Layer. vulnerability
- CVE-2026-54754 Klever-Go is the Go implementation of the Klever blockchain protocol. vulnerability
- CVE-2026-76043 Incorrect calculation in V8 in Google Chrome prior to 151.0.7922.169 allowed a remote attacker to execute arbitrary code inside the sandbox… vulnerability
- CVE-2026-71479 New API is a large language mode (LLM) gateway and artificial intelligence (AI) asset management system. vulnerability
- CVE-2026-72099 In the Linux kernel, the following vulnerability has been resolved: dm-integrity: don't increment hash_offset twice hash_offset is already… vulnerability
- CVE-2026-20763 Incorrect calculation for some Intel(R) TDX Guest software before version 0.3.1 within Ring 3: User Applications may allow an escalation of… vulnerability
- CVE-2026-20270 As part of Cisco's ongoing commitment to proactive security and product quality, the Cisco IOS XE Software engineering team has conducted a… vulnerability
- CVE-2026-10773 The DHCPv4 client helper net_dhcpv4_msg_type_name() in subsys/net/lib/dhcpv4/dhcpv4.c indexes a static 8-element const char * name table… vulnerability
- CVE-2026-64388 In the Linux kernel, the following vulnerability has been resolved: smb/client: fix chown/chgrp with SMB3 POSIX Extensions Ownership… vulnerability
- CVE-2026-16363 JIT miscompilation in the JavaScript: WebAssembly component. vulnerability
- CVE-2026-47247 libheif is a HEIF and AVIF file format decoder and encoder. vulnerability
- CVE-2026-64006 In the Linux kernel, the following vulnerability has been resolved: netfilter: nf_tables: fix dst corruption in same register operation For… vulnerability
Referenced by CWE · can precede (2)
Referenced by CWE · child of (11)
- CWE-128 Wrap-around Error weakness
- CWE-131 Incorrect Calculation of Buffer Size weakness
- CWE-1335 Incorrect Bitwise Shift of Integer weakness
- CWE-1339 Insufficient Precision or Accuracy of a Real Number weakness
- CWE-135 Incorrect Calculation of Multi-Byte String Length weakness
- CWE-190 Integer Overflow or Wraparound weakness
- CWE-191 Integer Underflow (Wrap or Wraparound) weakness
- CWE-193 Off-by-one Error weakness
- CWE-369 Divide By Zero weakness
- CWE-468 Incorrect Pointer Scaling weakness
- CWE-469 Use of Pointer Subtraction to Determine Size weakness