Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-55157 Overview
CVE-2026-55157 is an OS command injection vulnerability in token-optimizer-mcp, a Model Context Protocol (MCP) server that measures token savings and shares a local knowledge graph across AI coding agent CLI clients. Versions prior to 5.1.0 fail to sanitize the username argument passed to the get-user-info operation of the smart_user tool. Any MCP client able to invoke smart_user can execute arbitrary shell commands with the privileges of the account running the server. The maintainer patched the flaw in version 5.1.0.
Critical Impact
Arbitrary shell command execution on the host running token-optimizer-mcp, reachable through any connected MCP client (up to 16 supported CLI clients).
Affected Products
- token-optimizer-mcp versions prior to 5.1.0
- MCP clients integrated with the vulnerable server (up to 16 supported CLI coding agents)
- Any host running the token-optimizer-mcp server process
Discovery Timeline
- 2026-09-28 - CVE-2026-55157 published to NVD
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-55157
Vulnerability Analysis
The vulnerability is a classic OS command injection [CWE-78] in the smart_user MCP tool. The get-user-info operation accepts a username argument and passes it into a shell context without sanitization or safe argument handling. An attacker who controls MCP tool input can append shell metacharacters (for example ;, &&, backticks, or $()) to the username value and execute arbitrary commands on the underlying operating system.
Because token-optimizer-mcp is designed to be shared across multiple AI coding agent CLIs, any of those clients—or any prompt content indirectly reaching the tool through an agent—becomes a viable path to reach the vulnerable operation. Commands run with the same privileges as the user that started the MCP server, which in developer workstations often includes access to source repositories, cloud credentials, SSH keys, and CI tokens.
Root Cause
The server code path handling smart_* tool arguments did not enforce validation before invoking downstream logic. As documented in the patch commit, the original request handler computed a validatedArgs variable using Zod schema validation but then routed the original unvalidated args object to downstream tool cases. The smart_user handler therefore received raw, attacker-controlled input that was concatenated into shell command strings.
Attack Vector
Exploitation requires the ability to call the smart_user tool through an MCP client connected to a vulnerable server. The attack vector is local ([CVSS:3.1/AV:L]), but the attacker does not need prior privileges or user interaction beyond invoking the tool. Malicious payloads may also reach the tool indirectly through untrusted content processed by an AI agent that decides to call smart_user on the attacker's behalf.
// Patch: src/server/index.ts
// fix(security): eliminate os command injection across smart_* tools (#169)
server.setRequestHandler(CallToolRequestSchema, async (request) => {
- const { name, arguments: args } = request.params;
-
- // @ts-expect-error - validatedArgs ensures validation but original args used for type compatibility
- // Validate tool arguments using Zod schemas
- let validatedArgs: any;
+ const { name } = request.params;
+
+ // Validate tool arguments using Zod schemas. The validated (and, for tightened
+ // schemas, sanitized) result REPLACES the raw args so every downstream tool
+ // case operates on validated input — closing the prior gap where the handler
+ // computed `validatedArgs` but then routed the unvalidated raw `args`.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ let args: any = request.params.arguments;
try {
- validatedArgs = validateToolArgs(name, args || {});
+ args = validateToolArgs(name, args || {});
} catch (validationError) {
return {
content: [
Source: GitHub Commit b4ee96d
Stop Remote Code Execution Before It Runs
Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.
Stop Exploit AttemptsDetection Methods for CVE-2026-55157
Indicators of Compromise
- Child processes spawned by the token-optimizer-mcp server (typically Node.js) that launch shells such as /bin/sh, bash, cmd.exe, or powershell.exe.
- MCP request logs containing smart_user calls with username values that include shell metacharacters (;, |, &, backticks, $().
- Unexpected outbound network connections, credential file reads (~/.aws/credentials, ~/.ssh/), or new SSH keys originating from the MCP server process.
Detection Strategies
- Inspect MCP server logs and audit records for smart_user invocations with anomalous username payloads and correlate them with process creation events.
- Monitor developer workstations and build hosts for Node.js processes named after token-optimizer-mcp that spawn shell interpreters or system utilities like curl, wget, or nc.
- Hunt for reads of sensitive files (SSH keys, cloud credentials, .env files) by processes whose parent is the MCP server.
Monitoring Recommendations
- Enable command-line and process-lineage telemetry on all hosts running MCP servers, and forward it to a central analytics pipeline.
- Alert on any child process of the MCP server that is not part of its expected execution graph.
- Track installed versions of token-optimizer-mcp across developer environments to identify hosts still on releases prior to 5.1.0.
How to Mitigate CVE-2026-55157
Immediate Actions Required
- Upgrade token-optimizer-mcp to version 5.1.0 or later on every host and developer workstation.
- Restart all MCP clients so they reconnect to the patched server instance.
- Rotate credentials, tokens, and SSH keys accessible to any account that ran a vulnerable version reachable by untrusted input.
Patch Information
The fix is delivered in token-optimizer-mcp v5.1.0 and tracked in GHSA-49mq-fc6q-3h46. The patch enforces Zod-schema validation on all tool arguments and replaces the raw args object with the validated result, closing the routing gap that allowed unvalidated input to reach smart_* tool handlers. See the security patch commit for full details.
Workarounds
- Disable or unregister the smart_user tool in MCP client configurations until the server is upgraded.
- Run the token-optimizer-mcp server under a dedicated, least-privileged local account with no access to credentials or source repositories.
- Restrict which MCP clients and agents can reach the server, and avoid exposing it to untrusted prompt content or shared multi-user hosts.
# Upgrade token-optimizer-mcp to the patched release
npm install -g token-optimizer-mcp@5.1.0
# Verify the installed version
npm ls -g token-optimizer-mcp
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

