Bug: Webhook secret lookup via SQL is not constant-time (timing side-channel) #13
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/upaas#13
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
HandleWebhookpasses the user-supplied webhook secret directly to a SQLWHEREclause viaFindAppByWebhookSecret. Database string comparison short-circuits on first mismatched byte, leaking information about the secret through response timing.Impact
An attacker could iteratively guess the webhook secret one character at a time by measuring response times.
Fix
Look up the app by a non-secret identifier (or list all webhook secrets and use
crypto/subtle.ConstantTimeCompare). Alternatively, hash the webhook secret and compare hashes.Location
internal/handlers/webhook.go—HandleWebhook()internal/models/app.go—FindAppByWebhookSecret()