← Blog
December 4, 202610 min readAppSecSecurity EngineeringVulnerability ResearchAuthentication

Why do so many webhook receivers accept forged events?

Five 2026 advisories show webhook receivers accepting forged events. Which bytes Stripe, GitHub and Standard Webhooks sign, a fail-closed Node.js verifier, replay and idempotency handling, and the negative tests that belong in CI.

By The Xalgorix Team

In March 2026, OneUptime published CVE-2026-33143. Its WhatsApp status webhook processed delivery updates without checking Meta's X-Hub-Signature-256 header. The reporter sent a forged POST with no signature at all and got an HTTP 200 back. In an on-call product, that meant an outsider could mark failed critical alerts as delivered, so nothing escalated. The same codebase already verified Slack's signatures correctly. One route had simply been left out.

Webhook receivers are an odd kind of endpoint: public, unauthenticated by session or token, exempt from CSRF protection, and trusted to change billing state, notification status or deployment pipelines. The only thing standing between that endpoint and anyone on the internet is a few lines of HMAC code. This guide looks at how those lines failed in five advisories published this year, what each provider's signature actually covers, and a receiver you can copy, with the negative tests that keep it honest.

Five advisories, four ways to get it wrong

All five of these were published in 2026 and all five are on the receiving side. None needed a cryptographic break.

  • The check was never written. Symfony's Mailtrap webhook parser (CVE-2026-45755) and its Twilio notifier parser (CVE-2026-47212) both received the configured secret and never read it. Any POST was decoded and returned as a genuine event, even with a secret configured. Fixed in Symfony 7.4.12 and 8.0.12 (and 6.4.40 for Twilio).
  • One route was skipped. The OneUptime case above: verification existed for Slack and was missing for the WhatsApp POST handler. Fixed in 10.0.34.
  • The request picked the algorithm. Symfony's Mailomat parser (CVE-2026-48747) parsed the algorithm name out of the signature header and passed it straight to PHP's hash_hmac(). As the advisory puts it, “the request therefore selects the HMAC primitive used to authenticate it”, and hash_hmac() accepts weak ones such as MD4 and MD5. Fixed in 7.4.13 and 8.0.13 by accepting only sha256=.
  • The comparison exited early. The Ruby pay gem's Paddle Billing controller compared the computed digest to the Paddle-Signature header with String#==, which returns at the first mismatching byte (GHSA-mjgf-xj26-9qf9, fixed in 11.6.2). The advisory rates it CVSS 7.4 because a recovered signature would let forged transaction.completed events update billing state. Recovering an HMAC through a remote timing channel is hard in practice, but the fix is one function call, so there is no reason to leave it.

Three of the five are missing-authentication bugs wearing a crypto label. That is the pattern worth remembering: the code path that should reject a request either does not exist, is not reached, or can be talked out of rejecting.

Know exactly which bytes the provider signs

Before writing a receiver, find out what the signature covers. Providers differ, and the difference decides what a valid signature can and cannot vouch for.

  • GitHub sends X-Hub-Signature-256: sha256=<hex>, an HMAC-SHA256 of the raw body (GitHub docs). The older SHA-1 X-Hub-Signature exists “only for legacy purposes”. There is no signed timestamp, so the signature gives you no freshness at all.
  • Stripe signs timestamp + "." + raw body and sends Stripe-Signature: t=…,v1=… (Stripe docs). The header can also carry a fake v0 signature on sandbox events and unsigned debug entries; Stripe says to use only t and v1, to tolerate unknown entries, and to ignore other schemes to prevent downgrades.
  • Standard Webhooks, an open spec for webhook signing, signs msg_id.timestamp.payload and sends space-separated v1,<base64> values in webhook-signature (spec). Because the message ID is inside the HMAC, it is a safe idempotency key.
  • Twilio signs the full request URL plus the sorted POST parameters with HMAC-SHA1. Symfony's fix notes the consequence: behind a TLS-terminating proxy you must configure trusted proxies so the app rebuilds the public URL, or genuine requests can fail.
