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 only the Access-Control-Allow-Origin entry of the Response Headers option, in any letter case and the last one when it repeats, on the Webhook node and on each enabled Respond to Webhook node that the workflow's connections lead to from a Webhook that responds through such a node, and counts the header as open when its value is * or null or, on a Respond to Webhook node, an expression in double braces, since its value is only known when n8n evaluates it
• 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 or a header that is an expression being shown as set by an expression without its text; 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 Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' pentesting team, fill out this contact form.