n8n Vulnerable to Remote Code Execution via Git Node Custom Pre-Commit Hook
Description
n8n is an open source workflow automation platform. Versions 0.123.1 through 1.119.1 do not have adequate protections to prevent RCE through the project's pre-commit hooks. The Add Config operation allows workflows to set arbitrary Git configuration values, including core.hooksPath, which can point to a malicious Git hook that executes arbitrary commands on the n8n host during subsequent Git operations. Exploitation requires the ability to create or modify an n8n workflow using the Git node. This issue is fixed in version 1.119.2. Workarounds include excluding the Git Node (Docs) and avoiding cloning or interacting with untrusted repositories using the Git Node.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
n8nnpm | >= 0.123.1, < 1.119.2 | 1.119.2 |
Affected products
1Patches
1d5a1171f95f7fix(Git Node): Disable git hooks by default (#21797)
4 files changed · +39 −0
packages/@n8n/config/src/configs/security.config.ts+6 −0 modified@@ -55,4 +55,10 @@ export class SecurityConfig { /** Whether to allow access to AWS system credentials, e.g. in awsAssumeRole credentials */ @Env('N8N_AWS_SYSTEM_CREDENTIALS_ACCESS_ENABLED') awsSystemCredentialsAccess: boolean = false; + + /** + * Whether to enable hooks (like pre-commit hooks) for the Git node. + */ + @Env('N8N_GIT_NODE_ENABLE_HOOKS') + enableGitNodeHooks: boolean = false; }
packages/@n8n/config/test/config.test.ts+1 −0 modified@@ -316,6 +316,7 @@ describe('GlobalConfig', () => { disableWebhookHtmlSandboxing: false, disableBareRepos: false, awsSystemCredentialsAccess: false, + enableGitNodeHooks: false, }, executions: { mode: 'regular',
packages/nodes-base/nodes/Git/Git.node.ts+5 −0 modified@@ -302,6 +302,11 @@ export class Git implements INodeType { gitConfig.push('safe.bareRepository=explicit'); } + const enableHooks = securityConfig.enableGitNodeHooks; + if (!enableHooks) { + gitConfig.push('core.hooksPath=/dev/null'); + } + const gitOptions: Partial<SimpleGitOptions> = { baseDir: repositoryPath, config: gitConfig,
packages/nodes-base/nodes/Git/__test__/Git.node.test.ts+27 −0 modified@@ -30,6 +30,7 @@ describe('Git Node', () => { }); securityConfig = mock<SecurityConfig>({ disableBareRepos: false, + enableGitNodeHooks: true, }); Container.set(DeploymentConfig, deploymentConfig); Container.set(SecurityConfig, securityConfig); @@ -114,4 +115,30 @@ describe('Git Node', () => { ); }); }); + + describe('Hooks Configuration', () => { + it('should add core.hooksPath=/dev/null when enableGitNodeHooks is false', async () => { + securityConfig.enableGitNodeHooks = false; + + await gitNode.execute.call(executeFunctions); + + expect(mockSimpleGit).toHaveBeenCalledWith( + expect.objectContaining({ + config: ['core.hooksPath=/dev/null'], + }), + ); + }); + + it('should not add core.hooksPath=/dev/null when enableGitNodeHooks is true', async () => { + securityConfig.enableGitNodeHooks = true; + + await gitNode.execute.call(executeFunctions); + + expect(mockSimpleGit).toHaveBeenCalledWith( + expect.objectContaining({ + config: [], + }), + ); + }); + }); });
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-wpqc-h9wp-chmqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-65964ghsaADVISORY
- github.com/n8n-io/n8n/commit/d5a1171f95f75def5c3ac577707ab913e22aef04ghsax_refsource_MISCWEB
- github.com/n8n-io/n8n/releases/tag/n8n%401.119.2ghsax_refsource_MISCWEB
- github.com/n8n-io/n8n/security/advisories/GHSA-wpqc-h9wp-chmqghsax_refsource_CONFIRMWEB
- n8n-docs.teamlab.info/hosting/securing/blocking-nodes/ghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.