MEDIUM: Unbounded request body read in webhook handler — denial of service #21

Closed
opened 2026-02-16 05:47:11 +01:00 by clawbot · 1 comment
Collaborator

Bug

File: internal/handlers/webhook.go, HandleWebhook(), line ~30

Severity: MEDIUM — Denial of Service

Description

The webhook handler reads the entire request body without any size limit:

body, readErr := io.ReadAll(request.Body)

An attacker who knows (or guesses) a webhook URL can send an arbitrarily large payload, consuming all available memory and causing the process to OOM.

The webhook endpoint is unauthenticated (protected only by the secret in the URL), making this externally exploitable.

Suggested Fix

Use io.LimitReader to cap the body size:

const maxWebhookBodySize = 1 << 20 // 1MB
body, readErr := io.ReadAll(io.LimitReader(request.Body, maxWebhookBodySize))
## Bug **File:** `internal/handlers/webhook.go`, `HandleWebhook()`, line ~30 **Severity:** MEDIUM — Denial of Service ### Description The webhook handler reads the entire request body without any size limit: ```go body, readErr := io.ReadAll(request.Body) ``` An attacker who knows (or guesses) a webhook URL can send an arbitrarily large payload, consuming all available memory and causing the process to OOM. The webhook endpoint is unauthenticated (protected only by the secret in the URL), making this externally exploitable. ### Suggested Fix Use `io.LimitReader` to cap the body size: ```go const maxWebhookBodySize = 1 << 20 // 1MB body, readErr := io.ReadAll(io.LimitReader(request.Body, maxWebhookBodySize)) ```
Owner

this is already fixed in #6

this is already fixed in #6
sneak closed this issue 2026-02-16 06:32:16 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/upaas#21
No description provided.