Layer 1: n8n must never sit directly on the internet
n8n says so itself: do not expose the n8n process directly, put a reverse proxy in front of it. In the Docker recipe, only Caddy answers from outside, and n8n has no open port. Behind a proxy, N8N_PROXY_HOPS must be set so that n8n sees the real client IP.
The editor does not need to be open to the whole world. Webhooks have to be reachable from outside, but you can close off the rest with an extra login in the proxy:
# Caddyfile – extra login on the editor, webhooks and forms stay open
{$N8N_DOMAIN} {
@editor not path /webhook/* /webhook-test/* /webhook-waiting/* /form/* /form-test/* /form-waiting/*
basic_auth @editor {
# caddy hash-password --plaintext 'long-password'
drift $2a$14$erstat.med.jeres.egen.hash
}
reverse_proxy n8n:5678
}
On top of that: n8n’s own login with two-factor authentication for all users (N8N_MFA_ENFORCED_ENABLED=true) and secure cookies, which are on by default. SSO via SAML or OIDC comes with the expensive plans.
Layer 2: webhooks must prove who sent them
A webhook URL is just an address. Anyone who knows it can send data in. That is why Facebook, Instagram and WhatsApp sign every message with your App Secret in the X-Hub-Signature-256 header. We check the signature on all our Meta webhooks, and unsigned or tampered messages get a 403 response.
The flow in n8n:
- Webhook (POST) with the Raw Body option switched on and Respond: Using ‘Respond to Webhook’ Node.
- Code – picks up the raw bytes and the signature (code below).
- Crypto – action Hmac, type SHA256, value
{{ $json.raw }}, encoding HEX, propertyexpected. The App Secret lives in a Crypto credential, not in the node. - If –
{{ $json.signature.length === 64 && $json.signature === $json.expected }}. - True: Respond to Webhook 200 and carry on. False: Respond to Webhook 403 and stop.
// Code node, "Run Once for All Items" – after a Webhook with Raw Body
const item = $input.first();
const buf = await this.helpers.getBinaryDataBuffer(0, 'data'); // raw bytes, not JSON
const header = item.json.headers['x-hub-signature-256'] || '';
const raw = buf.toString('utf8');
let body = {};
try { body = JSON.parse(raw); } catch (e) { /* invalid JSON → rejected by If */ }
return [{
json: {
raw, // exactly what Meta signed
signature: header.replace(/^sha256=/, ''), // hex without prefix
body,
},
}];
The signature has to be calculated on the raw bytes. If you let n8n parse the JSON first and then turn it back into text, the signature no longer matches. The verification call (a GET with hub.verify_token and hub.challenge) is a separate Webhook step. MobilePay uses a different signature, which we show on the templates page.
If the sender has fixed IP addresses, the Webhook node can also reject everything outside an allowlist with a 403.
Layer 3: no tokens in URLs
We moved hard-coded bot tokens out of URLs in 36 HTTP nodes spread over 12 workflows and into credentials and environment variables. A token in a URL ends up in the history of every execution, in exported workflows and in log files. A credential is encrypted with the instance’s key.
- Use Header Auth or Custom Auth as the credential for the HTTP Request node.
- Use the built-in nodes where they exist. The Telegram node has its own credential, so the token does not appear in the URL.
- Never share an exported workflow before you have searched it for
token,keyandsecret.
Layer 4: who is allowed to write code?
The Code node runs JavaScript and Python. The task runner in external mode is the only layer that isolates that code from n8n’s database, keys and credentials. Some older nodes run completely outside that isolation. Block them with NODES_EXCLUDE, and only give editing rights to people you trust fully.
Known vulnerabilities you need to know about
Selected vulnerabilities in n8n
| Vulnerability | Severity | What it does | Fixed in |
|---|---|---|---|
| CVE-2026-21858 (GHSA-v4pr-fm98-w9pg) | Critical, CVSS 10.0 | Access to files on the server without login via form and webhook handling | 1.121.0 |
| CVE-2025-68613 (GHSA-v98v-ff95-f3cp) | Critical | Code execution via expressions written by logged-in users | 1.122.0 |
| GHSA-9p7v-45m2-wxgj | High, CVSS 8.7 | Function, Function Item and LangChain Code run code outside the task runner | 2.42.6 / 2.43.3 / 3.0.1 |
The first one affects versions from 1.65.0 up to 1.121.0 and needs no password. The second requires a user who is allowed to edit workflows. The third can be mitigated for now with NODES_EXCLUDE.
About pinning a version: we have one instance pinned to a specific version ourselves. Pinning does not mean standing still. n8n still ships fixes on older lines, the latest one on the same day we checked. Pin the major line, take the fixes, and read the advisories before every update. Our routine runs a regression test after every update. How to follow the advisories automatically and upgrade with a backup and a health check is on updating n8n.
Layer 5: monitor the result, not just the status
An execution can show success even though nothing arrived. In a salon reminder workflow, 12 of 207 SMS were never sent, because the JSON was built by concatenating text, and a \ in a service name broke it. The fix was JSON.stringify and an explicit check of whether the message was sent. This is a security issue too: errors nobody sees do not get fixed.
Also remember that the execution history can contain personal data about your customers. Set up fixed pruning so that it is not kept longer than necessary.
Sources
- n8n – Production requirements — reverse proxy,
N8N_PROXY_HOPS, checked 19.11.2026 - n8n – Security environment variables — MFA, cookies, access to environment variables, checked 19.11.2026
- Meta – Webhooks, Getting Started —
X-Hub-Signature-256, verification call, checked 19.11.2026 - n8n – Crypto node and Webhook node — Hmac with a credential, Raw Body, IP allowlist, checked 19.11.2026
- GHSA-v4pr-fm98-w9pg, GHSA-v98v-ff95-f3cp, GHSA-9p7v-45m2-wxgj — official advisories, checked 19.11.2026
- n8n – releases — stable, beta and older lines, checked 19.11.2026
Questions about n8n security
Is n8n safe to run yourself?
Yes, if it sits behind a reverse proxy, is updated regularly, has two-factor login and only gives editing rights to people you trust. Critical bugs in n8n have hit exactly the instances that were not updated.
How do I know a webhook really comes from Meta?
Calculate HMAC-SHA256 of the raw message with your App Secret and compare it with the X-Hub-Signature-256 header. If they do not match, respond with 403.
Where should API keys live in n8n?
In credentials, which n8n encrypts. Not in URLs, Code nodes or Set nodes, where they end up in the history and in exports.
How often should n8n be updated?
At least monthly, and straight away when a critical advisory comes out. Take a backup first, and test the most important flows afterwards.
Fixed price, no commitment
Get a fixed price for your n8n task
Tell us briefly what you use today and what you want to achieve. A person answers by e-mail with a proposal and a fixed price before any work starts.
- A fixed price before we start
- An answer by e-mail, no calls
- Your details are used only to answer you