Skip to main content

Crashing servers with digits: floating-point numbers DoS vulnerabilities

Illustration of Crashing servers with digits: floating-point numbers DoS vulnerabilities
Martin Matyja

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.

Large floating-point number

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:

Response time

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.

E-notation example

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.

Other Insights

Illustration of Unicode's role in XSS vulnerabilities.

Unicode's role in XSS vulnerabilities.

jacek siwek

Web application security is a crucial concern in today's digital landscape. Cross-Site Scripting (XSS) attacks pose a significant threat to web applications, allowing attackers to inject malicious scripts into trusted websites. Request validation mechanisms are implemented to mitigate such attacks by blocking certain characters or patterns commonly associated with malicious code. However, recent discoveries suggest that there is a possibility of bypassing these validation mechanisms using Unicode characters, which could lead to successful XSS attacks.

READ article
Illustration of Insider threat - The average insider threat attack scenario. How attackers can take over an entire domain in a few steps. Part 2.

Insider threat - The average insider threat attack scenario. How attackers can take over an entire domain in a few steps. Part 2.

DOMINIK ANTOŃCZAK

Have you ever wondered how little it takes to take over an Active Directory domain? Have you considered using some exploit? Nah, using exploits is not a fancy way and can be easily detected, and if anything, that option remains as a last resort. As savvy "hackers", we possess the right knowledge to navigate the network smoothly without making noise. Sometimes it takes a few steps, and just as Neil Armstrong said, it's one small step for man…, but for us hackers, taking over one system is a small step towards taking over the entire network. In this scenario, I'll demonstrate how the ability to analyze acquired information, coupled with a few sublime actions, was sufficient to take over the entire domain of a company consisting of 500-1000 users.

READ article
Illustration of Server shutdown via GraphQL during real-life pentest

Server shutdown via GraphQL during real-life pentest

KAMIL JAROSIŃSKI

GraphQL is a query language and environment created by Facebook in 2012 and released publicly in 2015. However, it has only gained significant popularity among developers and organizations in the last few years. Why is it so popular? GraphQL serves as an alternative to traditional API protocols, like REST, offering a more flexible and efficient way for client-server communication. The emergence of new technology opens up new perspectives and solves some problems, but unfortunately, it also introduces threats. This is the case with GraphQL. If used without proper knowledge, it could potentially allow for a DoS (Denial of Service) attack.

READ article
A professional cybersecurity consultant ready to assist with your inquiry.

Any questions?

Happy to get a call or email
and help!