A signature only authenticates the fields inside the MAC. A delivery ID or timestamp sent in an unsigned header is attacker-editable. The OWASP Webhook Security Cheat Sheet makes the point directly for GitHub's X-GitHub-Delivery header, which it says “does not provide the authenticated replay guarantee” a signed ID would.

Read the bytes before anything parses them

The HMAC is computed over the exact bytes on the wire. If a body parser turns them into an object and you re-serialize it, key order, whitespace and Unicode escaping can all change, and the signature stops matching. Teams that hit this in production are tempted to “temporarily” skip the check, which is how a working receiver becomes an open one.

In Express, give the webhook route its own raw parser, and make sure a global express.json() is not registered ahead of it: once the JSON parser has run, express.raw sees the request as already parsed and skips it, so your handler gets an object instead of the original bytes. The verifier below rejects anything that is not a Buffer, which turns that mistake into a loud failure rather than a quiet bypass:

// Webhook route first, with the body left as a Buffer.
app.post("/webhooks/billing", express.raw({ type: "application/json", limit: "256kb" }), handler);

// Everything else can use the JSON parser.
app.use(express.json());

Serverless platforms and API gateways have their own version of this trap: some hand you a parsed object, some base64-encode binary bodies. Log a SHA-256 of the body you are about to verify during integration and compare it with what the provider shows. Stripe's header can even include a payload digest suffix for this, explicitly labelled as debugging metadata that must never be used to authenticate.

A receiver that fails closed

Use the provider's SDK when one exists; it encodes details like scheme pinning that are easy to miss. When you cannot, here is a Stripe-style verifier in Node.js that handles the cases from the advisories above. Before publishing we ran this function against a valid signature, a rotated pair, a v0-only header, a wrong-length signature, a one-byte body change, a stale timestamp and a missing header; only the first two were accepted.

import { createHmac, timingSafeEqual } from "node:crypto";

const SECRET = process.env.WEBHOOK_SECRET;
if (!SECRET) throw new Error("WEBHOOK_SECRET is not set; refusing to start");

const TOLERANCE_SECONDS = 300;

export function verifyWebhook(rawBody, header, now = Math.floor(Date.now() / 1000)) {
  if (!Buffer.isBuffer(rawBody) || typeof header !== "string") return false;

  let timestamp = null;
  const signatures = [];
  for (const part of header.split(",")) {
    const i = part.indexOf("=");
    if (i < 0) continue;
    const key = part.slice(0, i).trim();
    const value = part.slice(i + 1).trim();
    if (key === "t") timestamp = value;
    else if (key === "v1") signatures.push(value); // pin the scheme
  }
  if (!/^\d{1,12}$/.test(timestamp ?? "") || signatures.length === 0) return false;
  if (Math.abs(now - Number(timestamp)) > TOLERANCE_SECONDS) return false;

  const expected = createHmac("sha256", SECRET)
    .update(timestamp + ".")
    .update(rawBody)
    .digest();

  return signatures.some((sig) => {
    if (!/^[0-9a-f]{64}$/i.test(sig)) return false; // also keeps lengths equal
    return timingSafeEqual(expected, Buffer.from(sig, "hex"));
  });
}

The decisions in that code, and why each one is there:

  • A missing secret stops the process. Both Symfony Mailtrap and Twilio fixes keep verification opt-in: with no secret configured, behaviour is unchanged. In your own app, a blank environment variable should be a boot failure, never a silently skipped check.
  • Only v1 counts. The scheme and algorithm are fixed in code. Nothing in the request can choose them, which is the whole lesson of the Mailomat advisory.
  • Every v1 is tried. During a secret roll, Stripe signs with each active secret (the old one can stay valid for up to seven days) and Standard Webhooks does the same. Accepting any match makes rotation seamless.
  • Length is checked before the constant-time compare. Node's crypto.timingSafeEqual throws a RangeError (ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH) when the buffers differ in length. Unhandled, a short garbage signature becomes a 500 instead of a clean 401. A SHA-256 digest is always 32 bytes, so the regex makes the length public and fixed, which leaks nothing.
  • The tolerance is never zero. Stripe's libraries default to five minutes and its docs warn that a tolerance of 0 “disables the recency check entirely”. Keep servers on NTP so a tight window does not reject real traffic.
