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-65016: n8n SSO Instance-Role Provisioning Privilege Escalation to Instance Owner
- highCVE-2026-59209CVE-2026-59209: n8n Shared Credential Header Leak via HTTP Request Pagination Expression
- highCVE-2026-59206CVE-2026-59206: n8n Prototype Pollution via Workflow Credentials
- highCVE-2026-59207CVE-2026-59207: n8n AI Agents MCP Connector Allowed HTTP Request Domains Bypass