Webhook verification mistakes that let forged events through

Most forged webhooks pass a signature check that runs without errors and would accept a request from anyone. Here are six ways that happens, and the fix for each.

Checked 16 Nov 2026.

1. An empty secret still "verifies"

HMAC with an empty key still produces a signature, and anyone who knows the scheme can compute the same one. A blank secret setting gives you a check that every attacker passes.

This bug turned up more than once in 2026. When Discourse's Patreon webhook secret was blank, attackers could sign requests with HMAC-MD5 and an empty key, then create, change or delete pledge data (CVE-2026-26078). In new-api, the Stripe webhook secret defaulted to an empty string, and forged events credited free quota. That advisory says the Stripe Go SDK's webhook.ConstructEventWithOptions doesn't reject an empty secret.

In August, Symfony made three webhook parsers refuse an empty secret (PR #65763). It left alone nine parsers that skip verification when no secret is set, because "they never pretend to have checked anything". On 9 Nov, Svix's PHP library started throwing on an empty secret (v2.10.0).

Fix it by refusing to start when the secret is empty. Never default a secret to "".

2. Comparing signatures with ==

A normal string compare can stop at the first byte that differs, and that timing leaks. The OWASP webhook cheat sheet says never to use ==, and the Standard Webhooks spec warns it can turn your endpoint into a signing oracle. Use crypto.timingSafeEqual or hmac.compare_digest on buffers of the same length.

3. Verifying a parsed body

The provider signed the exact bytes it sent. If your framework parses the JSON and you serialise it again, whitespace, key order or encoding can change, and the signature no longer matches. Read the raw body on the webhook route before any parser runs, verify it, then parse it.

javascript
import { createHmac, timingSafeEqual } from 'node:crypto';
 
const secret = process.env.WEBHOOK_SECRET;
if (!secret) throw new Error('WEBHOOK_SECRET is not set');
 
// rawBody is a Buffer, read before any JSON parser runs.
export function isValid(rawBody, signatureHex) {
  const expected = createHmac('sha256', secret).update(rawBody).digest();
  const given = Buffer.from(String(signatureHex ?? ''), 'hex');
  return given.length === expected.length && timingSafeEqual(given, expected);
}

When isValid returns false, answer 401 and stop.

4. Trusting only the first signature

During a secret rotation, Standard Webhooks senders put several signatures in one header, separated by spaces. Accept the request if any v1 entry matches. OWASP also says to accept only the scheme you expect and ignore the rest, which blocks downgrade attacks.

5. Turning off the timestamp check

Stripe's libraries allow five minutes by default, and Stripe's docs warn that a tolerance of 0 disables the recency check entirely. Keep the default and keep your server clock in sync. Some providers, GitHub among them, sign no timestamp, so deduplicate on the event id instead. For the outage case, see replaying webhooks after an outage.

6. Telling the caller why it failed

A message like "timestamp too old" tells an attacker what to adjust. Return a plain 401 and log the real reason where only you can read it.

Test it

Before you ship, and after any change to the handler, check that:

  • With the secret unset, the app refuses to start.
  • A signature made with an empty key gets 401.
  • A changed body gets 401.
  • A stale timestamp gets 401, if the scheme signs one.
  • The same event sent twice is processed once.

Where SolidHooks helps

SolidHooks verifies each source as requests arrive. For providers such as Stripe, GitHub and Resend you send only the secret, and while their built-in verifier is selected, the API rejects any attempt to change the signing scheme. A failed check gets an opaque 401. The reason is stored on the rejected event, and POST /v1/sources/{id}/test-signature explains why a captured request fails. Under a flood, the rejected log is a sample, not every request.

It can't fix the check inside your own app. Verify SolidHooks' delivery signatures at your endpoint too, or anyone who finds the URL can post to it. A noop source verifies nothing. Once an event passes, still treat the payload as untrusted input (why signed payloads aren't safe agent input).

FAQ

Get started

The Hobby plan is free for 10,000 deliveries a month. Create a source with a provider preset and send it your secret. See verification.