T09 · Insecure Skill Coding Practices
- Location
src/server.js:39- Finding
Unbounded text processing can exhaust server memory and CPU
- Content
View full analysis
w.length > 0); } ``` The corresponding `text` parameters use `z.string()` without a maximum-length constraint. ### Technical Analysis The `analyze_sentiment` and `extract_keywords` MCP tools accept caller-controlled strings without limiting their size. For Chinese input, both tools pass the complete value to `simpleChineseTokenize`. The function creates a cleaned copy of the input, repeatedly allocates two- and three-character substrings, and populates a `words` array during the loop. That array is never returned or otherwise used. The function then creates another array by splitting the complete cleaned string. Consequently, a sufficiently large request can trigger substantial transient and retained allocations, repeated regular-expression operations, and linear iteration. Concurrent oversized calls can amplify the resource consumption. ### Attack Path 1. An attacker or untrusted MCP client obtains permission to call the exposed tools. 2. The attacker invokes `analyze_sentiment` or `extract_keywords` with a very large Chinese-language `text` argument. 3. Zod accepts the argument because the schema imposes no maximum length. 4. `simpleChine ...[truncated 662 chars]- Remediation
View remediation
