Back to skill

Security audit

unisound-med-treat

Security checks for vulnerabilities and agentic risk

Overview

This medical-answering skill is mostly purpose-aligned, but it can send sensitive medical prompts and the provided API key to any user-configured endpoint and can log or save raw patient-like input.

Install only in a controlled workflow. Do not use real patient identifiers unless the destination service, logs, and output path are approved for that data. Avoid --api-url overrides unless the endpoint is trusted and HTTPS, and use a dedicated least-privileged API key.

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:77
Finding
Caller-Controlled API Endpoint Can Exfiltrate Credentials and Medical Prompt Data## Vulnerability Details **File Location**: `scripts/run.py`, lines 77–92; endpoint control is exposed at line 208 **Vulnerability Type**: Unrestricted transmission of credentials and sensitive data to a caller-controlled endpoint **Risk Level**: Medium ### Vulnerable Code ```python try: req = Request( api_url, data=json.dumps(payload, ensure_ascii=False).encode("utf-8"), headers={ "Content-Type": "application/json", "Authorization": f"Bearer {appkey}", }, ) resp = urlopen(req, timeout=timeout) body = json.loads(resp.read().decode("utf-8")) except HTTPError as exc: detail = exc.read().decode("utf-8", errors="replace")[:2000] raise RuntimeError(f"API HTTP {exc.code}: {detail}") from exc ``` The destination is directly configurable through the command line: ```python p.add_argument("--api-url", default=DEFAULT_API_URL, help="OpenAI compatible API endpoint") ``` The selected endpoint, credential, and medical prompt are then passed to the request function: ```python out["answer"] = call_llm( api_url=args.api_url, model=args.model, appkey=args.appkey, system_prompt=args.system_prompt, user_prompt=user_prompt, temperature=float(args.temperature), timeout=int(args.timeout), ) ``` ### Technical Analysis The `--api-url` argument is accepted without validating its scheme, hostname, port, or trust relationship. `call_llm()` sends the supplied application key in an `Authorization: Bearer` header and includes the complete user question in the HTTP request body. Consequently, an untrusted wrapper, automation configuration, or command invocation can redirect both values to an attacker-controlled server. The implementation also accepts plaintext `http://` destinations, which can expose the authorization header and medical prompt to network interception. Redirect behavior is not explicit ...[truncated 1870 chars]
Remediation
## Remediation Suggestions 1. Remove runtime endpoint override support unless it is operationally necessary. 2. If custom endpoints are required, parse the URL and enforce: - The `https` scheme. - An explicit allowlist of trusted hostnames. - Expected ports only. - Rejection of embedded credentials, fragments, and malformed hosts. 3. Prevent authorization headers from being forwarded when a redirect changes the scheme, hostname, or port. Prefer disabling redirects or validating every redirect target against the same allowlist. 4. Use separate, least-privileged credentials for each approved service rather than forwarding one key to arbitrary destinations. 5. Require an explicit administrative configuration or clearly marked unsafe mode before allowing a non-default endpoint; do not permit ordinary question input to control it. 6. Validate that TLS certificate verification remains enabled and reject plaintext HTTP endpoints. 7. Continue requiring patient data to be de-identified, and add clear runtime or deployment safeguards preventing sensitive records from being sent to unapproved services. 8. Add automated tests confirming that HTTP URLs, unapproved hosts, deceptive subdomains, alternate ports, and cross-origin redirects are rejected before any credential-bearing request is sent.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill advertises no explicit tool/permission scope, yet its documented behavior and detected capabilities include file read, file write, and outbound network access to a model API. In an agent environment, missing least-privilege declarations can let the skill be invoked with broader access than users or orchestrators expect, increasing the chance of unintended data exposure, especially since the skill may process sensitive medical content.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The manifest description and the entire user-facing documentation specify the skill exclusively in Chinese and describe the capability as generating medical-treatment answers, with no indication that users may choose another language or locale. Under the policy rule, forcing a specific language without opt-in is a natural-language policy violation unless the locale restriction is clearly justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The module-level description and surrounding user-facing strings are entirely in Chinese, indicating a fixed language/locale expectation. The file does not offer an opt-in language choice or document that this is a region-specific tool with a justified locale restriction.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The built-in system prompt is written only in Chinese and establishes the model behavior in that language by default. There is no corresponding language-selection mechanism or stated justification for a mandatory Chinese-only locale.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill sends user-supplied medical question content to a remote API endpoint, and the question may contain protected health information or other sensitive clinical details. In a medical-treatment skill, this is particularly risky because users may reasonably expect local or controlled processing unless disclosure to a third-party service is made explicit.

Ssd 3

Medium
Confidence
95% confidence
Finding
The skill copies raw user question content into its output object and then emits that data to stdout and optional files, which can leak sensitive patient details into terminal history, logs, orchestration pipelines, and downstream systems. Because this skill is explicitly for medical diagnosis/treatment planning, the likelihood that supplied text contains highly sensitive health information is elevated.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The program writes structured outputs containing the original question, metadata, and model answer to stdout and optionally to disk, which can persist sensitive medical details in logs, shells, CI artifacts, or shared filesystems. In this medical context, that persistence materially increases confidentiality risk because diagnostic questions often embed patient-specific information.

Static analysis

No suspicious patterns detected.