CriticalVulnerabilityGHSA-hxj9-33pp-j2ccCVE-2025-66456Published 9 Dec 2025
Elysia vulnerable to prototype pollution with multiple standalone schema validation
Your version
Affected releases · elysia
- 1.x1.4.0 – 1.4.16Fixed in 1.4.17
On 1.x, the newest line:
npm install elysia@1.4.17Every release on a timeline
Not affected
0.1.0 – 1.3.21
235 releases
Affected
1.4.0 – 1.4.16
17 releases
Fixed
1.4.17 – 1.4.30
14 releases, latest
What happens
Prototype pollution vulnerability in mergeDeep after merging results of two standard schema validations with the same key. Due to the ordering of merging, there must be an any type that is set as a standalone guard, to allow for the __proto__ prop to be merged.
When combined with GHSA-8vch-m3f4-q8jf this allows for a full RCE by an attacker.
Impact
Routes with more than 2 standalone schema validation, eg. zod
Example vulnerable code:
import { Elysia } from "elysia"
import * as z from "zod"
const app = new Elysia()
.guard({
schema: "standalone",
body: z.object({
data: z.any()
})
})
.post("/", ({ body }) => ({ body, win: {}.foo }), {
body: z.object({
data: z.object({
messageId: z.string("pollute-me"),
})
})
})Patches
Patched by 1.4.17 (#1564)
Reference commit:
Workarounds
Remove __proto__ key from body
Example plugin for removing __proto__ from body
new Elysia()
.onTransform(({ body, headers }) => {
if (headers['content-type'] === 'application/json')
return JSON.parse(JSON.stringify(body), (k, v) => {
if (k === '__proto__') return
return v
})
})