cve prototype-pollution node-js api-security casl CRITICAL 9.8
• 7 min read • ContractShield Team

CVE-2026-1774: How Prototype Pollution in CASL Bypasses Your WAF — And How to Stop It

Nearly 1 million weekly downloads affected. Your WAF won't save you. Here's what will.

Patch available. Update @casl/ability to version 6.7.5+. Versions 2.4.0 through 6.7.4 are affected.

A Critical Flaw in One of Node.js's Most Popular Authorization Libraries

On February 10, 2026, a critical prototype pollution vulnerability was disclosed in @casl/ability — the isomorphic authorization library used by nearly 1 million Node.js projects every week. With a CVSS score of 9.8, CVE-2026-1774 allows attackers to inject arbitrary properties into JavaScript's Object.prototype, potentially escalating privileges, bypassing access controls, or crashing entire applications.

The vulnerability sits in the setByPath utility function, which is exposed through the public rulesToFields() API. Because the function didn't validate property names in path strings, an attacker who controls rule conditions can craft a payload like {"__proto__.isAdmin": true} — and just like that, every object in the application inherits isAdmin: true.

CASL has released version 6.7.5 with a patch that blocks __proto__, constructor, and prototype in paths. If you're running versions 2.4.0 through 6.7.4, update immediately.

But here's the uncomfortable question: what happens next time?

Why Your WAF Didn't See This Coming

This is the part that keeps security teams up at night. The malicious payload for CVE-2026-1774 looks like this:

# Malicious payload
{ "conditions": { "__proto__.isAdmin": true } }

From a WAF's perspective, this is a perfectly valid JSON object. It's well-formed. It has the right Content-Type. It conforms to HTTP standards. A Web Application Firewall inspects traffic at the transport layer — it checks headers, looks for SQL injection patterns, blocks known malicious IPs. But it has zero understanding of your business logic.

The WAF sees a JSON key. It doesn't know that __proto__ is dangerous in the context of your JavaScript application. It doesn't know that your /api/rules endpoint feeds into CASL's rulesToFields(). It doesn't understand that this particular key, in this particular context, will pollute the prototype chain.

This payload passes every WAF on the market. Because it's not a network-layer attack — it's a business-logic attack.

The Gap Between Infrastructure and Application Security

API Gateways are the bouncers at the door — they check your ID and make sure you're on the list.

WAFs are the metal detectors — they scan for known weapons.

But neither one understands the rules inside the venue.

Prototype pollution exploits don't carry "weapons" that signature-based detection can spot. They carry semantically valid data that exploits how your application processes it. The attack surface isn't the network — it's the gap between what your API accepts and what your business logic expects.

This is a pattern we see over and over:

CVE Library Impact
CVE-2026-1774 @casl/ability Prototype pollution via rulesToFields()
CVE-2026-26021 set-in Same class of attack, different library
CVE-2019-7609 Kibana Prototype pollution leading to RCE
CVE-2021-25945 js-data Prototype pollution via crafted objects

Each time, the payload was valid JSON. Each time, WAFs were blind to it.

Contract-First Validation: Catching What WAFs Can't

This is exactly the problem ContractShield was built to solve. Instead of trying to pattern-match against known attacks (a losing game), ContractShield enforces your API contract at the application layer. It understands what your API should accept — and rejects everything else.

Here's how ContractShield would have blocked CVE-2026-1774 before the patch even existed:

1. Schema-Level Property Validation

With ContractShield, your OpenAPI spec defines exactly which properties are allowed in a request:

# openapi.yaml
# openapi.yaml paths: /api/rules: post: requestBody: content: application/json: schema: type: object properties: conditions: type: object additionalProperties: false properties: resource: type: string action: type: string

With additionalProperties: false, ContractShield rejects any property not explicitly defined in the schema — including __proto__, constructor, or any other prototype pollution vector. The malicious payload never reaches your application code.

2. Built-in Prototype Pollution Detection

ContractShield's semantic validation layer includes dedicated checks for prototype pollution patterns. Any JSON key containing __proto__, constructor.prototype, or prototype in any nested path is automatically flagged and blocked:

[ContractShield] BLOCKED: POST /api/rules Reason: Prototype pollution attempt detected Key: "__proto__.isAdmin" in body.conditions Action: Request rejected (403)

This isn't a signature — it's semantic understanding of what constitutes a dangerous property name in JavaScript.

3. Runtime Protection Without Code Changes

The critical advantage: ContractShield provides this protection without modifying your application code. You don't need to wait for CASL to release a patch. You don't need to audit every library in your dependency tree. You define your contract, ContractShield enforces it, and prototype pollution payloads are stopped at the door — regardless of which library downstream might be vulnerable.

The Bigger Picture: Your Dependencies Are Your Attack Surface

CASL Ability has 518 dependent packages. Each of those has its own dependents. The JavaScript ecosystem is a web of trust — and CVE-2026-1774 shows how a single unsanitized utility function in a popular library can cascade into a critical vulnerability across thousands of applications.

You can't audit every line of every dependency. But you can define what your API should accept and enforce it rigorously at runtime. That's the contract-first approach:

  • 1. Define your API contract (OpenAPI/Swagger)
  • 2. Validate every request against that contract
  • 3. Reject anything that doesn't match — before it reaches your business logic

It's not about replacing your WAF or your API gateway. It's about adding the layer they're missing: application-layer intelligence that understands your business logic.

Action Items

Immediate

  • → Update @casl/ability to version 6.7.5+
  • → Audit your codebase for usage of rulesToFields() with user-controlled input

Strategic

  • → Enforce additionalProperties: false in your OpenAPI schemas
  • → Add contract-first validation with ContractShield to catch the next CVE before it's even disclosed
  • → Stop relying on WAFs alone for application-layer security

Protect your APIs against prototype pollution attacks

ContractShield provides runtime API protection through contract-first validation. Open-source core with Apache 2.0 licensing.