Skip to content

[Security] Slowloris / không có connection timeout #8

Description

@JkarVN

Mô tả

Server không cấu hình timeout cho Trantor connection, dễ bị tấn công Slowloris.

Vị trí

  • `src/module/builtin/server/server.cpp` (toàn bộ hàm `Server::start`)

Nguyên nhân

Không có:

  • Idle timeout: attacker mở hàng nghìn connection, gửi chậm từng byte → giữ socket mở vô thời hạn → exhaust FD/memory (Slowloris).
  • Read timeout cho request line/headers.

```cpp
// server.cpp — chỉ setConnectionCallback + setRecvMessageCallback, không set timeout
up_tcp_server->setConnectionCallback(...);
up_tcp_server->setRecvMessageCallback(...);
up_tcp_server->start();
```

Tác động

DoS từ một attacker đơn lẻ với băng thông thấp.

Fix đề xuất

  • Đặt idle timeout (Trantor: dùng `TcpServer` idle connection kicking hoặc `TcpConnection` + `TimerQueue`).
  • Đặt read timeout cho request line + headers (vd. 30s).
  • Giới hạn keep-alive requests per connection.

Mức độ: 🟠 High

Metadata

Metadata

Assignees

Labels

highPriority: highsecuritySecurity vulnerability

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions