n8n Edit Image Node Format Injection Allows Arbitrary File Write
The n8n Edit Image node accepted a user-controlled output format string without validation and passed it directly to GraphicsMagick, letting any authenticated workflow user write files to arbitrary…
The problem
The Edit Image node (n8n-nodes-base.editImage) exposes an output format option and forwards it, unvalidated, to the underlying GraphicsMagick/ImageMagick gm binary.
GraphicsMagick accepts output paths in FORMAT:filepath notation. With no allowlist in place, an attacker could inject a path-traversal component into the format field and cause the library to write the output image to any location the n8n process can reach on disk.
Proof of concept
A working proof-of-concept for this issue in n8n, with the exact payload below.
{
"parameters": {
"operation": "resize",
"width": 100,
"height": 100,
"options": {
"outputFormat": "png:../../tmp/evil"
}
},
"type": "n8n-nodes-base.editImage",
"typeVersion": 1
}GraphicsMagick and ImageMagick both accept the FORMAT:path prefix syntax, where FORMAT controls the codec used to encode the output file. The gm Node.js wrapper passes the format value directly into the output path string it hands to the binary. Before the fix, n8n read outputFormat from the node parameters and wrote outputFormat + ':' + tmpFilePath with no validation, so any string that included a .. traversal sequence or an absolute path would redirect the write.
The patch in commit f69dfc6 introduces an allowlist of safe format strings (png, jpg, jpeg, gif, webp, tiff, bmp) and throws an error before invoking gm if the supplied value is not in that list. This maps to CWE-73: External Control of File Name or Path.
The fix
Upgrade to n8n 1.123.67, 2.31.5, or 2.32.1. If upgrading is not immediately possible, add n8n-nodes-base.editImage to the NODES_EXCLUDE environment variable to disable the node entirely, or restrict instance access to fully trusted users only.
Reported by csuermann (n8n security team).
Related research
- highCVE-2026-86083CVE-2026-86083: n8n Expression Sandbox Escape via JSON.stringify Hijacking
- highCVE-2026-86082CVE-2026-86082: n8n OpenAI Chat Model Node SSRF via Unguarded Model-Search Endpoint
- highCVE-2026-86076CVE-2026-86076: n8n Expression Sandbox Escape via Class-Field Sanitizer Rebinding
- highCVE-2026-86075CVE-2026-86075: n8n Unauthenticated Persistent Storage Exhaustion via OAuth Dynamic Client Registration