Описание
WhoDB Allows Unbounded Memory Consumption in Authentication Middleware Can Lead to Denial of Service
Summary
A Denial of Service (DoS) vulnerability in the authentication middleware allows any client to cause memory exhaustion by sending large request bodies. The server reads the entire request body into memory without size limits, creating multiple copies during processing, which can lead to Out of Memory conditions.
Affects all versions up to the latest one (v0.43.0).
Details
The vulnerability exists in the AuthMiddleware function in core/src/auth/auth.go. The middleware processes all API requests (/api/*) and reads the entire request body using io.ReadAll without any size limits:
The issue is amplified by:
- A generous 10-minute timeout (
middleware.Timeout(10*time.Minute)) - High throttle limits (10000 concurrent requests, 1000 backlog)
- Multiple copies of the request body being created during processing
- No per-client rate limiting
PoC
- Run the latest WhoDB:
- Prepare a PoC Python script:
- Run the script and observe memory usage of the WhoDB container. Run it a few times in parallel, or increase the payload size. I was able to hit the OOM killer on a 8 GB VM quickly. Process "core" is the entrypoint of the container.
Impact
- Severity: High
- Authentication Required: No (public API endpoint)
- Affected Components: All API endpoints (
/api/*) - Impact Type: Denial of Service
Any client can send arbitrarily large request bodies to the API endpoints. Due to the multiple copies created during processing and lack of size limits, this can quickly exhaust server memory, potentially affecting all users of the system. The high concurrent request limits and long timeout make this particularly effective for DoS attacks.
Fix considerations:
- Implement request body size limits using
http.MaxBytesReader - Reduce the request timeout from 10 minutes
- Implement per-client rate limiting
- Consider streaming body processing instead of loading entirely into memory
Пакеты
github.com/clidey/whodb/core
Отсутствует
7.5 High
CVSS3
Дефекты
7.5 High
CVSS3