Skip to content

How to avoid Slowloris DoS Attack? #2741

Closed as not planned
Closed as not planned
@josecelano

Description

@josecelano

This is a very critical issue. I opened an issue one month ago but have not yet found a complete answer.

When you use Axum there is no way to set up a timeout for the time the server waits until the client sends the first request. YOu can reproduce it with:

  1. Setup a basic server with axum.
  2. Open a connection to the server with: telnet localhost 3000.

The server will never close the connection even if the client does not send any request.

You can find more info in the discussion and an example project I have published.

I have converted the discussion into an issue because I think this is a critical issue for some people. I know people who have migrated from Axum to ActixWeb because of this security problem.

I'm even considering it since the main purpose of web framework is to abstract away the details of HTTP operations. And I'm having a lot of trouble trying to patch this problem. I will keep trying and I will post my solution here (if I find it) if I find a complete solution. I know that maintaining this type of library takes considerable effort so I'm not complaining. I just wanted to give more visibility to this problem because I think it's not only my problem but a problem that all users have without even knowing it.

If you want to know what I have tried. I'm trying to use a custom Accetor written by @programatik29 but it does not work when you enable TSL. Details here.

Discussed in #2716

Originally posted by josecelano April 18, 2024

Summary

Relates to: #1383

I'm trying to set a timeout for the time the server keeps a connection open while waiting for the client to start sending a request.

IMPORTANT: it's NOT a timeout for:

  • The time receiving the request headers (after the client starts sending the headers)
  • The time processing the request (because it takes too long)
  • The time building the response body.

I've created a repo to reproduce the problem with a detailed description:

https://github.com/josecelano/axum-server-timeout

It's very easy to perform a slowloris attack .

axum version

0.7.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions