Securing an Exposed Webhook Server

HMAC verification is the minimum — not the complete answer to webhook security

Security compliance — Securing an Exposed Webhook Server
Key takeaways
  • HMAC verification proves the payload was signed with the app secret — but not that it wasn't replayed from an earlier legitimate request.
  • A webhook endpoint without rate limiting is a potential amplification target: an attacker can flood the endpoint with valid-looking requests (signed with a stolen secret) to exhaust your processing capacity.
  • WAF rules for webhook endpoints should enforce: POST-only, Meta IP range allowlisting, Content-Type validation, and body size limits.
Risk signals
  • Webhook endpoints with no rate limiting beyond what HMAC verification provides.
  • No timestamp validation on incoming webhooks — making replay attacks trivially feasible.
  • App secret stored in version control, environment variable without secret management, or accessible to www-data in plaintext.
Action items
  • Implement timestamp validation: reject webhooks with a timestamp more than 5 minutes old.
  • Rate limit the webhook endpoint at the Nginx layer: max 100 requests/minute from any single IP.
  • Store the Meta app secret in a dedicated secret management system — never in code or environment files readable by www-data.

A webhook endpoint that receives WhatsApp messages from Meta is exposed to the public internet. HMAC signature verification proves the payload came from Meta, but it does not protect against replay attacks, rate-based amplification, or attackers who obtain the app secret.

Key Analysis

HMAC verification proves the payload was signed with the app secret — but not that it wasn't replayed from an earlier legitimate request.
A webhook endpoint without rate limiting is a potential amplification target: an attacker can flood the endpoint with valid-looking requests (signed with a stolen secret) to exhaust your processing capacity.
WAF rules for webhook endpoints should enforce: POST-only, Meta IP range allowlisting, Content-Type validation, and body size limits.

Risk Signals

Webhook endpoints with no rate limiting beyond what HMAC verification provides.
No timestamp validation on incoming webhooks — making replay attacks trivially feasible.
App secret stored in version control, environment variable without secret management, or accessible to www-data in plaintext.

Action Items

Implement timestamp validation: reject webhooks with a timestamp more than 5 minutes old.
Rate limit the webhook endpoint at the Nginx layer: max 100 requests/minute from any single IP.
Store the Meta app secret in a dedicated secret management system — never in code or environment files readable by www-data.

LinkedIn

Technical Deep Dive

Read the technical deep dive

See the implementation walkthrough on govindpreetsingh.com

Read on govindpreetsingh.com →

Request a consultation

This is a lightweight intake endpoint for now. It is structured so the practice management system can later take over scheduling, conflict checks and matter creation.

Submitting this form does not create an advocate-client relationship. Please avoid sending confidential details until engagement is confirmed.