Back to skill

Security audit

unisound-med-health-consult

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent medical Q&A tool, but it can send sensitive health questions and a bearer API key to any configured API endpoint without strong guardrails.

Review this carefully before installing for real patient or regulated health data. Use only de-identified questions, avoid passing secrets through shell history when possible, and do not set --api-url to an untrusted or plaintext endpoint because it will receive both the prompt and bearer credential.

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/run.py:99
Finding
Unrestricted API Endpoint Can Receive Bearer Credentials and Sensitive Medical Data<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run.py:99-104`, `scripts/run.py:229`, `scripts/run.py:233`, and `scripts/run.py:284-291` **Vulnerability Type**: Unrestricted transmission of credentials and sensitive input to a user-controlled endpoint **Risk Level**: Medium ### Vulnerable Code ```python req = Request( api_url, data=json.dumps(payload, ensure_ascii=False).encode("utf-8"), headers={ "Content-Type": "application/json", "Authorization": f"Bearer {appkey}", }, ) ``` ```python p.add_argument("--appkey", default="", help="内部医疗大模型鉴权 key。") p.add_argument("--api-url", default=DEFAULT_API_URL, help="OpenAI 兼容接口地址") ``` ```python out["answer"] = call_llm( api_url=args.api_url, model=args.model, appkey=args.appkey, system_prompt=system_prompt_for(task_key, args.system_prompt), user_prompt=user_prompt, temperature=float(args.temperature), timeout=int(args.timeout), ) ``` ### Technical Analysis The script permits callers to supply an arbitrary destination through `--api-url`. It then sends an HTTP request to that destination containing: - The complete medical question in the request body. - The selected system prompt and model settings. - The supplied API credential in the `Authorization: Bearer` header. No validation requires HTTPS, restricts the destination hostname to the intended provider, or prevents a provider credential from being forwarded to a custom endpoint. Consequently, a malicious command, wrapper script, or unsafe integration configuration can redirect both the API credential and potentially sensitive medical content to an attacker-controlled server. Accepting the credential through `--appkey` also increases incidental exposure risk because command-line arguments may be retained in shell history or visible to local process-inspection mechanisms. ### Attack Path 1. An attacker supplies or recommends a modified invocation, integration configuration, or wrapper ...[truncated 1342 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Restrict endpoint destinations by default** - Parse the URL with `urllib.parse.urlparse`. - Require the `https` scheme. - Allow only explicitly approved hostnames, such as the default provider hostname. - Reject embedded credentials, unexpected ports, malformed hosts, and non-HTTP schemes. 2. **Separate credentials by provider** - Do not forward the default provider credential when a custom endpoint is selected. - If custom endpoints are required, require a separately named credential and an explicit opt-in flag. - Display a clear warning that prompts and credentials will be transmitted to a non-default service. 3. **Avoid command-line secret exposure** - Read the API key from a protected environment variable, secret manager, or secure standard-input mechanism. - Retain `--appkey` only if required for compatibility, mark it as discouraged, and document the shell-history and process-list risks. 4. **Minimize sensitive-data transmission** - Require callers to de-identify medical content before transmission. - Avoid logging credentials and minimize retention of questions and responses. - Clearly identify the destination before sending patient-related content. 5. **Fail securely** - Reject plaintext HTTP endpoints. - Abort when the endpoint is outside the approved allowlist unless a deliberate administrative override is enabled. - Add tests confirming that disallowed schemes and hosts cannot receive an authorization header. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill declares no explicit tool scope or permissions even though its documented behavior and associated code capabilities include file read, file write, and network access. In a medical-consultation context, unrestricted file and network access increases the risk of unintended exposure of sensitive health data, misuse of credentials, or execution outside the intended task boundaries.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The natural-language content of the skill forces a single language/locale experience for users, and the document does not indicate that this is optional or limited to a Chinese-language deployment context. Under the policy, language constraints should be opt-in or explicitly justified when region-specific.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The base system prompt is written to direct the model entirely in Chinese, and the surrounding interface/help text is also Chinese-only. There is no opt-in, language selection mechanism, or documented justification that this skill is restricted to a Chinese-speaking or region-specific context.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script sends user-supplied medical questions directly to a remote API endpoint using an authorization key, but its CLI interface does not clearly warn that potentially sensitive health data will leave the local environment. In a medical-consultation skill, this is especially risky because prompts may contain personal health information, symptoms, medications, or test results, creating privacy, compliance, and data-handling exposure if users assume processing is local.

Static analysis

No suspicious patterns detected.