T09 · Insecure Skill Coding Practices
- Location
main.js:20- Finding
Arbitrary Command and Code Execution Through Unsanitized Mathematical Expressions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This calculator skill is simple in purpose, but it evaluates user-provided math by inserting it directly into local shell, Python, or PowerShell commands, which can allow arbitrary command execution.
Do not install this version unless you fully trust every expression passed to it and accept host command execution risk. It should be rewritten to use a safe in-process math parser or strict arithmetic grammar, with no shell/interpreter string construction from user input.
main.js:20Arbitrary Command and Code Execution Through Unsanitized Mathematical Expressions
The function interpolates untrusted expression input directly into shell and interpreter command strings passed to execSync. An attacker can supply shell metacharacters or language payloads to execute arbitrary OS commands on Linux, macOS, or Windows, making this a direct command injection / arbitrary code execution issue.
The skill explicitly states it will execute local OS CLI tools such as bc, python3, or PowerShell on the host, but it does not warn users that their input will be turned into commands executed in the local environment. That omission is dangerous because mathematical expressions are untrusted input, and if command construction is not strictly sandboxed and escaped, it can lead to command injection or unsafe host interaction while users may not realize the trust boundary they are crossing.
The comments describe the feature as a calculator, but the implementation actually constructs OS shell, Python, and PowerShell commands from user input. This mismatch is dangerous because it hides a code-execution capability behind a benign description, increasing the chance that reviewers or users will trust and invoke unsafe behavior.
The exported calculate path executes user-supplied expressions in subprocesses without any warning, confirmation, or safety gate. In skill/plugin contexts this increases risk because consumers may pass seemingly harmless math input while unknowingly triggering arbitrary command execution on the host.
The user-facing natural-language description and usage instructions are written in Chinese, with no indication that language choice is optional or that the skill is region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The file's user-visible natural language is entirely in Chinese, including comments describing behavior and the runtime error message returned to callers. There is no indication that language selection is optional or justified by a region-specific constraint, so this may violate language/locale policy expectations.
Detected: suspicious.dangerous_exec