/

CVE-2025-61140

Severity:

CRITICAL RISK

(9.8)

Prototype Pollution (CWE-1321) in jsonpath value()

CVE-2025-61140

Analyzed

Vulnerability type

Category:

Prototype Pollution

CWE:

CWE-1321, CWE-502

Impact:

Application-wide state corruption and possible RCE

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A prototype pollution flaw in the jsonpath library's value() function allows attackers to modify JavaScript object prototypes via crafted JSON paths and data structures.

When untrusted input is passed into jsonpath operations, this can corrupt global object behavior, potentially leading to arbitrary code execution, data tampering, or security bypass across the application.

Affected context

This vulnerability manifests in Node.js or browser-based applications that integrate the jsonpath library to read or update JSON structures, especially when user-controlled paths or payloads are processed.

It becomes risky when:

  • jsonpath.value() or similar APIs are invoked with unvalidated, attacker-controlled expressions
  • Objects derived from untrusted sources are merged or written into shared state
  • The environment relies on default object properties for logic, security checks, or serialization behavior

Exploit preconditions

  • Attack surface: Any API, endpoint, or feature that exposes jsonpath processing over attacker-supplied JSON or path expressions.
  • Required access: Ability to influence JSON path strings or JSON payloads passed to jsonpath.value() or related functions.
  • Trigger point: Invocation of jsonpath's value-modifying logic on crafted input that targets special keys (e.g., __proto__, constructor, or similar prototype-linked properties).
  • Why exploitation is possible: The implementation permits writes into prototype chains without filtering dangerous key names, allowing attacker-controlled data to alter shared object behavior for all subsequently created instances.

Why this happens

The underlying bug class is prototype pollution, where library code that manipulates nested objects fails to distinguish between regular properties and those that control the prototype chain.

In jsonpath's value() function, key traversal and assignment logic can reach meta-properties like __proto__ or constructors, enabling modification of the base Object prototype.

This aligns with CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where framework or utility code naively merges or writes data structures derived from untrusted input into global object templates.

Potential impact

  • Application logic may be altered by injecting or overriding properties on Object.prototype.
  • Security checks can be bypassed if critical fields or flags are polluted with attacker-controlled values.
  • Data integrity may be compromised through unexpected behavior in serialization, logging, or validation routines.
  • In certain patterns, prototype pollution can be chained into arbitrary code execution via gadget properties or unsafe evaluation flows.
  • Cross-tenant or cross-request contamination can occur, as polluted prototypes affect all objects sharing the same base.

General mitigation guidance

Mitigation generally focuses on constraining how keys are processed and reducing trust in incoming structures before they reach utility libraries like jsonpath.

Recommended design patterns include:

  • Preventing writes to prototype-related keys (__proto__, prototype, constructor, and similar) during object traversal and merge operations.
  • Introducing explicit allowlists for JSON path segments or object keys that can be modified, rather than accepting arbitrary user-defined paths.
  • Treating user-supplied JSON and path expressions as untrusted and enforcing validation, normalization, and type checking before invoking jsonpath routines.
  • Isolating sensitive application state from data structures that are directly manipulated by generic JSON utilities, reducing the blast radius of any unexpected mutations.
  • Employing least-privilege principles in business logic, so polluted properties cannot easily escalate into high-impact behaviors like dynamic code execution or security bypass.

How teams detect issues like this

Effective detection typically combines code-level inspection with runtime safeguards:

  • Static analysis rules that flag direct handling of special keys such as __proto__, constructor, or prototype, especially in generic data manipulation utilities.
  • Manual code reviews focused on data mapping layers, JSON path usage, and third-party helpers that merge or rewrite objects, looking for unsanitized key traversal.
  • Security unit tests or fuzzing that exercise APIs accepting JSON paths or arbitrary object payloads, monitoring for unexpected changes to Object.prototype or other shared prototypes.
  • Policy-driven controls in CI/CD that require scrutiny or additional checks when new dependencies (or updates) introduce JSON manipulation libraries or prototype-touching code patterns.
  • Optional use of automated scanning tools capable of tracing tainted input through object graph operations and highlighting potential prototype pollution flows.

Sources

SourceLink
gist.github.comgist.github.com/Dremig/8105c189774217222a8ebea3ed4d341d
github.comgithub.com/dchester/jsonpath
access.redhat.comaccess.redhat.com/errata/RHSA-2026:2180
access.redhat.comaccess.redhat.com/errata/RHSA-2026:2181
access.redhat.comaccess.redhat.com/errata/RHSA-2026:3960
access.redhat.comaccess.redhat.com/errata/RHSA-2026:3962
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6174
access.redhat.comaccess.redhat.com/errata/RHSA-2026:6802
access.redhat.comaccess.redhat.com/security/cve/CVE-2025-61140
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2433946
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-61140.json

Frequently asked

questions

Exploitability depends on how jsonpath is integrated. If attackers can control JSON paths or payloads passed into jsonpath.value() in a shared runtime, they can likely pollute prototypes and affect broad portions of the application.

An attacker needs the ability to send data or path expressions that are eventually processed by jsonpath functions. This often occurs through public APIs, form submissions, or message-based integrations that feed into JSON handling layers.

The most robust fix is to block or strictly control prototype-related keys during object traversal and assignment, combined with validation of incoming paths and keys. Treat all externally-sourced structures as untrusted and restrict them to a safe subset of allowed properties.

Developers can adopt secure-by-default data handling patterns: use hardened utility functions that never touch prototypes, enforce key allowlists, conduct security reviews for libraries that manipulate deep object graphs, and integrate static analysis to detect unsafe key handling before code is merged.

Find out what's already
exploitable in your codebase.