Back to skill

Security audit

Protocol Deviation Classifier

Security checks for vulnerabilities and agentic risk

Overview

The skill appears purpose-aligned and non-malicious, but it has review-worthy issues in a clinical compliance workflow: an unnecessary unpinned install step, under-documented output categories, and fail-open risk defaults that can understate serious deviations.

Review carefully before installing or using in a clinical quality workflow. Avoid running the pip install step unless the dependency list is fixed or removed, treat all outputs as advisory only, and require human QA review especially for missing or malformed risk-factor inputs and any downstream process expecting only major/minor labels.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding
Unnecessary and Unpinned PyPI Dependencies Create a Supply-Chain Risk<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-2` and `SKILL.md:256-259` **Vulnerability Type**: Unpinned and unnecessary third-party dependencies **Risk Level**: Medium ### Vulnerable Code `requirements.txt:1-2`: ```text dataclasses enum ``` `SKILL.md:256-259`: ```bash # Python dependencies pip install -r requirements.txt ``` ### Technical Analysis The project requires Python 3.8 or later and describes itself as a pure standard-library implementation. Both `dataclasses` and `enum` are included in supported Python versions, so installing packages with these names from PyPI is unnecessary. Neither dependency is pinned to a verified version or protected with an integrity hash. Consequently, executing the documented installation command resolves mutable third-party artifacts at installation time. This unnecessarily expands the project's supply-chain attack surface and makes the installed code dependent on the state of an external package repository at the time of installation. Python package installation may execute package build hooks or other installation-time code. If an unnecessary package, one of its releases, or its distribution channel were compromised, that code would execute with the privileges of the user running `pip`. ### Attack Path 1. A user follows the prerequisite instructions in `SKILL.md`. 2. The user runs `pip install -r requirements.txt`. 3. `pip` resolves the unpinned `dataclasses` and `enum` package names from its configured package index. 4. A compromised, substituted, or unexpectedly changed distribution is downloaded. 5. Package installation logic executes under the installing user's account. 6. The malicious package could access files, credentials, and network resources available to that account. This attack path depends on compromise or substitution of a dependency or package source; the audit did not find evidence that the currently referenced packages are themselves malicious. ### Impact Assessmen ...[truncated 576 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove both entries from `requirements.txt`, because Python 3.8 and later provide `dataclasses` and `enum` in the standard library. 2. Remove the unnecessary `pip install -r requirements.txt` prerequisite or explicitly state that no third-party installation is required. 3. If support for an older Python version is genuinely needed, use the correct, reviewed backport packages only for those versions. 4. Pin every necessary third-party dependency to an approved version. 5. Add cryptographic hashes using a locked dependency file and install with hash verification, for example: ```bash pip install --require-hashes -r requirements.lock ``` 6. Perform dependency vulnerability and provenance checks in CI. 7. Avoid running package installation with administrator or root privileges. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:86
Finding
Missing Risk Factors Are Converted to Benign Values and Bypass Automatic Assessment<![CDATA[ ## Vulnerability Details **File Location**: `scripts/main.py:86-106`, `scripts/main.py:320-339`, and `scripts/main.py:732-740` **Vulnerability Type**: Fail-open input handling and business-logic integrity weakness **Risk Level**: Medium ### Vulnerable Code `scripts/main.py:86-106`: ```python @classmethod def from_dict(cls, data: Dict) -> 'DeviationEvent': """从字典创建事件""" def parse_risk(value): if isinstance(value, str): try: return RiskLevel(value.lower()) except ValueError: return RiskLevel.NONE return RiskLevel.NONE factors = data.get('severity_factors', {}) return cls( id=data.get('id', ''), description=data.get('description', ''), deviation_type=data.get('type', data.get('deviation_type', '')), occurrence_date=data.get('occurrence_date'), site_id=data.get('site_id'), subject_id=data.get('subject_id'), safety_impact=parse_risk(factors.get('safety_impact', 'none')), data_impact=parse_risk(factors.get('data_impact', 'none')), scientific_impact=parse_risk(factors.get('scientific_impact', 'none')) ) ``` `scripts/main.py:320-339`: ```python def classify_batch(self, events: List[Dict]) -> List[ClassificationResult]: """ 批量分类偏差事件 Args: events: 偏差事件字典列表 Returns: List[ClassificationResult]: 分类结果列表 """ results = [] for event_data in events: event = DeviationEvent.from_dict(event_data) result = self.classify( description=event.description, deviation_type=event.deviation_type, event_id=event.id, safety_impact=event.safety_impact, data_impact=event.data_impact, scientific_impact=event.scientific_impact ) results.append(result) return results ``` `scripts/main.py:732-740`: ```python classify_parser.add_argument("--safety-impact", ...[truncated 3378 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Represent an omitted risk factor as `None`, not `RiskLevel.NONE`. 2. Change the `DeviationEvent` impact fields to `Optional[RiskLevel]`. 3. Make invalid risk values produce a validation error rather than silently converting them to `none`. 4. Preserve the distinction between an explicitly asserted `"none"` value and a missing value. 5. Set CLI defaults to `None` so omitted flags trigger automatic assessment: ```python classify_parser.add_argument( "--safety-impact", choices=["none", "low", "medium", "high"], default=None ) ``` 6. Parse a supplied value only when it is present: ```python safety = RiskLevel(args.safety_impact) if args.safety_impact is not None else None ``` 7. Apply equivalent handling to data and scientific impacts. 8. Validate batch input against an explicit schema, including types, required fields, accepted values, and maximum description lengths. 9. Consider rejecting incomplete records in strict or regulatory-reporting mode. 10. Add regression tests covering: - Severe descriptions with no `severity_factors`. - Partially specified risk factors. - Invalid risk values. - Explicit `"none"` values. - Consistency between Python API, batch, interactive, and CLI classifications. ]]>
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The documented purpose says the skill performs a binary major/minor classification, but the content also describes critical deviations, report generation, and interactive workflows. This mismatch can cause agents or users to invoke the skill under incorrect assumptions, leading to over-broad behavior, unsafe automation, or outputs being used for regulatory decisions beyond the intended scope.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill documentation acknowledges file read/write behavior but does not declare an explicit tool scope such as permissions or allowed-tools. This creates an authorization gap where an agent runtime may grant broader filesystem access than reviewers or users expect, increasing the chance of unintended data access or overwriting files.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger text says the skill should be used 'when classification assessment of protocol deviations is needed,' which is a general condition rather than a specific invocation scope. It does not define precise trigger phrases, boundaries, or exclusion conditions, so it could overlap with many routine discussions of clinical trial deviations.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This Python skill includes natural-language descriptions and operational output primarily in Chinese, and the interactive/CLI experience continues that fixed-language behavior elsewhere in the file. Under the policy rule for language/locale, forcing a specific language without user opt-in is a violation unless the locale constraint is clearly documented and justified.

Description-Behavior Mismatch

Medium
Confidence
98% confidence
Finding
The manifest says the skill determines whether an incident is a 'major deviation' or 'minor deviation', but the implementation introduces and emits a third 'critical' outcome. This interface/behavior mismatch can break downstream automation, regulatory workflows, or policy logic that assumes a closed two-class decision, causing misrouting or unhandled cases in a clinical compliance context.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
The feature list advertises 'Chinese Support: Full support for Chinese clinical trial scenarios,' which introduces a locale-specific behavior without stating whether users can choose other languages or locales. Under the policy, locale constraints should be opt-in or clearly justified as region-specific.

Unpinned Dependencies

Low
Category
Supply Chain
Content
dataclasses
enum
Confidence
60% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Unpinned Dependencies

Low
Category
Supply Chain
Content
dataclasses
enum
Confidence
60% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Description-Behavior Mismatch

Low
Confidence
84% confidence
Finding
The manifest centers on classifying a deviation incident and assessing its impact, but this code also produces summary reports, category breakdowns, rates, and portfolio-level recommendations across batches of incidents. That is broader quality-management reporting functionality, not just per-incident classification.

Static analysis

No suspicious patterns detected.