N8n Allowlisted Webhook Open To Any Origin
Description
Detects when a Webhook node in the published version of an n8n workflow trusts its IP allowlist alone, with no authentication of its own, while its CORS lets any website in. Either its Allowed Origins (CORS) option is unset, *, a list led by * or one that names null, and the webhook answers with the workflow's data or takes a method that a browser sends only after asking, or the webhook answers with the workflow's data and its own response headers, or a Respond to Webhook node that answers it, set Access-Control-Allow-Origin to * or null, or that Respond to Webhook node sets it with an expression. A page that someone inside one of the allowed networks opens can then call the webhook from that person's browser, which the allowlist lets in, and read what the workflow returns or send it a PUT, PATCH or DELETE request.
Detection Strategy
• Lists every workflow the API key's user can see through the n8n public API, all of them for an owner or admin key, and reads only the version of each one that is published, skipping disabled nodes
• Keeps the Webhook nodes that limit their callers with an IP allowlist, written as text or as a list of addresses, leaving out a node whose Authentication option is basicAuth, bearerAuth, headerAuth, jwtAuth or n8nOAuth2; an option left unset counts as None, the n8n default
• Reads the Allowed Origins (CORS) option as written and counts it as open when it is unset, the n8n default being *, when it is empty, when its list starts with *, or when it names null
• Reads the Access-Control-Allow-Origin response header on the Webhook node and on each Respond to Webhook node it answers through, and counts it as open when it is * or null
• A header whose expressions each hold one fixed value counts as the text it writes, on either node; any other expression counts as open on a Respond to Webhook node, since its value is only known when the workflow runs
• Reports a vulnerability when the origins are open and the node also answers with workflow data (responseMode responseNode or streaming, or lastNode unless responseData is noData) or accepts PUT, PATCH or DELETE, or when the header is open and the node answers with workflow data, and records the origins or the header with the node that sets it, what a page gains, an Authentication option set by an expression and the IP allowlist in the evidence, an allowlist that is an expression being shown as set by an expression without its text, and a Respond to Webhook header that is an expression the scanner cannot resolve being shown as set by an expression the scanner could not resolve; a workflow whose listing omits the published version field, or whose published version has no node list or no connections, is recorded as unreadable rather than reported as clean
Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' pentesting team, fill out this contact form.