Back to skill

Security audit

Health Manager

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real health-tracking CLI, but it needs review because it stores, imports, and exports sensitive medical data with weak privacy and safety safeguards.

Install only if you are comfortable storing sensitive health information locally in an unencrypted SQLite database. Import only trusted CSV/JSON files, treat exports and reports as private medical records, avoid opening exported CSVs in spreadsheets without sanitizing them, and do not implement the documented cloud, wearable, OAuth, or simulated-login integrations without a separate privacy and security review.

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

Error
Location
src/utils/export.ts:103
Finding
SQL Identifier Injection Through Attacker-Controlled Import Headers<![CDATA[ ## Vulnerability Details **File Location**: `src/utils/export.ts:103-116` and `src/utils/export.ts:140-161` **Vulnerability Type**: SQL identifier injection **Risk Level**: High ### Vulnerable Code CSV import: ```typescript const headers = lines[0].split(',').map(h => h.trim()); let imported = 0; const placeholders = headers.map(() => '?').join(', '); const stmt = db.prepare(` INSERT INTO ${tableName} (${headers.join(', ')}) VALUES (${placeholders}) `); ``` JSON import: ```typescript const content = fs.readFileSync(jsonPath, 'utf-8'); const records = JSON.parse(content) as Record<string, any>[]; if (records.length === 0) { return 0; } const headers = Object.keys(records[0]).filter(h => h !== 'id'); const placeholders = headers.map(() => '?').join(', '); const stmt = db.prepare(` INSERT INTO ${tableName} (${headers.join(', ')}) VALUES (${placeholders}) `); ``` ### Technical Analysis Record values are passed through SQLite placeholders, but CSV header names and JSON property names are interpolated directly into the SQL statement. Parameterized queries do not protect SQL identifiers, so untrusted identifiers must be independently validated and quoted. The CLI restricts the table name to a fixed set, which prevents table-name injection. However, the columns remain fully controlled by the imported file. An attacker can introduce SQL syntax into a CSV header or JSON key to modify the structure of the prepared statement. The exact statements available to an attacker are constrained by SQLite grammar and by `better-sqlite3` preparing a single statement. Nevertheless, imported data is improperly allowed to influence executable SQL syntax. At minimum, malicious headers can cause persistent denial of import functionality; crafted syntax may alter the intended insertion behavior where a valid single SQLite statement can be formed. ### Attack Path 1. An attacker creates a CSV file with malicious column headers or a JSON file with malicious ...[truncated 1194 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Define a strict column allowlist for every importable table: ```typescript const ALLOWED_COLUMNS: Record<string, Set<string>> = { blood_pressure: new Set([ 'systolic', 'diastolic', 'heart_rate', 'recorded_at', 'notes' ]), exercise: new Set([ 'type', 'duration_minutes', 'steps', 'calories_burned', 'distance_km', 'recorded_at', 'notes' ]), medication: new Set([ 'name', 'dosage', 'unit', 'taken_at', 'notes' ]) }; ``` 2. Reject unknown, empty, malformed, and duplicate headers before constructing SQL. 3. Safely quote identifiers after allowlist validation by doubling embedded quotation marks and surrounding identifiers with double quotes. 4. Require every JSON record to use the same validated schema as the first record. 5. Validate the number of CSV values against the number of validated headers. 6. Validate imported value types and required fields before opening the transaction. 7. Add tests using headers containing parentheses, comments, quotes, commas, and SQL keywords. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
src/utils/export.ts:21
Finding
Spreadsheet Formula Injection in CSV Exports<![CDATA[ ## Vulnerability Details **File Location**: `src/utils/export.ts:21-35` **Vulnerability Type**: CSV/spreadsheet formula injection **Risk Level**: Medium ### Vulnerable Code ```typescript for (const record of records) { const values = headers.map(h => { const value = (record as Record<string, any>)[h]; if (value === null || value === undefined) return ''; // 处理包含逗号或引号的值 const str = String(value); if (str.includes(',') || str.includes('"') || str.includes('\n')) { return `"${str.replace(/"/g, '""')}"`; } return str; }); csvRows.push(values.join(',')); } ``` ### Technical Analysis The exporter performs ordinary CSV escaping for commas, quotation marks, and newlines, but it does not neutralize values that spreadsheet applications interpret as formulas. User-controlled fields include medication names, exercise types, notes, units, and configuration values. If a value begins with characters such as `=`, `+`, `-`, or `@`, spreadsheet applications may evaluate it as a formula when the exported CSV file is opened. Enclosing a value in CSV quotation marks does not reliably prevent formula evaluation. This issue does not execute code inside the Node.js application. Exploitation occurs later in the spreadsheet application used to open the exported file. ### Attack Path 1. An attacker causes a formula-like value to be stored in a user-controlled field, for example through an imported record or a value supplied to the CLI. 2. The user exports the affected table: ```bash health data export medication --format csv --output medication.csv ``` 3. The exporter writes the formula-like value without neutralizing it. 4. The user opens the CSV file in spreadsheet software. 5. The spreadsheet interprets the cell as a formula. 6. Depending on the spreadsheet and its security settings, the formula may initiate external requests, expose data through formula arguments, or present misleading content. ### Impact Assessmen ...[truncated 562 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Neutralize values whose first non-whitespace character is `=`, `+`, `-`, or `@`. 2. Prefix dangerous values with an apostrophe or another format-specific neutralization character before applying normal CSV escaping: ```typescript function neutralizeFormula(value: string): string { return /^[\t\r ]*[=+\-@]/.test(value) ? `'${value}` : value; } ``` 3. Apply formula neutralization to every string field, including imported values later re-exported. 4. Document that CSV exports are intended to contain literal text rather than executable formulas. 5. Add tests for leading whitespace, tabs, carriage returns, and each recognized formula prefix. 6. Where feasible, offer a non-executable export format such as JSON for transferring untrusted data. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
src/database/connection.ts:14
Finding
Sensitive Health Database Created Without Explicit Restrictive Permissions<![CDATA[ ## Vulnerability Details **File Location**: `src/database/connection.ts:14-30` **Vulnerability Type**: Insecure local storage permissions for sensitive medical data **Risk Level**: Medium ### Vulnerable Code ```typescript function initDataDir(): void { if (!fs.existsSync(DATA_DIR)) { fs.mkdirSync(DATA_DIR, { recursive: true }); } } /** * 获取数据库连接 */ export function getDatabase(): Database.Database { if (!db) { initDataDir(); db = new Database(DB_PATH); db.pragma('journal_mode = WAL'); initializeSchema(); } return db; } ``` ### Technical Analysis The database stores blood-pressure measurements, heart rate, medication use, exercise history, notes, and user configuration. The storage directory and database are created without explicit permission modes, so their effective permissions depend on the process umask and environment. The application also enables SQLite WAL mode. This may create `health.db-wal` and `health.db-shm` sidecar files whose permissions must be protected along with the primary database. On a normally configured single-user system with a restrictive umask, the resulting permissions may already be adequate. However, the application does not enforce or verify this requirement. In shared or permissively configured environments, sensitive health data may become readable by other local users. ### Attack Path 1. The application is run in an environment with a permissive umask or pre-existing permissive storage directory. 2. `~/.config/health-manager` and the SQLite database are created without explicit restrictive modes. 3. SQLite creates WAL or shared-memory sidecar files while processing records. 4. Another local account enumerates the directory and reads any group-readable or world-readable database files. 5. The local account extracts medical records and user configuration directly from SQLite. ### Impact Assessment A successful attacker requires local filesystem access under another account or pro ...[truncated 494 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create the data directory with owner-only permissions: ```typescript fs.mkdirSync(DATA_DIR, { recursive: true, mode: 0o700 }); ``` 2. Verify and correct the directory mode even when the directory already exists: ```typescript fs.chmodSync(DATA_DIR, 0o700); ``` 3. Create or reopen the database under a restrictive umask and enforce mode `0600` after creation: ```typescript fs.chmodSync(DB_PATH, 0o600); ``` 4. Verify the ownership and permissions of the database, `health.db-wal`, and `health.db-shm` files. 5. Refuse to operate, or display a prominent warning, if the database is owned by another account or accessible to unauthorized users. 6. Document the sensitivity of exported reports and backups, which should also be created with restrictive permissions. 7. Consider encryption at rest if the threat model includes offline disk access or compromise of backup media. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (61)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared description presents a full health data management skill with domain-specific tracking and reporting capabilities. The supplied code does not implement any health-related functionality. Instead, it only provides generic presentation helpers for rendering ASCII/Unicode tables and stat cards from arbitrary input data. While such utilities could support a larger health app's output formatting, this code chunk's actual purpose is purely display formatting, which is materially different from the declared primary purpose. Therefore, this is a clear description-behavior mismatch.

Context-Inappropriate Capability

High
Confidence
94% confidence
Finding
The design proposes vendor API integrations including 'simulated login and packet capture' for Xiaomi data access, which implies bypassing normal authentication flows and collecting protected health data through unsupported means. In a health-data skill, this is especially dangerous because it can expose credentials, violate platform security controls, and mishandle highly sensitive personal data.

Known Vulnerable Dependency: fast-uri==3.1.0 — 7 advisory(ies): CVE-2026-13676 (fast-uri vulnerable to host confusion via failed IDN canonicalization); CVE-2026-18446 (fast-uri vulnerable to host confusion via backslash authority introducer); CVE-2026-75975 (fast-uri vulnerable to server-side request forgery via malformed IPv6 normalizat) +4 more

High
Category
Supply Chain
Confidence
88% confidence
Finding
The lockfile includes fast-uri 3.1.0, which is flagged with multiple URI parsing/canonicalization advisories involving host confusion and possible SSRF bypasses. Although this file only shows dependency presence and not active exploitation, vulnerable URI parsers are dangerous when any code validates, normalizes, or restricts user-supplied URLs, and this risk is amplified by the package's healthcare context if reports, integrations, or external resources are ever fetched.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The README is entirely in Chinese and all examples, headings, and user-facing descriptions assume a Chinese-language experience. Under the stated policy, forcing a specific language without user opt-in or clear justification is a natural-language policy violation.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This markdown file describes recording, analyzing, exporting, and sharing personal health data, including generating reports to share with doctors. Because health data is highly sensitive, the skill description should explicitly warn users about privacy implications, local storage, and sharing/export risks, but no such warning appears in the README.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The integration section states that the tool supports Google Fit OAuth authentication and data synchronization, as well as wearable-device data import. For a markdown skill description, this is a behavior that can affect user privacy and transmit personal health data, yet the README does not include any warning or disclosure about external services accessing or receiving that data.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documentation promotes storage, analysis, import/export, and reporting of highly sensitive health data but provides no privacy, retention, encryption, access-control, or safe-handling guidance. In a health context, this omission increases the risk that users will store medical information insecurely, export it to unprotected files, or share reports without understanding the exposure risk.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The report-generation and export features can create portable files containing medical history, medication usage, and other health indicators, yet the documentation contains no warning about confidentiality risks. Because the skill context is specifically personal health management, accidental disclosure through markdown reports, CSV exports, backups, or shared directories is more dangerous than for ordinary non-sensitive data.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The guide instructs users to export, import, back up, restore, and share highly sensitive health data, but it provides no warning about privacy exposure, insecure storage locations, accidental disclosure, or overwrite risks during restore/import. In a health-management context, these omissions matter because users may place files in broadly accessible locations, share reports without understanding the sensitivity, or restore over existing data and lose records.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The deletion example shows direct removal of a health record without any mention of permanence, confirmation, or recovery options. Because the data concerns medical tracking, accidental deletion can impair trend analysis, medication history, or information shared with clinicians.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The Apple Health sync flow describes requesting authorization, fetching sensitive health data, and saving it, but it omits any user-facing privacy notice, scope disclosure, retention explanation, or confirmation before persistence. In a health-management skill, this is dangerous because users may not understand what categories of regulated health data are being imported and stored locally, increasing privacy, compliance, and consent risks if the behavior is implemented as documented.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The handbook generation flow converts health data into a PDF and saves it to a file, but does not indicate the destination path, whether an existing file may be overwritten, or whether the output contains sensitive medical information. Because the generated file is derived from highly sensitive health data, silent local writes can expose private information through insecure locations, accidental sharing, or unintended overwrite of existing files.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The design handles collection, storage, analysis, and potential sharing of sensitive health data without an explicit user-facing warning in the skill description about these privacy-impacting behaviors. In a health-management context, this omission is significant because users may provide medical and behavioral data without understanding retention, analysis, third-party integrations, or disclosure surfaces.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
Export, notification, and sharing features can move sensitive health data outside the local system boundary, yet the design does not pair them with a clear warning about privacy impact. For medical data, notifications may leak contents on lock screens, exported files may be stored insecurely, and shared outputs may be redistributed beyond user control.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
The proposed community sharing capability expands a local health-management tool into social data disclosure, creating a real risk of unintended exposure of highly sensitive medical information. In the context of a health skill, this is more dangerous than ordinary feature creep because even partial sharing of reports, trends, or identifiers can reveal protected health data and create compliance issues.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The checklist explicitly includes collecting, analyzing, and generating personalized guidance from sensitive health data, but the design does not pair these user-facing capabilities with clear privacy warnings, consent language, or medical-risk disclaimers at the point of use. In a health-management skill, omission of such safeguards can mislead users into treating generated suggestions as medical advice and can increase privacy harm when highly sensitive data is processed without explicit notice.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The document describes collection, storage, analysis, and export of highly sensitive health data, including Apple Health imports, medication records, reports, and handbook generation, but provides no privacy notice, consent requirements, retention guidance, access controls, or handling safeguards. In a health-management context, this omission materially increases the risk of unsafe deployment, accidental overcollection, insecure export of medical data, and regulatory/privacy violations.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
The manifest describes recording health metrics, tracking exercise, managing medications, and generating reports, but this section recommends invoking Python via child_process. Spawning subprocesses is a materially broader capability than ordinary data management and analysis, and the manifest does not indicate any need for local code execution outside the Node.js process.

Missing User Warnings

Medium
Confidence
84% confidence
Finding
The design suggests online charting and other external processing options without clearly warning that report content may leave the local environment. For health data, even derived visualizations or PDFs can contain sensitive information, so external rendering services introduce meaningful privacy risk if users or implementers are not alerted.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
The manifest focuses on managing health data, exercise, medication, reports, and goals, but does not mention direct hardware discovery or Bluetooth access. Implementing BLE scanning/connection adds a device-control capability that is not obviously required for a health data manager as described.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The document presents network-based vendor integrations for health data without accompanying warnings about data transmission, third-party exposure, credential handling, or consent. In a health-management context, omission of these privacy implications can lead to unsafe implementation choices and user data being shared beyond reasonable expectations.

Description-Behavior Mismatch

Medium
Confidence
88% confidence
Finding
The design introduces cloud deployment, remote storage, S3/MinIO, cloud analytics, and hybrid off-device processing for health data without clearly constraining what data leaves the local device or obtaining explicit consent. Because this skill handles sensitive medical and wellness information, undeclared remote processing materially increases confidentiality, compliance, and breach risk.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This code file contains user-facing natural-language output entirely in Chinese, starting with the top-level CLI description and continuing throughout commands. The skill does not offer an opt-in language selection or document that it is intentionally limited to a Chinese-speaking or region-specific context, which creates a locale policy concern.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This code performs a permanent DELETE operation on health-related user data, but the function contains no confirmation prompt, logging, or explanatory warning comment beyond its basic name. For code files, destructive or irreversible operations should have some visible disclosure unless clearly covered elsewhere, and no such disclosure is present in this file.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The function initializes and persists personal user attributes such as name, age, height, and weight by calling batchUpdateConfig, which updates the database. In this file there is no user-facing warning, confirmation prompt, or disclosure indicating that this personal data will be stored.

Static analysis

No suspicious patterns detected.