Skip to content
OpenAdvisories

Weakness (CWE)

CWE-682: Incorrect Calculation

Pillar Draft Mapping discouraged

The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.

How to prevent it (6 mitigations)
  1. 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.

  2. 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.

  3. 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.

  4. 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++).

  5. 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++).

  6. 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.

Source: MITRE CWE-682

43 results · Clear filters · Feed

  • Medium 5.9

    netty-tcnative before 2.0.84.Final Denial of Service via BIO Write Overcount

    Netty netty-tcnative before 2.0.84.Final contains a denial of service vulnerability in the tcn_write_to_bytebuffer BIO write callback that overreports bytes consumed. Remote TLS 1.3 peers can provoke queued post-handshake records like NewSessionTicket or KeyU…

  • Medium 6.5

    Zimbra Collaboration Suite Shared-File Mailbox Quota Accounting Error Enables Quota Exhaustion

    A mailbox quota-accounting vulnerability in Zimbra Collaboration Suite (ZCS) allows an authenticated user to consume another user’s mailbox quota by repeatedly sharing and revoking a document. Creation of the recipient’s shared-file record charges the documen…

  • Medium 5.9

    Vyper 0.3.8 through 0.5.0b1 Optimizer Miscompilation of msg.value | K in Ternary Branches

    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 integer literal, is compiled to the constant 1 when used as a ternary expression branch under -O gas (the default) or -O c…

  • Medium 5.9

    Vyper before 0.2.6 Call Stack Corruption via Complex Type Function Arguments

    Vyper before 0.2.6 contains a call stack corruption vulnerability that causes incorrect function outputs when complex types with non-base members are passed as arguments. Contracts passing multi-dimensional arrays or structs to internal or external functions …

  • Medium 5.9

    fast-jwt clockTolerance: Infinity silently bypasses both exp and nbf validation (and persists in the verifier cache)

    fast-jwt provides fast JSON Web Token (JWT) implementation. Prior to 6.3.0, fast-jwt createVerifier accepts Infinity for clockTolerance because its option validation checks type and negativity but not finiteness. In validateClaimDateValue, infinite positive a…

  • Medium 4.0

    Silent Decimal128 value corruption via incorrect exactness check in MongoDB C Driver

    An incorrect calculation in Decimal128 string parsing in the MongoDB C Driver can accept certain over-precision inputs containing leading zeros instead of rejecting them. This produces a value different from the supplied text. An actor who can provide a decim…

  • Medium 5.4

    Incorrect calculation in API in Google Chrome on on Windows prior to 155.0.8059.39 allowed a remote attacker leveraging…

  • Medium 5.3

    WordPress CURCY plugin <= 2.2.17 - Broken Access Control vulnerability

    Incorrect Calculation vulnerability in VillaTheme CURCY woo-multi-currency allows Integer Attacks.This issue affects CURCY: from n/a through 2.2.17.

  • Medium 5.5

    ZBar commit 2ea2ca58 contains an undefined-behavior vulnerability in the Code 128 decode6() function. When processing s…

  • Medium 4.3

    snipe-it before 8.7.0 Checkout Request Counter Integrity Failure

    snipe-it before 8.7.0 contains an incorrect calculation vulnerability in checkout request handling that allows authenticated users to corrupt the assets.requests_counter through duplicate submissions and cancellations without active requests. Attackers can re…

  • Medium 4.6

    Incorrect calculation for some Intel(R) TDX Guest software before version 0.3.1 within Ring 3: User Applications may al…

  • Medium 5.4

    Out-of-bounds read in DHCPv4 client message-type name lookup (net_dhcpv4_msg_type_name)

    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 after a faulty bounds check. The guard used msg_type <= sizeof(name) instead of msg_type <= ARRAY_SIZE(name); sizeof retur…

  • Medium 5.5

    ImageMagick: Heap Buffer Over-Write in JP2 encoder when due to incorrect handling of arguments

    ImageMagick is free and open-source software used for editing and manipulating digital images. Prior to version 7.1.2-26, an incorrect handling of arguments can cause a heap buffer over-write in the JP2 encoder. This issue has been fixed in version7.1.2-26.

  • Medium 4.0

    Ledger Bitcoin App 2.1.0 Address Derivation Error via Miniscript

    Ledger Bitcoin app versions 2.1.0 and 2.1.1 contain an address derivation vulnerability that allows attackers to cause incorrect Bitcoin addresses to be displayed by exploiting improper handling of miniscript policies containing the a: fragment. Attackers can…

  • Medium 5.3

    The Graph: Revocable vesting contracts allows early access to locked tokens

    The Graph is an indexing protocol for querying networks like Ethereum, IPFS, Polygon, and other blockchains. Prior to version 3.0.0, a flaw in the token vesting contracts allows users to access tokens that should still be locked according to their vesting sch…

  • Medium —

    ml-dsa's UseHint function has off by two error when r0 equals zero

    ### Summary There's a bug in the `use_hint` function where it adds 1 instead of subtracting 1 when the decomposed low bits `r0` equal exactly zero. FIPS 204 Algorithm 40 is pretty clear that `r0 > 0` means strictly positive, but the current code treats zero a…

  • Medium 6.5

    Junos OS Evolved: Flapping management interface causes MAC learning on label-switched interfaces to stop

    An Incorrect Calculation vulnerability in the Layer 2 Control Protocol Daemon (l2cpd) of Juniper Networks Junos OS Evolved allows an unauthenticated network-adjacent attacker flapping the management interface to cause the learning of new MACs over label-switc…

  • Medium 5.3

    pytorch v2.8.0 was discovered to display unexpected behavior when the components torch.rot90 and torch.randn_like are u…

  • Medium 6.9

    Polkadot Frontier contains missing `check_inherent` for `note_min_gas_price_target` inflates gas price

    Polkadot Frontier is an Ethereum and EVM compatibility layer for Polkadot and Substrate. The extrinsic note_min_gas_price_target is an inherent extrinsic, meaning only the block producer can call it. To ensure correctness, the ProvideInherent trait should be …

  • Medium 5.0

    Libssh: incorrect return code handling in ssh_kdf() in libssh

    A flaw was found in libssh versions built with OpenSSL versions older than 3.0, specifically in the ssh_kdf() function responsible for key derivation. Due to inconsistent interpretation of return values where OpenSSL uses 0 to indicate failure and libssh uses…

  • Medium 5.3

    The mstatus register in RSD commit 3d13a updates incorrectly, leading to processing errors.

  • Medium 6.9

    Denial of Service through Data corruption in gRPC-C++

    There exists a denial of service through Data corruption in gRPC-C++ - gRPC-C++ servers with transmit zero copy enabled through the channel arg GRPC_ARG_TCP_TX_ZEROCOPY_ENABLED can experience data corruption issues. The data sent by the application may be cor…

  • Medium 5.9

    `fold (xor (shl 1, x), -1) -> (rotl ~1, x)` misoptimization in zksolc

    zksolc is a Solidity compiler for ZKsync. All LLVM versions since 2015 fold `(xor (shl 1, x), -1)` to `(rotl ~1, x)` if run with optimizations enabled. Here `~1` is generated as an unsigned 64 bits number (`2^64-1`). This number is zero-extended to 256 bits o…

  • Medium 5.9

    era-compiler-solidity contains a `xor(zext(cmp), -1)` misoptimization

    era-compiler-solidity is the ZKsync compiler for Solidity. The problem occurred during instruction selection in the `DAGCombine` phase while visiting the XOR operation. The issue arises when attempting to fold the expression `!(x cc y)` into `(x !cc y)`. To p…

  • Medium 5.3

    Incorrect calculation in microcode keying mechanism for some Intel(R) Xeon(R) D Processors with Intel(R) SGX may allow …

  • Medium 4.9

    Due to a code bug in Secure_TSC, SEV firmware may allow an attacker with high privileges to cause a guest to observe an…

  • Medium 6.5

    Internet Connection Sharing (ICS) Denial of Service Vulnerability

    Internet Connection Sharing (ICS) Denial of Service Vulnerability

  • Medium 5.3

    _abi_decode input not validated in complex expressions in Vyper

    Vyper is a Pythonic Smart Contract Language for the EVM. The `_abi_decode()` function does not validate input when it is nested in an expression. Uses of `_abi_decode()` can be constructed which allow for bounds checking to be bypassed resulting in incorrect …

  • Medium 6.5

    OpenZeppelin Contracts contains Incorrect Calculation

    OpenZeppelin Contracts is a library for secure smart contract development. The ERC721Consecutive contract designed for minting NFTs in batches does not update balances when a batch has size 1 and consists of a single token. Subsequent transfers from the recei…

  • Medium 5.3

    BIG-IP software SYN cookies vulnerability CVE-2022-36795

    In BIG-IP versions 17.0.x before 17.0.0.1, 16.1.x before 16.1.3.1, 15.1.x before 15.1.7, and 14.1.x before 14.1.5.1, when an LTM TCP profile with Auto Receive Window Enabled is configured on a virtual server, undisclosed traffic can cause the virtual server t…

  • Medium 5.3

    Incorrect Calculation in Frontier leads to inflated Ethereum chain gas prices

    Frontier is an Ethereum compatibility layer for Substrate. Prior to commit d3beddc6911a559a3ecc9b3f08e153dbe37a8658, the worst case weight was always accounted as the block weight for all cases. In case of large EVM gas refunds, this can lead to block spammin…

  • Medium 5.3

    Sweet-B Library: Point compress/decompress using the wrong bit for sign

    When compressing or decompressing elliptic curve points using the Sweet B library, an incorrect choice of sign bit is used. An attacker with user level privileges and no other user's assistance can exploit this vulnerability with only knowledge of the public …

  • Medium 5.9

    Cranelift vulnerable to miscompilation of constant values in division on AArch64

    Wasmtime is a standalone runtime for WebAssembly. There is a bug in Wasmtime's code generator, Cranelift, for AArch64 targets where constant divisors can result in incorrect division results at runtime. This affects Wasmtime prior to version 0.38.2 and Cranel…

  • Medium 4.8

    Miscompilation of `i8x16.swizzle` and `select` with v128 inputs in Wasmtime

    Wasmtime is a standalone runtime for WebAssembly. In affected versions wasmtime's implementation of the SIMD proposal for WebAssembly on x86_64 contained two distinct bugs in the instruction lowerings implemented in Cranelift. The aarch64 implementation of th…

  • Medium 5.9

    On F5 BIG-IP 15.1.x versions prior to 15.1.5.1, 14.1.x versions prior to 14.1.4.6, and 13.1.x versions prior to 13.1.5,…

  • Medium 5.1
    CVE-2022-23636 Public exploit

    Invalid drop of partially-initialized instances in wasmtime

    Wasmtime is an open source runtime for WebAssembly & WASI. Prior to versions 0.34.1 and 0.33.1, there exists a bug in the pooling instance allocator in Wasmtime's runtime where a failure to instantiate an instance for a module that defines an `externref` glob…

  • Medium 6.3

    Array literal misordering in github.com/open-policy-agent/opa

    OPA is an open source, general-purpose policy engine. Under certain conditions, pretty-printing an abstract syntax tree (AST) that contains synthetic nodes could change the logic of some statements by reordering array literals. Example of policies impacted ar…

  • Medium 5.5

    Segfault due to negative splits in `SplitV`

    TensorFlow is an open source platform for machine learning. In affected versions the implementation of `SplitV` can trigger a segfault is an attacker supplies negative arguments. This occurs whenever `size_splits` contains more than one value and at least one…

  • Medium 4.3

    Bounds check missing for decimal args in Vyper

    Vyper is a Pythonic Smart Contract Language for the EVM. In affected versions external functions did not properly validate the bounds of decimal arguments. The can lead to logic errors. This issue has been resolved in version 0.3.0.

  • Medium 6.2

    Incorrect calculation in Enbra EWM does not report backflows or no flow events

    In Enbra EWM in Version 1.7.29 together with several tested wireless M-Bus Sensors the events backflow and "no flow" are not reconized or misinterpreted. This may lead to wrong values and missing events.