Back to skill

Security audit

Health Data Analyzer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent health-data analyzer, but it requests broad sensitive health and profile-data access without clear consent, minimization, or output safeguards.

Review this before installing if the healthdata MCP server contains real personal data. Use it only where you trust the local environment and the MCP server, limit queries to the minimum tables and date ranges needed, avoid user_info or complete-profile queries unless explicitly necessary, and do not run the status script with elevated privileges until the fixed temp file and automatic chmod behavior are corrected.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check_status.sh:50
Finding

Predictable Temporary File Allows Symlink-Based File Clobbering

Content
View full analysis

Vulnerability Details

File Location: scripts/check_status.sh, lines 50-59
Vulnerability Type: Predictable and insecure temporary-file handling
Risk Level: Medium

Vulnerable Code

bash
if mcporter call healthdata.list_available_tables > /tmp/health_test.json 2>/dev/null; then
    echo "✅ 基础查询功能正常"
    
    # 显示前3个表名
    if command -v jq &> /dev/null; then
        echo "前3个数据表:"
        jq -r '.[0:3][].name' /tmp/health_test.json 2>/dev/null | sed 's/^/  - /'
    fi
    
    rm -f /tmp/health_test.json

Technical Analysis

The script redirects command output to the fixed, globally predictable path /tmp/health_test.json. It neither creates the file atomically with restrictive permissions nor verifies that the path is not a symbolic link.

On systems where /tmp is writable by other local users, an attacker can create that path as a symbolic link before the script runs. Shell redirection follows the link and truncates or overwrites its target with the output of mcporter. The later rm -f removes the symbolic link itself and does not restore the overwritten target.

The temporary MCP response may also be readable by other local users if the invoking process has a permissive umask.

Attack Path

  1. A local attacker identifies a file that the victim can overwrite.
  2. The attacker creates a symbolic link at the predictable path:
    bash
    ln -s /path/to/victim-writable-target /tmp/health_test.json
    
  3. The victim runs scripts/check_status.sh.
  4. The shell follows the symbolic link while processing the output redirection.
  5. The target is truncated and then populated with the output of healthdata.list_available_tables.
  6. The script removes /tmp/health_test.json, deleting the link but leaving the target corrupted.

This attack requires local access sufficient to create entries in /tmp. Its effective privileges are those of the user running the script.

Impact Assessment

An attacker can cause arbitrary fi ...[truncated 697 chars]

Remediation
View remediation

Remediation Suggestions

Create the temporary file atomically with mktemp, store its path in a quoted variable, and register cleanup with a trap:

bash
tmp_file=$(mktemp "${TMPDIR:-/tmp}/health_test.XXXXXX") || {
    echo "Failed to create a secure temporary file" >&2
    exit 1
}
trap 'rm -f -- "$tmp_file"' EXIT HUP INT TERM

if mcporter call healthdata.list_available_tables > "$tmp_file" 2>/dev/null; then
    echo "Basic query succeeded"

    if command -v jq &> /dev/null; then
        jq -r '.[0:3][].name' "$tmp_file" 2>/dev/null | sed 's/^/  - /'
    fi
else
    echo "Basic query failed"
fi

Additional hardening measures:

  1. Set a restrictive umask, such as umask 077, before writing potentially sensitive MCP output.
  2. Never run the status-check script with elevated privileges unless strictly necessary.
  3. Keep all temporary-path variables quoted and use -- before filename arguments.
  4. Prefer processing the MCP output through a pipeline without writing it to disk when practical.
  5. Ensure cleanup occurs on normal exit and interruption by retaining the trap.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (17)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个面向用户的健康数据查询与分析技能,核心能力应是读取健康数据并进行分析解读。但代码片段实际是运维/诊断性质的检查脚本,重点在验证 mcporter 是否安装、MCP 服务是否可连通、基础 API 是否可调用、Python 是否存在,以及本地脚本是否存在并可执行。虽然它确实涉及 healthdata MCP 服务器,属于该技能的支持性基础设施,但该代码本身并未执行任何实质性的健康数据分析,也没有体现声明中的睡眠质量、运动表现、恢复状态、HRV、血氧等分析能力。此外,脚本还会修改文件执行权限,这属于未声明的附带能力。因此,描述与该代码片段的实际行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/check_status.sh (reported line 64)May include surrounding context.

