# CVE-2026-24132: Orval Mock Generation Code Injection via const

> Attackers can inject arbitrary code into generated mock files via malicious OpenAPI specifications, potentially leading to code execution during development.

- **Severity:** High 7.7 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 22 Jan 2026
- **Updated:** 23 Jan 2026
- **Also known as:** GHSA-f456-rf33-4626

## What is CVE-2026-24132?

CVE-2026-24132 is a high-severity code injection vulnerability in orval-labs orval, published on 22 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Orval generates type-safe JS clients (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification. Versions 
7.19.0 and below and 8.0.0-rc.0 through 8.0.2 allow untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. The vulnerability is similar in impact to the previously reported enum x-enumDescriptions (GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core. The issue has been fixed in versions 7.20.0 and 8.0.3.

Weakness: CWE-94 (Improper Control of Generation of Code), CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2026-24132?

4 open source packages ship an affected version, including @orval/mock. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@orval/mock` | npm | All versions | 7.20.0 |
| `@orval/mock` | npm | All versions | 7.20.0 |
| `@orval/mock` | npm | From 8.0.0-rc.0 | 8.0.3 |
| `@orval/mock` | npm | From 8.0.0-rc.0 | 8.0.3 |

Products: Orval Orval.

## How do I fix CVE-2026-24132?

Upgrade @orval/mock to a fixed version for your release line: 7.20.0 or 8.0.3.

## Is CVE-2026-24132 being exploited?

There is no known exploitation of CVE-2026-24132 in the wild and no public exploit code.

## Other vulnerabilities in orval-labs orval

- [CVE-2026-25141](https://insights.sbomify.com/CVE-2026-25141/): Orval has a code injection via unsanitized x-enum-descriptions uing JS comments (critical 9.3)
- [CVE-2026-23947](https://insights.sbomify.com/CVE-2026-23947/): Orval MCP client is vulnerable to code injection via unsanitized x-enum-descriptions in enum generation (critical 9.3)
- [CVE-2026-22785](https://insights.sbomify.com/CVE-2026-22785/): orval MCP client is vulnerable to a code injection attack. (critical 9.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-24132 and fix it if it is affected.

What it is: CVE-2026-24132 is a high-severity code injection vulnerability in orval-labs orval, published on 22 Jan 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-24132 in the wild and no public exploit code.

Affected packages and fixed versions:
- @orval/mock (npm): affected all versions; fixed in 7.20.0
- @orval/mock (npm): affected all versions; fixed in 7.20.0
- @orval/mock (npm): affected from 8.0.0-rc.0; fixed in 8.0.3
- @orval/mock (npm): affected from 8.0.0-rc.0; fixed in 8.0.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-24132/ (Markdown: https://insights.sbomify.com/CVE-2026-24132/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-24132
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-24132
- OSV: https://osv.dev/vulnerability/CVE-2026-24132

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-24132/
Summaries are generated and may contain mistakes; the official description above is the record.
