T07 · Tool Hijacking and Spoofing
- Location
scripts/run.py:220- Finding
Unverified External Python Module Execution During Preprocessing Fallback
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This health alert skill discloses much of its medical-file processing, but it also sends sensitive health data to a model service and has an unsafe fallback that can run unreviewed local code.
Review this carefully before installing. Use it only if users are allowed to send medical indicator data to the listed model provider, local document/OCR tools are sandboxed, and the external shared-preprocessor fallback is removed or pinned to trusted code. For patient-facing use, require consent, minimize or redact inputs, and validate generated medical text against approved rules.
scripts/run.py:220Unverified External Python Module Execution During Preprocessing Fallback
scripts/run.py:88Prompt Injection Through Unvalidated Medical Input Fields
scripts/run.py:24Sensitive Health Data Is Transmitted to an External Model Service Without Data-Minimization Controls
scripts/run.py:60Model-Generated Medical Claims Exceed the Documented Rule-Only Safety Boundary
The declared purpose is narrow abnormal-indicator alerting, but the documented behavior expands into broad document ingestion, OCR, PDF parsing, and Office conversion. That mismatch matters because users may provide highly sensitive medical files believing the skill only processes structured indicators, while the implementation appears capable of extracting and transmitting far more data than expected.
The skill explicitly sends medical data to an external/internal model API endpoint for analysis but does not provide a clear user-facing warning or consent notice. Because the inputs may include patient health information from documents, images, and spreadsheets, undisclosed transmission creates significant privacy, compliance, and trust risks.
The file implements a broad multi-format ingestion and extraction utility that is not closely aligned with a chronic-disease abnormal indicator alert skill. This capability expansion increases the attack surface substantially by accepting many risky file formats and external-processing paths without a clear medical-alerting need, making abuse or accidental overcollection more likely.
The skill includes subprocess-driven OCR and office/PDF conversion on user-provided files despite its stated purpose not obviously requiring such broad document-processing capability. In context, this mismatch is dangerous because it introduces high-risk external parsers and data extraction features that expand both exploitability and privacy exposure beyond what a medical alerting skill should minimally need.
The skill advertises capabilities that include file access, shell use, environment access, and network calls, but it does not declare any explicit tool scope or permission boundaries. In a health-data workflow, this creates unnecessary ambiguity about what the skill may access or transmit, increasing the risk of over-privileged execution and unintended exposure of sensitive patient data.
The entire skill description and examples are written for Chinese usage, and the OCR/tooling section explicitly requires chi_sim+eng, suggesting a built-in Chinese locale assumption. The file does not offer a language/locale choice or explain that the skill is intentionally limited to a specific region or language context.
This code runs LibreOffice on user-supplied office documents for conversion. Although it avoids shell injection, invoking complex document parsers on untrusted files materially increases attack surface and can lead to parser-triggered code execution, sandbox escapes, or denial of service if the external tool has vulnerabilities.
if not office_bin:
raise PreprocessError("libreoffice/soffice not found for office document conversion.")
with tempfile.TemporaryDirectory(prefix="med-skill-preprocess-") as tmp_dir:
proc = subprocess.run(
[office_bin, "--headless", "--convert-to", "txt:Text", "--outdir", tmp_dir, str(path)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False,
)
The file invokes external tools such as LibreOffice/soffice, pdftotext, and tesseract to process user-provided documents and images. While this is functionally related to preprocessing, there is no confirmation prompt, user-facing log, or warning in the code indicating that local binaries will be executed against the supplied files.
This subprocess executes LibreOffice against user-controlled .xls input, which exposes the service to vulnerabilities in a large external parser stack. The risk is not shell injection but unsafe processing of attacker-crafted files that may trigger remote code execution or resource exhaustion in the converter.
if not office_bin:
raise PreprocessError("libreoffice/soffice not found for xls conversion.")
with tempfile.TemporaryDirectory(prefix="med-skill-preprocess-") as tmp_dir:
proc = subprocess.run(
[office_bin, "--headless",
"--convert-to", "csv:Text - txt - csv (StarCalc):44,34,76,1",
"--outdir", tmp_dir, str(path)],
This call sends untrusted PDFs to an external text-extraction utility. As with other parser subprocesses, the main risk is exploitation of vulnerabilities in the PDF toolchain or denial of service from maliciously crafted PDFs, not command injection.
pass
pdf_to_text = shutil_which("pdftotext")
if pdf_to_text:
proc = subprocess.run(
[pdf_to_text, "-layout", str(path), "-"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False,
)
The code automatically prefers the locale combination "chi_sim+eng" when those Tesseract models are available, rather than letting the user choose OCR language settings. This imposes a specific language/locale behavior without documented user choice or clear region-specific justification.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
cmd = [tesseract_bin, str(path), "stdout"]
if lang_arg:
cmd.extend(["-l", lang_arg])
proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False)
if proc.returncode != 0 or not proc.stdout.strip():
raise PreprocessError(f"Image OCR failed: {proc.stderr.strip() or 'no text returned'}")
return proc.stdout
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def detect_tesseract_langs(tesseract_bin: str) -> Sequence[str]:
proc = subprocess.run(
[tesseract_bin, "--list-langs"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=False,
)
The system prompt instructs the model entirely in Chinese, and the skill description and output expectations are also Chinese-specific. This forces a specific language/locale behavior without any opt-in, selection mechanism, or documented region-specific justification.
The skill directly interpolates untrusted, user-supplied medical fields into an external LLM prompt and then returns the model output, which can disclose sensitive health data in transformed or expanded form. Because this is a healthcare skill, prompt injection and privacy leakage are more dangerous: malicious or malformed input can manipulate the generated medical summary, while sensitive clinical details are exposed to a third-party model service.
The code sends patient medical indicator data, timestamps, threshold profiles, and derived abnormality assessments to an external LLM API via _call_llm without any consent gate, minimization, anonymization, or disclosure in the execution path. In a medical-monitoring skill, this is especially sensitive because the data can reveal health conditions and treatment context, creating privacy, compliance, and third-party retention risks.