T09 · Insecure Skill Coding Practices
- Location
scripts/calculator.py:290- Finding
Arbitrary Code Execution Through Unsafe Pickle Deserialization
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This looks like a legitimate quality-cost analysis skill, but it needs review because it uses unsafe pickle loading and remote report JavaScript in under-disclosed ways.
Install only if you will process trusted local files and are comfortable reviewing or replacing the pickle workflow. Do not open generated reports with sensitive data unless the Plotly CDN dependency is removed, pinned, or otherwise controlled.
scripts/calculator.py:290Arbitrary Code Execution Through Unsafe Pickle Deserialization
scripts/chart_generator.py:293Generated Reports Execute Mutable Unpinned Third-Party JavaScript
This second mismatch finding describes a different overclaim set: the skill promises end-to-end quality-cost analysis and reporting, while the detected code apparently only outputs an intermediate pickle or otherwise incomplete artifact. Such discrepancies can cause unsafe automation decisions, incorrect business analysis, and unjustified trust in generated results or file outputs.
This second mismatch finding describes a different overclaim set: the skill promises end-to-end quality-cost analysis and reporting, while the detected code apparently only outputs an intermediate pickle or otherwise incomplete artifact. Such discrepancies can cause unsafe automation decisions, incorrect business analysis, and unjustified trust in generated results or file outputs.
The skill documents file-reading and file-writing behavior through multiple scripts and output artifacts, but it does not declare any explicit tool scope such as permissions or allowed-tools. In an agent environment, missing scope boundaries can let the skill be invoked with broader filesystem access than intended, increasing the chance of overreach or unsafe file handling.
The trigger condition is broad enough to match many ordinary analysis or reporting requests, which can cause the skill to activate outside its narrow competence. Over-broad activation increases the chance of inappropriate tool use, incorrect analysis on unsuitable inputs, and exposure of user files to a skill that may not need them.
The activation guidance lacks clear boundaries for when the skill should not run, making accidental or excessive invocation more likely. In a skill that touches local files and produces reports, ambiguous activation criteria can lead to unnecessary data access and misleading outputs in contexts where the assumptions of the workflow do not hold.
The HTML document explicitly sets the page language to "zh-CN", and the visible report content is also fixed in Chinese. The policy requires flagging language or locale constraints when the skill forces a specific language without user opt-in or documented justification.
The template loads Plotly from an external CDN, which creates unnecessary network dependency for a skill described as local data analysis and report generation. If the CDN is unavailable, blocked, or serves compromised content, generated reports may fail to render correctly or could execute attacker-controlled JavaScript when opened.
This markdown file is natural-language guidance and all headings and instructions are presented only in Chinese. Under the policy rule, forcing a specific language without user opt-in or a documented regional justification is a locale-policy violation.
This code file contains natural-language strings and documentation entirely in Chinese, beginning with the module docstring and continuing through CLI help and runtime output. Because the skill forces a specific language for interaction without any user opt-in or stated region-specific constraint, it violates the language/locale policy criteria.
The script deserializes attacker-controlled input with pandas.read_pickle(), which uses Python pickle under the hood and can execute arbitrary code during loading. In an agent skill context that processes user-supplied files, this is especially dangerous because a malicious .pkl file could achieve code execution as soon as the calculator reads it, before any business validation occurs.
try:
# 读取数据
df = pd.read_pickle(args.data)
print(f"已读取数据: {df.shape[0]} 行, {df.shape[1]} 列")
# 读取列类型(如果有)
This code file contains natural-language strings that force a specific language/locale for the skill’s interface, including the module docstring and later user-facing status messages/argument help. The policy allows locale constraints only when users are given a choice or the restriction is clearly documented and justified, neither of which is present here.
The generated chart fragments use Plotly with include_plotlyjs='cdn', which causes the resulting HTML to load JavaScript from an external network source at view time. For a local analysis/reporting skill, this introduces unnecessary outbound network dependency, creates privacy leakage about report access, and makes report integrity depend on a third-party CDN.
The saved combined HTML explicitly includes a remote , adding external code execution from a third-party origin whenever the report is opened. This expands the trust boundary beyond the skill's stated purpose and can expose sensitive business data in the report context to supply-chain or tracking risks.
This code file contains natural-language descriptions and CLI/help output in Chinese, starting with the module docstring and continuing throughout the script. That imposes a specific language on users without any opt-in or justification for a region-specific constraint, which matches the language/locale policy violation criteria.
L098 states '纯文档/脚本技能,无外部依赖风险', which contradicts the rest of the file describing executable scripts and required external packages such as pandas, openpyxl, plotly, and jinja2 in L018-L024. This is an intent/documentation contradiction rather than a mere omission, because it affirmatively asserts absence of external dependency risk.
该技能文档标题与全文内容均使用中文,没有说明这是面向特定中文环境的区域性文档,也没有提供语言/locale 选择。根据规则,未取得用户选择即强制单一语言属于自然语言层面的语言/locale 策略问题。
清单描述将该技能定位为质量成本分析工具,列出的是读取多Sheet数据、列识别、清洗、分类计算、图表和HTML报告输出等分析流程,但本文件实际还执行了未在描述中明确提到的中间结果持久化。将清洗后的数据保存为 pickle 属于额外的文件写入行为,而不是纯粹的数据读取/清洗实现细节。
该技能的 stated purpose 是质量成本分析及报告生成;写出 pandas pickle 是一种面向程序内部复用的序列化能力,而非用户可感知的分析或报告功能。相较于 CSV/Excel/HTML 等面向分析结果的输出,pickle 更像额外的工程便利能力,未从描述中得到直接支撑。
No suspicious patterns detected.