Back to skill

Security audit

Eicu Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is documentation-only, but its ready-to-run database templates include unsafe SQL construction and destructive database DDL that users should review carefully before use.

Treat this skill as untrusted query documentation, not production-ready code. Use a read-only PostgreSQL role, parameterize all generated SQL, require explicit review before any DROP/CREATE statement, run only on authorized eICU data, and avoid printing or sharing raw patient-level results unless necessary and compliant.

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

Error
Location
references/labs.md:252
Finding

SQL Injection in Generated Python Database Templates

Content
View full analysis
10 THEN NULL" ) elif lab_name == 'creatinine': case_clauses.append( f"WHEN l.labname = '{lab_name}' AND l.labresult > 150 THEN NULL" ) query += f""" l.labmeasurenamesystem, l.labmeasurenameinterface FROM lab l WHERE l.labresultoffset >= 0 AND l.labresultoffset < 1440 AND l.labresult IS NOT NULL AND l.labname IN ('{lab_names_str}') AND l.labresult > 0 ORDER BY l.patientunitstayid, l.labname, l.labresultoffset """ if patient_ids is not None: if len(patient_ids) == 1: query = query.replace( "WHERE l.labresultoffset", f"WHERE l.patientunitstayid = {patient_ids[0]} AND l.labresultoffset" ) else: ids_s ...[truncated 4060 chars]
Remediation
View remediation
= %(min_offset)s AND l.labresultoffset < %(max_offset)s ORDER BY l.patientunitstayid, l.labname, l.labresultoffset """ params = { "patient_ids": validated_patient_ids, "lab_names": validated_lab_names, "min_offset": 0, "max_offset": 1440, } df = pd.read_sql_query(query, conn, params=params) ``` 2. Validate patient identifiers before database execution: ```python def validate_patient_ids(patient_ids): if patient_ids is None: return None if not isinstance(patient_ids, (list, tuple)): raise TypeError("patient_ids must be a list or tuple") if not patient_ids: raise ValueError("patient_ids cannot be empty") if any(type(value) is not int or value <= 0 for value in patient_ids): raise ValueError("Every patient ID must be a positive integer") return list(patient_ids) ``` 3. Restrict string filters to documented allowlists where appropriate. Validation is defense in depth and must not replace parameter binding. 4. Do not build SQL value lists using: ```python "','".join(values) ",".join(map(str, values)) ``` 5. If dynamic identifiers are ever required, use `psycopg2.sql.Identifier` rather than ordinary value parameters. Values must continue to use placeholders. 6. Update every affected reference template, not only the representative laboratory example, because agents may reproduce any documented implementation. 7. Recommend a read-only PostgreSQL role with access li ...[truncated 95 chars]

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:408
Finding

Destructive and Unqualified DDL Templates Use DROP CASCADE

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (31)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill states it only provides query code, but the examples include state-changing SQL such as DROP MATERIALIZED VIEW, CREATE MATERIALIZED VIEW, DROP TABLE, and CREATE TABLE. In an agentic setting, this mismatch can cause an assistant or user to run supposedly read-only guidance that actually alters the database, leading to accidental destruction or persistence of data structures.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented SQL includes CREATE/DROP table and materialized view operations without a clear upfront warning that they modify schema and persist data. In a database skill handling large clinical datasets, this is dangerous because users may assume the code is safe to run in production and unintentionally delete objects, trigger cascading drops, or create costly persistent artifacts.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

These examples perform destructive or persistent operations while the skill is presented as an extraction-only tool. Because DROP ... CASCADE and CREATE TABLE/MATERIALIZED VIEW can delete dependent objects or consume storage, the gap between description and behavior raises the risk of unintended database modification when an agent follows the examples automatically.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document title and all instructional content are written exclusively in Chinese, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example calls calculate_mortality_rate(demo, status_col='hosp_mortality_numeric'), but the function checks for rows equal to the string 'Expired'. In this skill’s medical-research context, that mismatch can silently produce an incorrect mortality estimate, leading users to trust wrong clinical summary statistics without obvious errors.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file includes runnable examples that retrieve and print patient-level diagnoses and past history, which are sensitive clinical data elements. In a healthcare data skill, omitting explicit guidance on authorized use, minimum-necessary access, de-identification, and avoiding raw output increases the risk that users will expose protected or regulated data in notebooks, logs, terminals, or shared artifacts.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The docstring says the function returns '长格式 GCS 数据' and the surrounding examples describe a long-format extraction, but the SQL built in the function selects one row per patientunitstayid/nursingchartoffset with separate component columns generated from CASE clauses. That is a wide-per-timestamp layout, not the documented long format, creating an intent/documentation mismatch for downstream users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains user-facing instructions entirely in Chinese, including the title, section headings, and operational guidance, but does not indicate that the user can choose another language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation includes destructive and state-changing SQL (DROP TABLE IF EXISTS and CREATE TABLE AS) in a skill described as an extraction/query tool. In an agent setting, users may expect read-only behavior, so including DDL increases the risk of unintended schema changes, clobbering prior analyst work, or modifying shared databases when the agent follows examples verbatim.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

文件标题和全文内容均以中文撰写,没有任何说明该技能仅面向中文用户,或提供其他语言/locale 的选择。根据规则,若技能在自然语言层面强制特定语言而无用户 opt-in,可构成语言/locale policy violation。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The Python template omits the value-range filters that the SQL examples and notes say are necessary for handling known outliers and bad measurements. This inconsistency can silently propagate implausible physiologic values into downstream analyses, risk scores, and models, causing integrity issues in clinical research outputs generated from the skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document's own performance guidance says large eICU tables should be filtered by patientunitstayid to avoid full-table scans, yet the provided Python workflow defaults to querying all patients when patient_ids is None. In a skill that generates production-ready extraction code against 100M+ row tables, this can trigger expensive scans, long-running jobs, resource exhaustion, or accidental denial of service against shared research infrastructure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

该 markdown 文件从标题开始即以中文固定呈现,且全文未说明这是面向中文用户的特定区域文档,也未提供其他语言选项。按照语言/locale 政策,这种默认强制单一语言而无用户选择的自然语言约束应被标记。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The section explicitly claims to extract first-day ICU vital signs, but the primary long-format SQL example does not apply the documented nursingchartoffset >= 0 AND nursingchartoffset < 1440 restriction. Users relying on this example may unknowingly retrieve data outside the intended time window, causing cohort misclassification, label leakage, and incorrect downstream clinical analyses.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The example comments say all_weights is the prior long-format weight result, but the SELECT projects MAX(height_fixed) even though the long-format union shown earlier outputs only patientunitstayid, chartoffset, source_table, weight_type, and weight. This contradicts the example's own documented structure and would not work as written.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The docstring says extract_first_day_weight returns long-format weight data containing all sources, and the comments describe merging all sources. However, the displayed all_weights CTE only includes the htwt_fixed/patient branch, while the other UNION branches are explicitly omitted, so the code as written would not actually produce all-source results.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The function docstring states the input is the long-format data returned by extract_first_day_weight, yet aggregate_weight_to_wide selects ['patientunitstayid', 'height_fixed'] from df. In the documented query for extract_first_day_weight, the final SELECT is SELECT * FROM all_weights, and the illustrated all_weights rows contain source metadata and weight, not height_fixed, so the documented pipeline contradicts itself.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The sample invocation is written in Chinese, and the later usage examples continue this pattern without stating that other languages are supported. This can be read as steering or implicitly requiring a specific language, which is a natural-language locale policy concern when no opt-in or alternative is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

该 markdown 文件从标题开始即以中文呈现,且全文未说明这是特定中文用户群体专用,也未提供多语言选项或用户可选语言提示。按规则,强制单一语言而没有用户选择或明确合理说明,属于自然语言层面的语言/locale 策略问题。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The inline comment on AND l.labresult > 0 states that lab values cannot be 0 and cannot be negative, but the documented sanity rules above explicitly allow 0 for pO2, pCO2, O2 saturation, bicarbonate, and lactate. This is an active contradiction between the code comment/filter rationale and the skill's own validation logic, which may cause valid zero-valued records to be excluded despite the documented thresholds.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

该 markdown 文件从标题、目录到说明内容均固定为中文,没有提供多语言选项、用户语言偏好入口,或解释为何必须限定为中文。根据规则,强制特定语言且无用户选择属于自然语言层面的语言/地区策略问题。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

SQP-3 applies to all file types and includes language/locale policy violations. The skill content consistently forces a single language for instructions and examples, with no opt-in, alternative language option, or statement that the skill is intended only for a Chinese-language audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file is entirely presented in Chinese, including headings, instructions, warnings, and examples. Under the policy rules, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The section header/comment describes a '宽表格式,每个患者一行', which implies a direct pivoted wide table of GCS observations. However, the query computes AVG/MIN/MAX summaries for each patient, so it is an aggregated feature table rather than a simple wide representation of the original records.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file is written entirely in Chinese, including headings, instructions, comments, and examples, with no indication that users may choose another language. Under the policy rule for natural-language violations, forcing a specific language without opt-in can be a locale policy issue unless the restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.