Stop Writing Regexes for IP Security: SSRF Protection Is a Networ
The webhook URL validation in Formbricks used regular expressions and string prefixes to classify IP addresses as private or public, which did not match the actual CIDR network ranges. An attacker could supply a URL pointing to an internal address that the classifier treated as public, potentially reaching internal services.
Published on medium.com
One of the easiest ways to make a security control fragile is to model the wrong thing. For SSRF protections, that mistake often looks harmless: a few regular expressions for IPv4, followed by some IPv6 prefixes added later.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The classifier modelled IP addresses as text strings with regular expressions and prefixes instead of using network primitives that understand CIDR ranges and address families.
Impact
An attacker could bypass the webhook URL denylist and cause the server to make requests to internal or special-purpose destinations, though some IPv6 transition cases require specific network infrastructure to be exploitable end to end.
What the attacker needed
Webhook URL configuration feature; ability to set a webhook URL
The fix
The fix replaced the regex and string-prefix checks with Node.js net.BlockList CIDR matching, derived the IP family from the parsed address, and made unparseable inputs fail closed.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A webhook lets one website send data to another. Formbricks tried to stop users from pointing webhooks at internal machines by checking the address text with simple patterns. But those patterns did not match the real network ranges, so some internal addresses looked public and could be reached.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.