Key Takeaways
- Webhooks are public doors into your app. If you accept them without checking who sent them, anyone can post fake events that trigger real actions like granting access or marking invoices paid.
- Most SaaS products sit on both sides: they receive webhooks from tools like payment providers, and they send webhooks to customers. Each side has its own risks.
- Receivers need signature checks, replay protection, and duplicate handling. Senders need strong controls on where customers can point their callbacks.
- A pentest should test both directions, including whether one customer can see or change another customer’s webhook settings.
Webhooks are easy to build and easy to get wrong. A developer adds an endpoint so the payment provider can say a charge succeeded, it works in testing, and it ships. Nobody asks what happens if a stranger sends the same request. Webhook security is the set of checks that answers that question, and it matters for almost every SaaS startup, because almost every SaaS startup uses them. Here is what to know, in plain language.
Why Webhooks Are Risky
A webhook is a message sent from one system to another when something happens. Your app exposes a URL, and another service sends a request to it. The problem is that anyone on the internet can also send a request to that URL.
Stripe’s documentation puts the risk plainly. Without verification, it says, an attacker could send fake webhook events to your endpoint to trigger actions like fulfilling orders, granting account access, or modifying records. That is true of any webhook, not only payment ones.
The OWASP Webhook Security Cheat Sheet covers both sides of the problem, receiving and sending. It is a good reference to hand to your engineers.
Webhook Security When You Receive Webhooks
If your product accepts events from other services, these are the main controls.
- Verify the signature. Most providers sign each delivery with a secret that only you and they know. Your code should recompute the signature over the raw request body and compare it. The OWASP cheat sheet recommends a constant time comparison and warns that a plain equality check leaks timing information.
- Use the raw body. Signature checks depend on the exact bytes that were sent. Stripe warns that a framework that changes the raw body will make verification fail, which tempts people to switch the check off. Fix the framework setting instead.
- Reject old requests. A replay attack is when someone captures a real request and sends it again. Signed timestamps let you refuse deliveries that are too old. Stripe’s libraries use a default tolerance of five minutes and warn against setting it to zero, which disables the check.
- Handle duplicates. Providers can send the same event more than once. Log event IDs you have processed and skip repeats, so a repeated “payment succeeded” does not credit an account twice.
- Do not assume order. Events can arrive out of order. If order matters, fetch the current state from the provider instead of trusting the sequence.
- Fail quietly. If a signature is missing or wrong, return an error without explaining why.
- Accept only what you need. Subscribe to the event types your product uses, and no others.
- Use HTTPS and protect the secret. Keep secrets in a secrets manager, never in code or logs, and rotate them if they may have leaked.
Where a provider publishes the addresses it sends from, allowing only those can add a second layer. Treat it as an extra, not a replacement for signature checks.
Webhook Security When You Send Webhooks
Many SaaS products let customers register a URL and then send events to it. That feature carries a different risk. If a customer can point your server at any address, your server may be used to reach places the customer should never reach.
This is called server side request forgery, or SSRF. OWASP lists it as its own category in the API Security Top 10. In a webhook feature, an attacker registers a callback URL that points at an internal address, such as a cloud metadata service or an internal admin tool, and your server makes the request for them.
The OWASP cheat sheet recommends, for senders:
- Allow only HTTPS. Reject other schemes.
- Block non public addresses. That includes internal ranges and their IPv6 equivalents.
- Check the address actually connected to. Checking the name earlier is not enough, because a name can resolve to a different address later.
- Disable redirects, or check every redirect. A safe URL can redirect to an unsafe one.
- Isolate delivery workers. Keep them away from internal networks where you can, optionally behind an egress proxy.
- Limit and monitor. Cap retries, apply per customer rate limits, and watch for unusual delivery patterns.
- Sign what you send. Give customers a signature and a timestamp so they can verify your webhooks too, and support rotating secrets without downtime.
Not sure whether your webhooks are tested? Book a scoping call and we will tell you how we would approach your integrations.
The Multi Tenant Risk People Forget
In a SaaS product, webhook settings belong to customers. That raises a question that is easy to miss: can one customer see or change another customer’s webhook configuration?
If webhook endpoints, secrets, or delivery logs are not separated properly, a customer might read someone else’s signing secret, edit their callback URL, or view event payloads that contain another company’s data. Delivery logs deserve special attention, since they often store full request bodies.
Common Webhook Mistakes
- No signature check at all. The endpoint trusts any request that arrives.
- Verifying a modified body. The check breaks, so someone turns it off.
- Skipping the timestamp check. Old requests replay forever.
- Processing before acknowledging. Slow work causes timeouts and retries, which create duplicates.
- Secrets in logs or code repositories. Signing secrets treated like ordinary configuration.
- Unrestricted callback URLs. Customers can point your server at internal systems.
- Logging full bodies. Delivery logs end up holding sensitive customer data.
- Shared secrets across customers. One leak affects everyone.
What a Pentest Checks
When webhooks are in scope, a good test looks at both directions:
- Forged requests. Whether your endpoints accept events that were not signed correctly, or signed with the wrong secret.
- Replays and duplicates. Whether resending a captured request changes state twice.
- Callback abuse. Whether the callback URL feature can reach internal addresses or follow redirects to them.
- Secret handling. Whether signing secrets show up in responses, logs, or error messages.
- Tenant separation. Whether one customer can read or change another’s webhook settings and logs.
- Business logic. Whether a forged event can grant access, change a plan, or mark something paid.
If you ship new webhook features or integrations, our guide to pentesting after a major release explains when they deserve their own test.
A Quick Checklist for Your Engineers
- Do we verify a signature on every incoming webhook, using the raw body?
- Do we reject requests with old timestamps?
- Do we record event IDs and ignore repeats?
- Are signing secrets stored safely and rotatable?
- If we send webhooks, which addresses can customers register, and what do we block?
- Can one customer reach another customer’s webhook settings or logs?
- Do delivery logs avoid storing secrets and full sensitive payloads?
How We Approach Webhooks and Integrations
We treat webhooks as part of API testing. When a product receives or sends them, we ask how they are signed, which addresses customers can register, and how settings are separated between customers, then test those areas directly.
FAQ
What is webhook security? It is the set of controls that make sure webhooks you receive really come from the sender, cannot be replayed or duplicated to cause harm, and that webhooks you send cannot be used to attack other systems.
Do I need to verify signatures if the webhook URL is secret? Yes. A hidden URL is not a security control. URLs leak through logs, tools, and mistakes, so verify signatures regardless.
What is a webhook replay attack? It is when someone captures a valid webhook request and sends it again. Signed timestamps and event ID tracking help you reject or ignore repeats.
What is SSRF in webhooks? It happens when a feature lets a user choose a callback address, and your server can be tricked into sending requests to internal or sensitive addresses on their behalf.
Should we allow customers to use any callback URL? Only public HTTPS addresses, with internal and private ranges blocked and redirects controlled. Validate the address your server actually connects to.
Are webhooks covered in a normal SaaS pentest? Often partly. Ask your vendor whether endpoints that receive webhooks and callback features that send them are explicitly in scope.
How often should we rotate webhook secrets? Rotate on a schedule that fits your risk and immediately if a secret may have been exposed. Support an overlap period so rotation does not drop events.
If your product sends or receives webhooks and you want them tested, book a scoping call, or start with our SaaS penetration testing page for more.
Packet33 is a penetration testing and compliance advisory firm serving SaaS and HealthTech startups in the US, Canada, and UK.
Mohamed is the founder of Packet33. He worked as a cybersecurity analyst before launching the firm and now leads an OSCP-certified team serving SaaS and HealthTech startups in the US, Canada, and UK.
