Back to skill

Security audit

Discharge Summary Writer

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent discharge-summary purpose, but it can overwrite arbitrary writable files and can let untrusted patient text alter the generated clinical document.

Install only if you will run it in a sandbox or dedicated workspace, review every generated summary with a qualified clinician, avoid passing untrusted patient text directly into the generator, and constrain output paths so the script cannot overwrite unrelated files. Treat the language setting as unreliable until English rendering or explicit locale handling is fixed.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:315
Finding

Unrestricted Output Path Allows Arbitrary Writable-File Overwrite

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:42
Finding

Unescaped Patient Data Permits Markdown and Raw HTML Content Injection

Content
View full analysis
str: """Format patient information section.""" return f"""## 患者基本信息 / Patient Information | 项目 / Item | 内容 / Value | |------------|-------------| | 姓名 / Name | {info.get('name', 'N/A')} | | 性别 / Gender | {info.get('gender', 'N/A')} | | 年龄 / Age | {info.get('age', 'N/A')} 岁 | | 住院号 / MRN | {info.get('medical_record_number', 'N/A')} | | 入院日期 / Admission Date | {info.get('admission_date', 'N/A')} | | 出院日期 / Discharge Date | {info.get('discharge_date', 'N/A')} | | 住院天数 / Length of Stay | {info.get('hospital_stay_days', 'N/A')} 天 | | 科室 / Department | {info.get('department', 'N/A')} | | 主管医师 / Attending Physician | {info.get('attending_physician', 'N/A')} | """ ``` The same direct interpolation pattern is also used for clinical history, diagnoses, procedures, findings, complications, consultations, medications, appointments, and warning signs throughout lines 59–193. ### Technical Analysis Patient-controlled JSON values are inserted directly into Markdown without context-sensitive escaping or validation. The validation routine checks only for the presence of a limited set of fields; it does not verify field types, lengths, control characters, Markdown syntax, or raw HTML. An attacker can therefore provide values containing: - New headings or sections. - Table delimiters and line breaks that escape the intended table cell. - Forged diagnoses, prescriptions, follow-up instructions, or signature content. - Raw HTML accepted by permissive Markdown renderers. - Links or image syntax referencing remote resources. This is particularly significant because the output is a clinical document. Injected formatting can make attacker-controlled content appear to be legitimate medical guidance. If ...[truncated 2047 chars]
Remediation
View remediation
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill documents file read/write behavior via a local Python script but does not declare any explicit tool scope such as permissions or allowed-tools. In a clinical context handling PHI, undeclared filesystem capability increases the risk of unintended access to sensitive files, path misuse, and weaker policy enforcement by the hosting agent platform.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger description is broad enough to activate on general clinical documentation requests, not just discharge summaries. Over-broad routing can cause the wrong skill to process requests containing sensitive patient data, leading to inappropriate document generation, data mixing, or use outside the intended clinical workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Defaulting output language to Chinese without explicit user selection can generate discharge instructions in a language the clinician or patient did not request. In medical discharge documentation, this creates patient-safety and compliance risk because medication instructions, follow-up plans, and warning signs may be misunderstood or unusable.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

This JSON reference file contains user-facing natural-language medical content exclusively in Chinese, including instructions and warning signs. Because the file does not document that the skill is region-specific or that users can opt into this language, it may violate the policy against forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This JSON maps medical terms to Chinese text throughout the file, effectively enforcing a specific language/locale in the skill data. The file does not indicate that Chinese localization is optional, user-selected, or limited to a justified region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file contains natural-language guidance and sample content written in Chinese, but it does not state that language selection depends on user preference or context. Because SQP-3 applies to all file types and covers forced language/locale behavior, these examples may imply a default output language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The CLI explicitly offers --language choices of zh and en at L280-L285, but generate_structured_output hardcodes 'zh' and generate_summary itself does not vary output by the language parameter. This creates a natural-language policy issue because the skill appears to offer language choice while effectively enforcing Chinese output regardless of user preference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The document title is fixed as "出院小结 / DISCHARGE SUMMARY," and many section labels throughout the template are presented in Chinese alongside English without any indication that language selection is optional. This can be a natural-language locale policy issue because the template appears to prescribe a specific bilingual format rather than allowing user or organizational language preference.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.