The Wayback Machine - https://web.archive.org/web/20240629173524/https://www.geeksforgeeks.org/slow-http-can-knock-server/
Open In App

How slow HTTP can knock down a server?

Last Updated : 13 Sep, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Slow HTTP are application layer Denial Of Service (DoS) attacks and have a potential to knock down a server with limited resources. Because of the nature of the attack (slow speed and low volume), they are hard to detect and can cause equal damage as a high volume DDoS. In this post, I’ll share my experience with these attacks

Introduction

As explained in the WiKi, slow HTTP attacks rely on the fact that the HTTP protocol, by design, requires requests to be completely received by the server before they are processed. If an HTTP request is not complete, or if the transfer rate is very low, the server keeps its resources busy waiting for the rest of the data. If the server keeps too many resources busy, this creates a denial of service. [Source : https://github.com/shekyan/slowhttptest/wiki ]

Slow HTTP attacks are primarily of three types.

  1. Slow headers (a.k.a Slowloris)
    This attack works by opening a large number of connections with the web server and keeping them alive by slowing sending never ending headers. The server won’t close the connections as the request is not complete and it will eventually exhaust all the resources on the server, blocking the legitimate requests.
  2. Slow body (a.k.a R-U-Dead-Yet)
    R-U-Dead-Yet works just like Slowloris, but instead of sending never ending headers, it sends never ending POST body, forcing the server to keep the connections open. When all the resources of the server are occupied, it is unable to serve the legitimate requests.
  3. Slow read
    The above-mentioned attacks exploit a web server by sending slow requests, however, slow read exploit is based on reading responses from a server very slowly. It works by advertising a very low client receive buffer size, triggering a big response from the server, and taking up to minutes to read a single response. When multiple such connections are created concurrently, it can consume all the server resources and lead to DoS. It can’t be explained better than the author of this attack himself in this post.

    Nginx architecture
    img2
    Nginx has a master process and a number of helper processes (including worker processes). Master process manages all the privileged operations whereas the worker processes do the actual work and handle the connections. Nginx’s architecture is fundamentally different from that of Apache’s. Apache spawns a blocking thread for every new connection, whereas Nginx is based on non-blocking event-driven architecture.
    The diagram below summarises the flow:
    img3

    This architecture provides innate prevention against Slow HTTP attacks to some extent as the worker process is not blocked on IO. It can continue to serve other requests. However, it is not full proof and depends on the Nginx configuration options as well.

    Some of the common configuration options provided by Nginx to prevent such attacks are:

    1) limit_req – to limit the rate of requests from one IP
    2) limit_conn – to limit the number of connections from one IP
    3) client_body_timeout – to close the connections with slow body
    4) client_header_timeout – to close the connections with slow headers
    5) send_timeout – If the client does not receive anything within this time, the connection is closed.

Conclusion
Slow HTTP attacks can be as vicious as volumetric DDoS attacks, if not dealt properly. Moreover, there are a lot of moving parts in the Nginx configuration and we need to understand them properly before making random copy/paste changes.

I also see one more fix to this problem by rejecting very low client-side receive buffer window sizes, but I’m yet to explore that path.

References
1) SlowHTTPTest
2) Are you ready for slow reading
3) Inside Nginx
4) Nginx reference
5) Nginx DDOS mitigation



Similar Reads

MATLAB | Convert video into slow motion
MATLAB also called Matrix Laboratory is a numerical computing environment and a platform for programming language. it was designed and developed by MathWorks. MATLAB is a framework that allows you to perform matrix manipulations, implementing algorithms, plotting functions and data, creating user-interfaces and interfacing with programs that are wr
2 min read
7 Major Reasons Why Your Android App is Performing Slow - Must Read For Developers!
"Nothing worse than a laggy slow app!". Laggy apps deliver bad experiences to users. It’s true that most of the end-users can’t wait to get a response from a mobile app. The absolute loading time for a mobile app is about two seconds. Still, according to research by Akamai research, for every extra second that the app consumes, the conversion rate
5 min read
Slow Start Restart Algorithm For Congestion Control
Once a connection is established between client and server, the sender sends the data to the receiver in form of packets. If the network is congested then packets get dropped. This happens when the buffer of intermediaries devices such as Router is filled. TCP sender has to detect whether it has filled up ‘buffers at the intermediate devices’, and
5 min read
Impact of Three-way Handshake and Slow Start Algorithm
Internet became something without which our lives are incomplete. Every day each internet user makes 100s of queries on the internet, be it a simple google search or visiting any website and no one likes the delay in the response. In this article, we will discuss time delay that affects internet speed. A three-way handshake was introduced in the in
8 min read
How to Fix HTTP 505 Error: HTTP Version Not Supported?
HTTP, or the HyperText Transfer Protocol, is the most important part on which data communication on the World Wide Web depends. When we are using the web, it is quite normal to come across errors. One example is the HTTP 505 error, which signals that the server doesn't support the HTTP version used in the request. As we move through the article, we
8 min read
Down-sampling in MATLAB
The two basic operations in a multi-rate system are decreasing/down-sampling (decimation) and increasing (interpolation) the sampling rate of a signal. In down-sampling we start with a constant time signal x(t) and convert it into a succession of tests x[n], in decimation we start with a discrete-time signal x[n] and convert it into another discret
2 min read
HTTP Cookies in Node.js
Cookies are small data that are stored on a client side and sent to the client along with server requests. Cookies have various functionality, they can be used for maintaining sessions and adding user-specific features in your web app. For this, we will use cookie-parser module of npm which provides middleware for parsing of cookies. First set your
4 min read
What are the differences between HTTP, FTP, and SMTP?
HTTP stands for Hyper Text Transfer Protocol, FTP for File Transfer Protocol, while SMTP stands for Simple Mail Transfer Protocol. All three are used to transfer information over a computer network and are an integral part of today’s internet. Why do we need three Protocols for transferring files? We need the three protocols as they all serve diffe
2 min read
HTTP Cookies
There is no way you can skip cookies if you are a developer. A cookie is today as important in internet as any language. Cookies has made our way simpler and better, both for the developer and the user. So in this chapter we will focus on. What is a cookie? Cookie in simpler terms means just the textual information about some website. When you visi
4 min read
What is web socket and how it is different from the HTTP?
HTTP and WebSocket both are communication protocols used in client-server communication. HTTP protocol: HTTP is unidirectional where the client sends the request and the server sends the response. Let's take an example when a user sends a request to the server this request goes in the form of HTTP or HTTPS, after receiving a request server send the
5 min read