T09 · Insecure Skill Coding Practices
- Location
scripts/run.py:142- Finding
Patient Medical Data Is Transmitted Without Enforced De-identification
- Content
View full analysis
Vulnerability Details
File Location:
scripts/run.py:142-149
Related Documentation:SKILL.md:29-31
Vulnerability Type: Sensitive medical data disclosure caused by missing de-identification controls
Risk Level: High
Category: T09: Insecure Skill Coding PracticesVulnerable Code
python def run_referral(case_summary: str, llm, output_path: str = "") -> int: prompt = f"""请根据以下患者病情摘要,给出转诊指导建议。 【患者病情】 {case_summary.strip()} 请严格按照要求输出 JSON + 摘要。""" print("正在评估患者转诊需求...") result = llm([sys_msg(SYSTEM_PROMPT), user_msg(prompt)])The documentation states:
markdown - **严格脱敏**:发送前对可识别身份信息进行脱敏处理。 - **不做本地持久化**:仅在内存中短暂处理;**本次调用结束即销毁**。Technical Analysis
The implementation interpolates the entire contents of
case_summaryinto the LLM prompt and submits it to the configured remote service. No code identifies, removes, masks, or validates direct and indirect patient identifiers before transmission.Because
load_inputaccepts arbitrary text and JSON records, submitted content can include names, identification numbers, telephone numbers, addresses, medical record numbers, dates of birth, or other protected health information. The documented instruction that users should de-identify records is not a technical safeguard, and the stronger statement that strict de-identification occurs before sending is not enforced by the implementation.This creates a confidentiality weakness at the trust boundary between the local clinical environment and the external LLM endpoint. It is particularly consequential because the information is medical data and may be subject to contractual, regulatory, and organizational privacy requirements.
Attack Path
- An operator supplies a text or JSON input containing a patient case with identifying information.
load_inputreads and returns that information without sanitization.run_referralinserts the complet ...[truncated 1063 chars]
- Remediation
View remediation
Remediation Suggestions
- Implement local de-identification before constructing the LLM prompt. At minimum, detect and mask common identifiers such as names, government identifiers, phone numbers, email addresses, postal addresses, medical record numbers, and exact dates not required for referral decisions.
- Prefer structured input with an explicit allowlist of medically necessary fields instead of transmitting arbitrary records.
- Reject records containing likely identifiers when safe automatic redaction cannot be guaranteed. Return a clear error requesting sanitized input.
- Display the sanitized payload for operator confirmation before sending it when the workflow permits human review.
- Add automated tests covering direct identifiers, indirect identifiers, nested JSON fields, and free-form clinical notes.
- Ensure the remote provider's retention and logging controls are suitable for medical information and are reflected accurately in the documentation.
- Revise
SKILL.mdso it does not claim strict de-identification unless that control is actually implemented and verified. - Document the external transmission boundary, the receiving service, retention behavior, and residual re-identification risks.
