Description
The program 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.
There are three major ways to store real numbers in computers. Each method is described along with the limitations of how they store their numbers.
Modes of Introduction:
– Implementation
Related Weaknesses
CWE-682
CWE-190
CWE-834
CWE-119
Consequences
Availability: DoS: Crash, Exit, or Restart
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.
Integrity: Execute Unauthorized Code or Commands
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.
Confidentiality, Availability, Access Control: Read Application Data, Modify Application Data
This weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program’s implicit security policy.
Potential Mitigations
Phase: Implementation, Patching and Maintenance
Description:
The developer or maintainer can move to a more accurate representation of real numbers. In extreme cases, the programmer can move to representations such as ratios of BigInts which can represent real numbers to extremely fine precision. The programmer can also use the concept of an Unum real. The memory and CPU tradeoffs of this change must be examined. Since floating point reals are used in many programs and many locations, they are implemented in hardware and most format changes will cause the calculations to be moved into software resulting in slower programs.
CVE References
- CVE-2018-16069
- Chain: series of floating-point precision errors
(CWE-1339) in a web browser rendering engine causes out-of-bounds read
(CWE-125), giving access to cross-origin data
- Chain: series of floating-point precision errors
- CVE-2017-7619
- Chain: rounding error in floating-point calculations
(CWE-1339) in image processor leads to infinite loop (CWE-835)
- Chain: rounding error in floating-point calculations
- CVE-2021-29529
- Chain: machine-learning product can have a heap-based
buffer overflow (CWE-122) when some integer-oriented bounds are
calculated by using ceiling() and floor() on floating point values
(CWE-1339)
- Chain: machine-learning product can have a heap-based
- CVE-2008-2108
- Chain: insufficient precision (CWE-1339) in
random-number generator causes some zero bits to be reliably
generated, reducing the amount of entropy (CWE-331)
- Chain: insufficient precision (CWE-1339) in
- CVE-2006-6499
- Chain: web browser crashes due to infinite loop – “bad
looping logic [that relies on] floating point math [CWE-1339] to exit
the loop [CWE-835]”
- Chain: web browser crashes due to infinite loop – “bad
More Stories
The Most Dangerous Vulnerabilities in Apache Tomcat and How to Protect Against Them
Apache Tomcat is an open-source web server and servlet container that is widely used in enterprise environments to run Java...
ZDI-CAN-18333: A Critical Zero-Day Vulnerability in Microsoft Windows
Zero-day vulnerabilities are a serious threat to cybersecurity, as they can be exploited by malicious actors to gain unauthorized access...
CWE-669 – Incorrect Resource Transfer Between Spheres
Description The product does not properly transfer a resource/behavior to another sphere, or improperly imports a resource/behavior from another sphere,...
CWE-67 – Improper Handling of Windows Device Names
Description The software constructs pathnames from user input, but it does not handle or incorrectly handles a pathname containing a...
CWE-670 – Always-Incorrect Control Flow Implementation
Description The code contains a control flow path that does not reflect the algorithm that the path is intended to...
CWE-671 – Lack of Administrator Control over Security
Description The product uses security features in a way that prevents the product's administrator from tailoring security settings to reflect...