sh
jq -r '.[0:3][].name' /tmp/health_test.json 2>/dev/null | sed 's/^/  - /'
    fi
    
    rm -f /tmp/health_test.json
else
    echo "❌ 基础查询功能异常"
fi

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill instructs use of shell-capable commands (mcporter call ...) but declares no explicit tool scope or permissions. In a health-data context, undeclared shell access increases the risk of overbroad command execution, accidental access beyond the intended MCP interface, and weak reviewability of what the skill is allowed to do.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill is designed to access complete health data, which is highly sensitive personal information, yet the instructions contain no privacy notice, consent boundary, or data-minimization guidance. This can lead to unnecessary collection or exposure of medical-adjacent data and increases compliance and confidentiality risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document provides numerous concrete health-data query patterns over sensitive categories such as sleep, recovery, HRV, blood oxygen, and workouts, but gives no warning to confirm user authorization, minimize requested scope, or avoid exposing personal health information in outputs. In a health-analysis context, omission of these safeguards can normalize broad retrieval of protected or highly sensitive data and increase privacy and compliance risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The reference workflow expands from health-metric analysis into querying users and user_data_sources, which are likely to contain identifying metadata and account linkage details not necessary for most sleep, exercise, or recovery analysis. In a health-data skill, that scope creep increases the chance of unnecessary collection or exposure of sensitive personal information and widens the blast radius if the skill is misused or over-privileged.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's natural-language comments and console output are consistently written in Chinese, with no option to select another language or locale. Per the policy, hard-coding a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Manifest 将该技能描述为通过 mcporter 访问 healthdata 服务器进行健康数据查询和分析,但此脚本在发现权限不足时会主动执行 chmod 修改本地文件权限。这不是健康数据查询/分析的直接组成部分,而是对本地环境进行变更的运维行为。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This shell script is primarily presented as a status check, but at L79-L80 it performs a filesystem modification by running chmod +x on health_analyzer.py. Although it prints a message immediately before doing so, there is no broader disclosure that this 'check' script may alter files, which makes the modifying behavior easy for users to miss.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/health_analyzer.py (reported line 22)May include surrounding context.

python
def run_mcporter_command(self, command: str) -> Dict[str, Any]:
        """执行 mcporter 命令并返回结果"""
        try:
            result = subprocess.run(
                command.split(),
                capture_output=True,
                text=True,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill includes a get_user_info capability that retrieves users and user_data_sources, which goes beyond the manifest's stated purpose of analyzing sleep, exercise, recovery, and related health metrics. In a health-data context, collecting or exposing profile/data-source metadata expands access to sensitive personal information without a clear need-to-know basis, increasing privacy and overcollection risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script queries highly sensitive health data and prints raw results directly to stdout, including user-related information and detailed health metrics, without any user-facing warning, consent check, redaction, or minimization. In a health-data skill, this is dangerous because it can expose protected personal data in logs, terminals, calling systems, or downstream agents that were not meant to receive full medical or wellness records.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The natural-language description and headings are entirely in Chinese and do not indicate that language is optional or region-specific. Per the policy, forcing a specific language without user opt-in can be a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

该 markdown 文档标题及全文内容均以中文编写,未说明这是面向特定中文受众的区域性文档,也未提供其他语言选项。按照语言/locale 政策,若技能或文档强制特定语言而无用户选择或合理限定,可构成自然语言策略违规。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

All headings, instructions, and usage examples in the file are presented exclusively in Chinese, with no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-language audience. This can violate the language/locale policy when a specific language is effectively forced without opt-in or justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

L71-L72 将该部分表述为“检查技能脚本”,但在 L79-L80 中脚本并非只检查,而是在缺少执行权限时直接修复并修改文件元数据。该说明给人的意图是只读检查,与实际存在副作用的行为不一致。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

User-facing strings, usage text, and documentation in the file are exclusively in Chinese, with no option to select another language or indication that the tool is intentionally region-specific. This creates a natural-language policy concern because the skill effectively forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.