Back to skill

Security audit

血糖管理助手

Security checks for vulnerabilities and agentic risk

Overview

This is a real blood-glucose management skill, but it needs review because it stores sensitive health data and gives medical-style recommendations with weak safety and data-handling safeguards.

Install only if you are comfortable with plaintext local storage of health records and with the skill giving informational, non-clinical guidance. Confirm any import, delete, export, or treatment-related recommendation yourself, do not rely on its predictions for urgent care or medication changes, and be especially careful with mg/dL data and HTML reports from imported files.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/export_report.py:218
Finding

Stored HTML Injection Through Imported Glucose Record Fields

Content
View full analysis
{timestamp} {value} {unit} {meal_context} {notes} """ ``` ### Technical Analysis Fields originating from a CSV or Excel file are converted to strings and persisted without validation or HTML output encoding. When an HTML report is generated, `meal_context`, `notes`, `unit`, and other record values are interpolated directly into the document. An attacker-controlled field can therefore contain active HTML, such as: ```html ``` When the generated report is opened in a browser, the browser interprets the value as markup rather than text. This is a stored injection because the payload is first persisted in the glucose data file and subsequently rendered by the report exporter. Although the generated report is normally a local file, active content can still manipulate the report, present deceptive medical information, initiate network requests, or execute JavaScript with the privileges and ...[truncated 1248 chars]
Remediation
View remediation
``` 5. Validate units and meal contexts against explicit allowlists. 6. Add regression tests containing characters such as `<`, `>`, `"`, `'`, and payload-like strings, and verify that they are rendered as visible text rather than markup. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/data_manager.py:241
Finding

Mixed Glucose Units Are Processed as mmol/L Without Normalization

Content
View full analysis
1 else 0, } # Calculate coefficient of variation if stats['mean'] > 0: stats['cv'] = (stats['std_dev'] / stats['mean']) * 100 else: stats['cv'] = 0 # Calculate time in ranges (assuming mmol/L) # Normal range: 4.0-7.0 mmol/L (fasting), 4.0-10.0 mmol/L (post-meal) # For simplicity, using 4.0-10.0 as general target range in_range = sum(1 for v in values if 4.0 <= v <= 10.0) below_range = sum(1 for v in values if v < 4.0) above_range = sum(1 for v in values if v > 10.0) ``` Recommendation analysis likewise consumes raw values: ```python recent_values = [r['value'] for r in readings[-20:]] ``` ### Technical Analysis The input and import interfaces support both `mmol/L` and `mg/dL`, but the central statistics, analysis, prediction, and recommendation paths do not convert mg/dL readings to mmol/L before applying mmol/L thresholds. The conversion relationship is approximately: ```text mmol/L = mg/dL / 18.018 ``` Consequently, a normal reading of `100 mg/dL` is processed as if it were `100 mmol/L`. Mixed-unit datasets also produce invalid averages, ranges, c ...[truncated 1599 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/data_manager.py:36
Finding

Sensitive Health Records Are Created Without Enforced Private File Permissions

Content
View full analysis
10: for old_backup in backups[:-10]: old_backup.unlink() ``` The health-data file is also opened with ambient process permissions: ```python with open(self.data_file, 'w', encoding='utf-8') as f: json.dump(data, f, indent=2, ensure_ascii=False) ``` The alternate data manager has the same behavior: ```python # Ensure directory exists self.data_path.parent.mkdir(parents=True, exist_ok=True) self._save_data(default_data) ``` ```python with open(self.data_path, 'w', encoding='utf-8') as f: json.dump(data, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The Skill stores glucose readings, notes, user profile information, exercise details, meal information, and medication information in plaintext JSON. Neither data-manager implementation explicitly restricts directory or file permissions. The resulting access mode depends on the process umask and any pre-existing directory permissions. Under a co ...[truncated 1482 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (44)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

该代码与“健康建议”这一部分声明是吻合的,也确实围绕血糖数据工作;但声明中的多个核心能力没有在代码中体现。代码主要功能是读取已有血糖数据并生成饮食、运动、用药、就医和综合建议,外加对近期数据做简单统计分析以判断是否建议就医。它并不实现血糖数据管理中的关键操作,如手动记录或文件导入,也没有任何趋势预测逻辑。因此,实际代码的主要能力范围与声明存在实质性偏差。另一个次要偏差是代码提供了用药建议和就医建议,这超出了描述中明确列出的能力。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

声明覆盖的是较完整的血糖管理能力集,而该代码块只实现了其中的分析/报表部分。它会读取既有血糖数据并生成统计、模式分析和可视化,这与“血糖趋势”相关,但没有看到数据录入、导入外部文件或提供健康建议的逻辑。另一个关键差异是“趋势预测”表述偏强,而代码中的 trend analysis 仅比较前后两段平均值来判断 increasing/decreasing/stable,更接近历史趋势分析而非预测未来血糖。因此描述与该代码块的实际行为存在实质性不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个较完整的血糖管理技能,包含数据记录、导入、预测和建议等高层功能;但实际代码只包含两个单位换算函数和一个命令行入口,用于在 mmol/L 与 mg/dL 之间转换血糖数值。代码没有任何数据存储、文件读取、趋势分析、预测模型、建议生成或个人健康管理逻辑。因此,实际行为与声明用途存在显著不一致,且主要目的 materially different。未发现额外越权资源访问,但核心能力与描述不符,应判定为 mismatch。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

代码与“管理个人血糖数据、手动记录”这一核心用途基本一致,并且确实处理血糖记录的增删改查及统计分析。但声明中的几个关键能力并未在该代码片段中体现:没有文件导入接口或解析逻辑,没有趋势预测能力,也没有健康/饮食/运动建议生成功能。代码还额外实现了本地备份,不过这属于支持性实现细节,不构成问题。由于声明包含多个面向用户的重要功能,而代码实际只覆盖数据管理和基础统计,因此应判定为描述与实际行为存在不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

该代码的核心行为是“导出血糖分析报告”,而不是执行手动记录、文件导入、趋势预测或提供饮食/运动健康建议。虽然它确实处理血糖数据,属于同一领域,但描述未提及报告导出这一实际能力;相反,描述强调的若干能力在此代码片段中并未出现。代码也未显示任何越权访问或无关资源使用,主要不匹配点在于功能描述与实际实现的主功能不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

该描述与代码部分匹配:都聚焦于血糖数据分析和预测,也包含趋势分析与风险评估相关功能。但存在多处实质性不一致。首先,声明强调“管理个人血糖数据,支持手动记录、文件导入”,而代码完全是只读分析器,只从固定本地路径读取 JSON 数据,没有写入、编辑、导入流程。其次,声明提到“健康建议”以及适用于饮食/运动建议场景,但代码没有输出个性化饮食或运动建议,仅返回风险等级、统计结果和估算值。再次,代码还实现了声明中未提到的 HbA1c 估算和餐后血糖峰值预测。综合来看,虽然核心领域一致,但描述对可用能力有明显夸大,且遗漏了部分实际分析能力,因此应判定为描述与行为不完全一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

描述与代码部分匹配:代码确实管理个人血糖数据,并支持手动记录和文件导入。 但存在实质性不一致。首先,声明强调“血糖趋势预测”和“健康建议(含饮食/运动建议)”,而代码仅提供数据 CRUD、导入导出和简单统计,没有任何预测逻辑或建议生成机制。其次,代码还实现了删除记录和导出数据,这属于未声明但实际存在的能力。综合来看,描述高估了分析/建议能力,同时遗漏了部分实际数据管理功能,因此应判定为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
82% confidence
Finding

代码行为与声明部分一致:它确实处理血糖相关数据、进行趋势预测,并给出一定健康建议/风险提示。但声明描述的是一个更完整的血糖数据管理技能,包含手动记录和文件导入等能力;当前提供的代码片段只实现了预测与风险评估,并通过 GlucoseDataManager 读取已有数据,没有看到数据录入、导入或广义“管理”功能。若将整个技能描述理解为完整技能,则此片段更像其中一个子模块,描述对该代码片段来说偏宽泛且不完全准确,因此可判定为轻度不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个较完整的血糖管理技能,包含手动记录、文件导入、趋势预测和健康建议等多项能力。但给定代码片段只执行手动录入血糖数据,并调用数据管理器保存后展示最近读数的简单统计信息。代码中没有文件导入逻辑、没有预测模型或趋势分析实现,也没有生成饮食/运动等健康建议。因此,实际行为仅覆盖声明中的一部分,描述对当前代码能力有明显夸大,构成不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
86% confidence
Finding

声明描述的是一个较完整的血糖管理技能,涵盖记录、导入、预测和健康建议。实际代码仅是 validate_data.py,其核心功能是对已有血糖数据进行校验,而不是进行趋势预测、生成饮食/运动建议,或实现用户交互式记录与导入。虽然数据校验可以视为血糖数据管理的辅助功能,但它并未在声明中明确体现,且与声明强调的主要能力相比存在明显落差。因此,该代码片段与声明用途并不准确对应,属于描述与实际行为不完全一致的情况。

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · assets/report_template.html (reported line 183)May include surrounding context.

html
</div>
        
        <div class="content">
            <!-- 数据概览 -->
            <div class="section">
                <h2>📊 数据概览</h2>
                <div class="stats-grid">

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · assets/report_template.html (reported line 211)May include surrounding context.

html
<h2>📈 血糖趋势</h2>
                <div class="chart-container">
                    <div class="chart-placeholder">
                        <!-- 这里将插入血糖趋势图 -->
                        <p style="color: #999;">{{chart_placeholder}}</p>
                    </div>
                </div>

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This section gives actionable acute-care medical instructions for hypo- and hyperglycemia, including glucagon injection, IV glucose, ketone testing, exercise restrictions, and when to adjust food intake, but it does so without a clear warning that emergency management and medication-related actions require clinician guidance. In a consumer-facing blood glucose management skill, users may self-treat or delay professional care based on generic text that may not fit their diagnosis, medications, comorbidities, age, pregnancy status, or current symptoms.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file recommends insulin-to-carbohydrate ratios and discusses changing pre-breakfast, bedtime, and other medication doses to manage dawn phenomenon, Somogyi effect, postprandial hyperglycemia, and fasting hyperglycemia, without an explicit warning that dosing is highly individualized and can be dangerous. Incorrect self-adjustment can cause severe hypoglycemia, persistent hyperglycemia, ketoacidosis, or other serious harm, especially because the skill is specifically framed as a management assistant.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
92% confidence
Finding

Most commands emit concrete diet, exercise, and medical guidance, including threshold-based recommendations and warnings, but only the medication path includes a disclaimer. In a health-management skill, omission of prominent non-professional-advice warnings can cause users to over-trust automated output and act on potentially inappropriate advice, creating real safety risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This script performs predictive glucose estimation, post-meal peak prediction, and risk classification that can influence health decisions, but it does not consistently present a clear user-facing disclaimer that outputs are approximate, not medical advice, and not suitable for urgent treatment decisions. In a diabetes-management context, users may over-trust these outputs and delay care, change medication, or ignore dangerous symptoms based on simplistic heuristics.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

This file generates blood glucose forecasts, risk labels, and behavior recommendations such as eating carbohydrates, exercising, or adjusting diet, but it does not consistently present a clear user-facing warning that the model is simplified and not a substitute for clinical judgment. In a diabetes-management context, users may over-trust these outputs and delay appropriate treatment or make unsafe self-management decisions based on inaccurate predictions.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill describes file read/write behavior against local health data but does not declare any explicit tool scope or permissions boundary. That creates an authorization and transparency gap: an agent may gain implicit access to sensitive local files without the user seeing a narrow allowlist, which is especially risky for medical data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger description is broad enough to activate on common phrases about blood sugar, diet, or exercise, which may cause the skill to run outside intended scenarios. In a medical-data skill, over-triggering is dangerous because it can prompt unnecessary health guidance or local data operations when the user did not intend to invoke this capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill describes writing local health data and importing files without any explicit confirmation, preview, or warning flow. Because the data is sensitive medical information, silent writes/imports can lead to privacy loss, accidental corruption, or processing of the wrong file based on ambiguous user input.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document says the skill is only for information tracking, yet elsewhere it describes identifying medication-adjustment patterns and giving treatment-related guidance. In a health context, that contradiction can cause unsafe user reliance on quasi-medical recommendations while reducing perceived need for clinician review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The HTML document explicitly sets the page language to zh-CN, and the visible report content is entirely in Chinese. Under the policy criteria, forcing a specific language/locale without user opt-in is a natural-language policy violation unless the locale restriction is clearly justified, which is not shown in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This file is a markdown document, so natural-language policy checks apply. The content consistently forces a specific language/locale for all instructions and examples, and there is no opt-in, alternative language option, or stated region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The content is written entirely in Chinese, which effectively forces a language choice for users who may not have opted into that locale. Under the language/locale policy, this should either provide an explicit language option or clearly document that the skill is intended for a Chinese-language audience.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The referenced section provides a formula for calculating pre-meal insulin dose, which is a treatment action with direct patient safety consequences, but it lacks an immediate warning that dosing must be individualized and clinician-verified. In a consumer-facing glucose-management skill, users may over-trust the formula and self-adjust insulin incorrectly, creating risk of severe hypoglycemia or uncontrolled hyperglycemia.

Content

No source excerpt is available for this finding.