GHSA-F456-RF33-4626

Mocking the Mock: RCE via Orval Code Generation

Amit Schendel
Amit Schendel
Senior Security Researcher

Jan 22, 2026·5 min read·6 visits

Executive Summary (TL;DR)

Orval, a popular OpenAPI-to-TypeScript generator, failed to sanitize `const` values from OpenAPI 3.1.0 specifications before writing them to disk. By crafting a malicious schema, an attacker can break out of the generated string literals and inject JavaScript commands. When developers generate mocks or run tests, this code executes instantly. The fix involves replacing naive string interpolation with `JSON.stringify()`.

A high-severity code injection vulnerability in the @orval/mock package allows attackers to execute arbitrary code on developer machines and CI/CD pipelines by embedding malicious payloads in OpenAPI 'const' definitions.

Fix Analysis (2)

Technical Appendix

CVSS Score
8.6/ 10
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS Probability
0.04%
Top 100% most exploited

Affected Systems

@orval/mock < 7.20.0@orval/mock < 8.0.3Node.js Development EnvironmentsCI/CD Pipelines running Orval

Affected Versions Detail

Product
Affected Versions
Fixed Version
@orval/mock
Orval
< 7.20.07.20.0
@orval/mock
Orval
>= 8.0.0 < 8.0.38.0.3
AttributeDetail
CWECWE-94 (Code Injection)
SeverityHigh
CVSS Estimate8.6 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
Attack VectorSpec File Injection
Exploit StatusProof of Concept Available
PatchJSON.stringify() implementation
CWE-94
Improper Control of Generation of Code ('Code Injection')

The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

Vulnerability Timeline

Vulnerability Disclosed
2024-10-25
Patched Version 7.20.0 Released
2024-10-26
Patched Version 8.0.3 Released
2024-10-26

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.