Back to skill

Security audit

unisound-med-insurance-fee

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but it sends potentially sensitive medical insurance questions and a bearer key to a configurable external API endpoint.

Review before installing. Use only with de-identified data unless your organization has approved the external API processing. Do not pass production secrets on the command line, restrict usage to vetted HTTPS endpoints, and rotate any key that may have been sent to an untrusted endpoint.

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

Error
Location
scripts/run.py:96
Finding

Bearer Credential and Medical Data Exposure Through Unrestricted API Endpoint Configuration

Content
View full analysis

Vulnerability Details

File Location: scripts/run.py:96-110, scripts/run.py:221-222, scripts/run.py:277-285; supporting documentation at SKILL.md:45-46,55
Vulnerability Type: Credential exposure and transmission of sensitive data to an unrestricted endpoint
Risk Level: High

Vulnerable Code

scripts/run.py:96-110:

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

scripts/run.py:221-222:

python
p.add_argument("--appkey", default="", help="内部医疗大模型鉴权 key。")
p.add_argument("--api-url", default=DEFAULT_API_URL, help="OpenAI 兼容接口地址")

scripts/run.py:277-285:

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),
)

SKILL.md:45-46:

bash
# 指定任务类型与题干
python3 scripts/run.py --task insure-calc --question "题干……" --appkey YOUR_KEY

SKILL.md:55:

markdown
- `--appkey STRING`:**必填**(`--dry-run` 时除外)。内部医疗大模型鉴权 key。

Technical Analysis

The application accepts the authentication key directly through the --appkey command-line argument. Command-line secrets can be retained in shell history and may be visible in process inspection, execution logs, monitoring systems, job definitions, or diagnostic output available to other local users and administrato ...[truncated 2637 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove command-line secret handling

    • Read the credential from a protected environment variable, operating-system credential store, or secrets manager.
    • If file-based credentials are supported, require restrictive file permissions and avoid printing the file contents.
    • Update SKILL.md so examples do not encourage placing credentials in shell history.
  2. Restrict API destinations

    • Permit only HTTPS URLs.
    • Validate the parsed URL before constructing the request.
    • Maintain an explicit allowlist of trusted API hostnames and, where practical, approved ports and paths.
    • Reject embedded URL credentials, malformed hostnames, IP literals when unnecessary, and unapproved destination ports.
    • Do not send production credentials to arbitrary custom endpoints. If custom endpoints are required, require separate endpoint-specific credentials.
  3. Harden redirect behavior

    • Reject redirects or validate every redirect destination against the same HTTPS and trusted-host policy.
    • Ensure authorization headers are never forwarded to a different origin.
  4. Protect sensitive medical data

    • Require or enforce de-identification before transmission.
    • Minimize request payloads to the information required by the model.
    • Document the external processing boundary and obtain appropriate organizational approval for transmitting medical or insurance data.
  5. Limit credential impact

    • Use narrowly scoped, short-lived credentials.
    • Rotate any keys previously supplied through command-line arguments or sent to untrusted endpoints.
    • Add usage monitoring, rate limits, and alerts for unusual destinations or API consumption.
  6. Add validation tests

    • Verify that HTTP URLs, unapproved hosts, cross-origin redirects, and URLs containing credentials are rejected.
    • Verify that secrets are not present in process arguments, application logs, ...[truncated 40 chars]
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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises only high-level behavior in SKILL.md but does not declare any tool scope or permissions despite documented capabilities that imply file access, file output, stdin handling, and outbound network calls to an external API. This creates a trust and containment gap: deployers may authorize or run the skill without clear visibility into its effective access, increasing the chance of unintended data exposure or over-privileged execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The usage section instructs operators to send medical questions and potentially claim-record content to a remote model endpoint, but the main invocation examples do not prominently warn that sensitive medical data may be transmitted off-host. In a healthcare/insurance context, this is especially risky because users may include PHI/PII or claim details, leading to privacy, compliance, and contractual violations if sent externally without informed handling.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code is presented as a standalone deployable compliance/audit skill, but it transmits the full question content to a remote API endpoint using bearer-token authentication. In a medical insurance review context, prompts may contain sensitive health, billing, and identity-linked data, so undisclosed off-box transmission materially changes the trust boundary and creates confidentiality, compliance, and data-governance risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The base system prompt is written to enforce behavior in Chinese and positions the model as a medical assistant without any visible option for user-selected language or locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Allowing an arbitrary --api-url lets the caller redirect sensitive medical/insurance prompt data and the bearer appkey to any endpoint, not just the intended service. In practice this enables easy exfiltration to attacker-controlled infrastructure or use against insecure internal endpoints, which is broader capability than necessary for this skill’s stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The tool sends user-supplied question content to a remote LLM without any explicit user-facing warning, consent step, or privacy notice at the point of transmission. Because the content may include protected medical and claims data, silent network export increases the risk of privacy violations, regulatory noncompliance, and accidental disclosure to operators who assume processing is local.

Content

No source excerpt is available for this finding.