GHSA-2w86-xfrc-g85r: SQL Injection

Published Sep 3, 2026
·
Updated

Summary

orval, when generating MSW mocks (output.mock: true), emits each schema property name as a single-quoted object key in the mock factory WITHOUT escaping the single quote. A ' in a property name closes the key and lands in object-literal context, where an injected computed property key [expr] is evaluated when the mock factory is called (e.g. in tests / MSW handlers) -> RCE. The property name is a pure data field. Verified on orval 8.19.0 / Node.

Details

ts export const getOpResponseMock = (...): Thing => ({'x': 0, [require("fs").writeFileSync("PWNED","")]: 0, 'y': faker...., ...overrideResponse});

Safe elsewhere: the zod schema double-quotes the property name; the TS interface key is a type (DoS only). Distinct from orval's $ref / route-path / server-url / zod-default findings.

PoC

reproduce.sh (+ makespec.py) attached: a property name x': 0, [require("fs").writeFileSync("<marker>","")]: 0, 'y -> mock object literal; calling the mock factory writes the marker. Verified on 8.19.0.

Impact

JavaScript / OS command execution (via childprocess) on the machine of anyone who generates orval mocks from an attacker controlled spec and runs them (tests / MSW).

Suggested fix

Escape the property name for the JS string key (JSON.stringify), and never interpolate a raw property name adjacent to [ ] in object-literal position.

Affected Software

1 affected componentFixes available
npm/orval<8.21.0
8.21.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/orval to a version that resolves this vulnerability.

    Fixed in 8.21.0
  2. Upgrade

    Upgrade orval to a version that resolves this vulnerability.

    Fixed in 8.19.0
  3. Configuration

    When emitting mock factory object-literals for schema properties (output.mock: true), escape each property name used as a quoted JS object key (e.g., JSON.stringify) so embedded quotes (') cannot break out of the string and create an injected computed property key [expr]. Never interpolate a raw property name adjacent to [ ] in object-literal position.

    JavaScript object-literal key generation in orval mock factory (output.mock: true) object-literal property key emission = escape property name for JS string key (e.g., JSON.stringify) and avoid placing raw property name next to [ ] in object-literal context

Event History

Sep 3, 2026
Advisory Published
via GitHub·06:26 PM
Data Sourced
via GitHub·06:26 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Users who generate MSW mocks with orval by enabling output.mock: true are exposed if they process an attacker-controlled API specification and later execute the generated mock factory, such as in tests or MSW handlers. The reported impact is code execution on the machine running those generated mocks.

2

What does an attacker need to control to exploit it?

The attacker needs control over a schema property name in the API specification. A property name containing a single quote can break out of the generated single-quoted object key and inject a computed property expression that is evaluated when the mock factory is called.

3

Are all generated outputs affected?

The issue is described specifically in generated MSW mocks. The provided information says Zod schema generation double-quotes the property name, while TypeScript interface generation treats the key as a type and is described as a denial-of-service concern rather than this code-execution path.

4

What can be done if patching is not immediately possible?

Do not generate or execute MSW mocks from untrusted API specifications. As a temporary control, review or reject schema property names containing single quotes before running generated mock factories.

5

How can I determine whether generated mocks may already be dangerous?

Inspect generated MSW mock factory source for schema-derived property names emitted as single-quoted object keys, especially names containing a single quote followed by object-literal syntax such as a computed key. The proof of concept triggers when calling the generated factory, so generated code should be reviewed before test or handler execution.

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