Raw bytes
size-limited, POST only
HMAC check
pinned scheme, constant time
Freshness
signed timestamp in window
Dedupe
signed event ID
Parse + queue
schema-validated
Each step either rejects or hands on. Nothing is parsed, queued or acted on until the signature and timestamp pass, and the dedupe step sits after verification so attackers cannot poison it.

Replays, retries and duplicate events

A timestamp window stops an old captured request from being replayed next week. It does not stop a replay inside the window, and it does not stop the provider itself from delivering the same event twice. Stripe states plainly that endpoints “might occasionally receive the same event more than once” and that it re-signs each retry with a new timestamp, so a retry from yesterday arrives with a fresh, valid signature.

The fix is an idempotency record keyed on an ID inside the signed content: the Stripe event ID from the verified body, or webhook-id for Standard Webhooks. Insert it in the same transaction as the side effect, or as the job you enqueue for asynchronous processing, so a crash cannot record the event without applying it:

INSERT INTO processed_webhooks (provider, event_id, received_at)
VALUES ('stripe', $1, now())
ON CONFLICT (provider, event_id) DO NOTHING
RETURNING event_id;
-- No row returned: already handled. Respond 200 and do nothing else.

OWASP suggests keeping a short replay cache for at least twice the tolerance window, and a persisted processing record for the provider's full retry period (Stripe retries live events for up to three days). For providers with no signed timestamp or ID, such as GitHub, assume replays are possible: make handlers idempotent and re-read current state from the provider's API rather than trusting the event body as the latest truth.

Negative tests that belong in CI

Four of the five advisories above would have been caught by a single failing test; the fifth, the early-exit comparison, needs code review or a lint rule that flags == on secrets. Webhook verification is unusually easy to test because the attacker's inputs are just HTTP requests you can build yourself. Run these against the real route, through the real middleware stack, so a parser ordering change shows up:

Request to the webhook route
No signature header
401, nothing queued. The OneUptime, Symfony Mailtrap and Twilio bugs fail here.
Valid body, one byte changed
401. Catches a check computed over the parsed object or the wrong field.
Only a v0 / sha1 / md5 signature
401. Catches scheme or algorithm chosen by the request.
Signature of the wrong length
401, never 500. Catches an unhandled timingSafeEqual throw.
Valid signature, timestamp 10 minutes old
401. Catches a missing or zero tolerance.
Same valid event twice
200 both times, side effect once. Catches missing idempotency.

Add one more at the configuration level: start the service with the secret unset and assert that it refuses to boot. If you already keep a suite of security regression tests, these fit the pattern described in our guide to turning fixed vulnerabilities into CI tests.

Testing someone else's receiver

On an authorised engagement or an in-scope bounty target, the first test is the cheapest one: replay a legitimate-looking event with the signature header removed and watch for a 2xx. Use a harmless event type and a test account, because a receiver that accepts it may act on it. Then try a well-formed signature computed with a wrong key. A 2xx on either is a finding; a 500 on a malformed signature is worth noting as a likely unhandled comparison error. Automated scanners, ours included, rarely find these routes on their own, since webhook paths are not linked from any page. Expect to discover them from documentation, client-side config or the provider's dashboard.

What a valid signature still leaves open

A matching HMAC tells you who sent the bytes. It says nothing about whether the content is safe to use. Enforce a body size limit, validate against a strict schema, and treat every string as untrusted input downstream. Where the event drives money or access, prefer the pattern Stripe now pushes with thin events: treat the webhook as a notification and fetch the object from the API before acting.

The signing secret is also a single point of failure. Store it in a secrets manager, use a separate secret per endpoint (Standard Webhooks warns that sharing one across customers “can lead to security issues”), keep it and the signature headers out of logs, and revoke immediately rather than overlapping if you suspect a leak. For high-value flows, the OWASP cheat sheet recommends layering mutual TLS or a bearer token on top of the HMAC, with IP allowlisting only as an extra filter.

None of this is exotic cryptography. The receivers in this year's advisories failed because nobody had written down which requests must be rejected and then tried sending them. Six negative tests and a boot-time check close most of that gap.

Ready to see it prove a bug?

Start scanning on Cloud →