This website uses cookies

To provide the highest level of service we use cookies on this site.
Your continued use of the site means that you agree to their use in accordance with our terms and conditions.

Pentest Chronicles

Crashing servers with digits: floating-point numbers DoS vulnerabilities

Martin Matyja

May 10, 2024

A Denial-of-Service (DoS) attack is a malicious attempt to disrupt the normal functioning of a system or network, in this case – a web application. One sophisticated form of such an attack exploits vulnerabilities in the processing of floating-point numbers. In our scenario, attackers manipulate the system's handling of floating-point arithmetic, leading to inaccurate calculations and potential system failures. This method challenges the reliability of numerical computations and poses a serious threat to the stability and availability of targeted systems.


DoS attack via floating-point numbers – real-life example
During one of the penetration tests we conducted, it was discovered that the application accepts parameters in floating-point number form. Floating-point numbers are often encountered in transactions involving monetary values, such as in e-commerce applications. Typically, monetary values do not require more than 2 decimal places. Therefore, during tests, we always check what happens when we send more digits after the decimal point to the application. This allows us to verify whether the application's underlying code accounts for such situations and responds effectively. If not, it may lead to consequences like continuous server disruption or temporary issues until the server is restarted, affecting all application users.

Let’s consider an example. During the security tests, one of the HTTP requests to the application included a parameter in JSON format representing a floating-point number. It's important to note that a potential vulnerability could involve any data type, such as an integer or even a string variable, however, for this example, a large floating-point number was injected.



The rest of the JSON data format is not needed, so it was removed for the query clarity.

A large number of digits were added in yellow above, creating a floating-point number in the process. Many digits can be quickly created using the example command: seq -s "" 1300000 | tr -d 'eE+i.', generating approximately 7.89 million digits.
The application took about 40 seconds to process this enormous floating-point number, after which it returned information about the successful request. Below is information from Burp Suite software about the response time for the request:
It's not always necessary to send a massive number of digits after the decimal point. We can also use e-notation, which conveys to the application a large number of digits after the decimal point without needing to include them all in the query content.

Here’s another example, from Exploit Database: https://www.exploit-db.com/exploits/35304.



Instead of providing the entire structure of a floating-point number, e-notation allows us to specify how many digits should be after the decimal point. This example illustrates an alternative way to introduce a malicious number into the application and disrupt software continuity.

Protection methods:
1. Initially, it is crucial to enforce control over the length of HTTP requests. A Web Application Firewall (WAF) should reject requests that exceed the predefined maximum length. For example, the open-source WAF – ModSecurity allows setting the maximum request body size accepted by the SecRequestBodyLimit directive.

2. Validate the length and format of input data, especially when dealing with floating-point numbers.

3. Ensure that the application validates the type and range of received data, preventing unexpected or malicious values. Implement checks to ensure floating-point numbers are within acceptable ranges.

4. Introduce rate-limiting mechanisms to restrict the number of requests from a single source within a specified time frame, mitigating the impact of DoS attacks by preventing an overwhelming number of requests.

5. Conduct regular penetration testing and security assessments to identify and address potential vulnerabilities in the system, including specific tests targeting the handling of floating-point numbers.



#Cybersecurity #DoSAttack #WebSecurity #Pentesting #InfoSec #PentestChronicles


Next Pentest Chronicles

When Usernames Become Passwords: A Real-World Case Study of Weak Password Practices

Michał WNękowicz

9 June 2023

In today's world, ensuring the security of our accounts is more crucial than ever. Just as keys protect the doors to our homes, passwords serve as the first line of defense for our data and assets. It's easy to assume that technical individuals, such as developers and IT professionals, always use strong, unique passwords to keep ...

SOCMINT – or rather OSINT of social media

Tomasz Turba

October 15 2022

SOCMINT is the process of gathering and analyzing the information collected from various social networks, channels and communication groups in order to track down an object, gather as much partial data as possible, and potentially to understand its operation. All this in order to analyze the collected information and to achieve that goal by making …

PyScript – or rather Python in your browser + what can be done with it?

michał bentkowski

10 september 2022

PyScript – or rather Python in your browser + what can be done with it? A few days ago, the Anaconda project announced the PyScript framework, which allows Python code to be executed directly in the browser. Additionally, it also covers its integration with HTML and JS code. An execution of the Python code in …

Any questions?

Happy to get a call or email
and help!

Terms and conditions
© 2023 Securitum. All rights reserved.