logo

CWE-1339 - Insufficient Precision or Accuracy of a Real Number

CWE-1339

  • Abstraction:
  • Base
  • Structure:
  • Simple
  • Status:
  • Draft
Weakness Name

Insufficient Precision or Accuracy of a Real Number

Description

The product processes a real number with an implementation in which the number's representation does not preserve required accuracy and precision in its fractional part, causing an incorrect result.

When a security decision or calculation requires highly precise, accurate numbers such as financial calculations or prices, then small variations in the number could be exploited by an attacker. There are multiple ways to store the fractional part of a real number in a computer. In all of these cases, there is a limit to the accuracy of recording a fraction. If the fraction can be represented in a fixed number of digits (binary or decimal), there might not be enough digits assigned to represent the number. In other cases the number cannot be represented in a fixed number of digits due to repeating in decimal or binary notation (e.g. 0.333333...) or due to a transcendental number such as Π or √2. Rounding of numbers can lead to situations where the computer results do not adequately match the result of sufficiently accurate math.

Common Consequences

Scope: Availability

Impact: DoS: Crash, Exit, or Restart

Notes: This weakness will generally lead to undefined results and therefore crashes. In some implementations the program will halt if the weakness causes an overflow during a calculation.

Scope: Integrity

Impact: Execute Unauthorized Code or Commands

Notes: The results of the math are not as expected. This could cause issues where a value would not be properly calculated and provide an incorrect answer.

Scope: Confidentiality, Availability, Access Control

Impact: Read Application Data, Modify Application Data

Notes: This weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a product's implicit security policy.

Related Weaknesses
  • Release Date:
  • 2021-07-20
  • Latest Modification Date:
  • 2024-02-29

Free security scan for your website