Back to skill

Security audit

Low-Resource AI Researcher

Security checks for vulnerabilities and agentic risk

Overview

This medical fine-tuning skill has review-worthy risk because it can execute remote model repository code by default and uses unconstrained dependencies in a sensitive medical-data workflow.

Install only in an isolated, nonprivileged environment. Use vetted model repositories pinned to exact revisions, change trust_remote_code to false unless you explicitly need and trust custom model code, pin and audit dependencies before installation, and avoid using identifiable medical data unless your storage, logging, checkpoints, and saved models are approved for that data.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/main.py:281
Finding

Remote Model Repository Code Is Trusted and Executed by Default

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py:67, scripts/main.py:281-306, and scripts/main.py:345-362
Vulnerability Type: Remote code execution through untrusted model repository content
Risk Level: High

Vulnerable Code

python
@dataclass
class MedicalTrainingConfig:
    # Model config
    model_name_or_path: str = "meta-llama/Llama-2-7b-hf"
    tokenizer_name: Optional[str] = None
    trust_remote_code: bool = True
python
def __init__(
    self,
    model_name: str = "meta-llama/Llama-2-7b-hf",
    task: str = "medical_qa",
    lora_r: int = 64,
    lora_alpha: int = 128,
    use_qlora: bool = False,
    target_modules: Optional[List[str]] = None,
    device_map: str = "auto",
    trust_remote_code: bool = True,
    config: Optional[MedicalTrainingConfig] = None
):
    self.config = config or MedicalTrainingConfig()

    # Override config with direct parameters
    self.config.model_name_or_path = model_name
    self.config.lora_r = lora_r
    self.config.lora_alpha = lora_alpha
    self.config.use_qlora = use_qlora
    self.config.load_in_4bit = use_qlora
    self.config.trust_remote_code = trust_remote_code
python
# Load tokenizer
tokenizer_name = self.config.tokenizer_name or self.config.model_name_or_path
self.tokenizer = AutoTokenizer.from_pretrained(
    tokenizer_name,
    trust_remote_code=self.config.trust_remote_code,
    padding_side="right",
)

# Set pad token if not exists
if self.tokenizer.pad_token is None:
    self.tokenizer.pad_token = self.tokenizer.eos_token
    self.tokenizer.pad_token_id = self.tokenizer.eos_token_id

# Load model
self.model = AutoModelForCausalLM.from_pretrained(
    self.config.model_name_or_path,
    quantization_config=quantization_config,
    device_map=self.config.device_map if quantization_config else None,
    trust_remote_code=self.config.trust_remote_code,
 
...[truncated 2463 chars]
Remediation
View remediation

Remediation Suggestions

  1. Change every default for trust_remote_code to False.
  2. Do not overwrite an explicitly supplied configuration value with a constructor default. Use an optional override and only assign it when the caller explicitly provides one.
  3. Require an explicit, prominently documented opt-in before executing repository-provided code.
  4. Restrict remotely loaded models and tokenizers to an administrator-maintained allowlist.
  5. Pass an immutable, reviewed commit hash through the revision parameter for every remote model and tokenizer.
  6. Prefer standard Transformers architectures that do not require custom repository code.
  7. Perform model loading and training in a sandbox with no unnecessary credentials, restricted filesystem mounts, limited outbound network access, and a nonprivileged operating-system account.
  8. Log the repository identifier and exact revision before loading it, and verify downloaded artifacts against approved hashes.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned and Unnecessary Python Dependencies Create Supply-Chain Exposure

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-8
Vulnerability Type: Unconstrained third-party dependency installation
Risk Level: Medium

Vulnerable Code

text
accelerate
dataclasses
datasets
flash_attn
peft
skills
torch
transformers

Technical Analysis

All dependencies are declared without exact versions or integrity hashes. As a result, installing the same project at different times can retrieve different package versions and code that was not covered by the audit. A compromised release, malicious replacement, dependency-resolution change, or unexpected incompatible version could enter the environment without a project source-code change.

The generic skills dependency is not imported by the audited executable code. Including an unnecessary, broadly named package expands the supply-chain attack surface. The dataclasses backport is also generally unnecessary on supported modern Python versions and should only be conditionally installed if legacy Python support is intentional.

This finding does not establish that the currently published packages are malicious. It identifies an unsafe dependency-management practice that permits mutable and insufficiently verified code to enter the execution environment.

Attack Path

  1. A user follows the documented prerequisite and runs pip install -r requirements.txt.
  2. The package resolver queries the configured index and selects the latest versions satisfying the unconstrained names.
  3. A compromised release, unintended package, or newly introduced vulnerable version is downloaded.
  4. Package build or installation hooks can execute during installation; package code can also execute when imported by scripts/main.py.
  5. That code runs with the permissions of the user performing installation or executing the trainer.

Impact Assessment

A malicious dependency can obtain code execution during installation or runtime. I ...[truncated 382 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove skills unless a verified runtime requirement can be demonstrated.
  2. Remove dataclasses on supported Python versions, or apply an appropriate Python-version environment marker.
  3. Pin every direct and transitive dependency to reviewed versions in a generated lockfile.
  4. Require cryptographic hashes during installation, such as through a hash-locked requirements file and pip --require-hashes.
  5. Install only from an approved package index and disable untrusted extra indexes.
  6. Audit dependency names, maintainers, release provenance, licenses, and known vulnerabilities before approval.
  7. Separate optional packages such as flash_attn from mandatory dependencies and pin their supported build variants.
  8. Run dependency installation in an isolated, nonprivileged build environment, then promote verified artifacts into the runtime environment.
  9. Use automated dependency scanning and controlled update reviews so version changes cannot silently bypass security assessment.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (21)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill explicitly targets medical datasets and clinical notes, but the documentation does not give a clear, prominent warning about handling regulated or sensitive health data during fine-tuning, evaluation, checkpointing, and logging. In this context, users may unknowingly process PHI/PII, retain it in checkpoints or artifacts, or violate HIPAA/GDPR and institutional policy, making the omission a real security and privacy risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The configuration enables trust_remote_code=True by default, which allows model or tokenizer repositories to supply and execute arbitrary Python during loading. In a training tool that may consume third-party Hugging Face assets, this creates an unnecessary remote code execution path unrelated to standard PEFT training.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Remote code execution is enabled by configuration without any user-facing disclosure, confirmation step, or safety messaging. Users may reasonably believe they are only downloading model weights/tokenizers, not executing repository-supplied Python code.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill loads remote datasets and models for medical training workflows, which may involve transmitting model identifiers, dataset requests, and potentially locally specified training files through external library/network interactions. The script lacks any explicit user disclosure that remote services are contacted during execution in a medical-data context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

Both AutoTokenizer.from_pretrained() and AutoModelForCausalLM.from_pretrained() propagate trust_remote_code from configuration, so loading an untrusted model identifier can execute repository-defined code locally. Because this skill targets medical model fine-tuning, users are likely to try external checkpoints, making the exposure practically significant.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill instructs users to write outputs, checkpoints, and merged models to local directories without clearly warning that these artifacts persist on disk and may contain sensitive training information or proprietary model weights. In a medical fine-tuning workflow, silent persistence increases the chance of unintended retention, sharing, or backup of sensitive artifacts.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The dependency accelerate is unpinned, so installs may resolve to different versions over time, including vulnerable or breaking releases. In a medical LLM training skill, this increases supply-chain risk and makes it impossible to verify whether known fixes are present.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
accelerate
dataclasses
datasets
flash_attn

Unverifiable Dependency: accelerate has 2 known advisory(ies) (CVE-2026-69112 (Accelerate path traversal and denial of service via sharded checkpoint weight_ma); CVE-2026-69112 (Accelerate path traversal and denial of service via sharded checkpoint weight_ma)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
97% confidence
Finding

accelerate has known advisories, but the manifest does not pin a version, so there is no way to determine whether deployments receive a fixed or affected release. This uncertainty is itself a supply-chain weakness because it prevents reliable vulnerability management.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency dataclasses is unpinned, which reduces build reproducibility and can introduce unexpected package resolution changes. While lower risk than model or serialization-heavy libraries, unpinned versions still create avoidable supply-chain uncertainty.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
accelerate
dataclasses
datasets
flash_attn
peft

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The dependency datasets is unpinned, so the environment may install an affected release if a vulnerable version is available. Because dataset tooling often handles remote content and file operations, version drift raises the chance of exposure to known bugs.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
accelerate
dataclasses
datasets
flash_attn
peft
skills

Unverifiable Dependency: datasets has 1 known advisory(ies) (CVE-2026-66007 (Datasets through 5.0.0, fixed in commit f989ef9, contains a path traversal vulne)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
97% confidence
Finding

datasets has a known advisory history, but without a version pin the environment may resolve to either safe or vulnerable releases. That makes the dependency state unverifiable and increases risk in workflows that ingest external datasets and manipulate local files.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The dependency flash_attn is unpinned, making the build non-reproducible and potentially pulling in versions with known security issues. This is more concerning in GPU/ML workflows where performance libraries may process checkpoints or native code paths.

Content

Scanner excerpt · requirements.txt (reported line 4)May include surrounding context.

text
accelerate
dataclasses
datasets
flash_attn
peft
skills
torch

Unverifiable Dependency: flash_attn has 2 known advisory(ies) (CVE-2026-31253 (flash-attention contains an insecure deserialization vulnerability in its checkp); CVE-2026-31253 (flash-attention contains an insecure deserialization vulnerability in its checkp)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
98% confidence
Finding

flash_attn has known advisories and is left unpinned, so consumers cannot verify whether installed builds include security fixes. In native-extension ML libraries, this uncertainty is particularly undesirable because issues can affect checkpoint handling or low-level execution paths.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency peft is unpinned, allowing unreviewed upstream changes to enter the environment. In an ML fine-tuning stack, this can affect security and stability through transitive dependencies and changing model-loading behavior.

Content

Scanner excerpt · requirements.txt (reported line 5)May include surrounding context.

text
dataclasses
datasets
flash_attn
peft
skills
torch
transformers

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
99% confidence
Finding

The dependency skills is unpinned and is especially risky because the package name is generic and could resolve unexpectedly or be vulnerable to dependency confusion if private/internal sources are intended. This creates both reproducibility and supply-chain integrity concerns beyond ordinary version drift.

Content

Scanner excerpt · requirements.txt (reported line 6)May include surrounding context.

text
datasets
flash_attn
peft
skills
torch
transformers

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
99% confidence
Finding

The dependency torch is unpinned, so installations may pick up releases with known vulnerabilities or unsafe behavior changes. Given that PyTorch commonly loads serialized model artifacts, version control is important for limiting exposure to code-execution and deserialization-related flaws.

Content

Scanner excerpt · requirements.txt (reported line 7)May include surrounding context.

text
flash_attn
peft
skills
torch
transformers

Unverifiable Dependency: torch has 16 known advisory(ies) (CVE-2025-2953 (PyTorch susceptible to local Denial of Service); CVE-2022-45907 (PyTorch vulnerable to arbitrary code execution); CVE-2025-32434 (PyTorch: `torch.load` with `weights_only=True` leads to remote code execution) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
99% confidence
Finding

torch has many known advisories, including serious code-execution and deserialization-related issues, but the manifest does not constrain the installed version. In an ML training skill that likely loads third-party models or checkpoints, this materially increases exposure because vulnerable releases could be installed silently.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
99% confidence
Finding

The dependency transformers is unpinned, which is risky because the library often interfaces with remote models, tokenizers, and file-handling logic. In a medical LLM training context, this broad attack surface makes version drift more dangerous than in a minimal utility package.

Content

Scanner excerpt · requirements.txt (reported line 8)May include surrounding context.

text
peft
skills
torch
transformers

Unverifiable Dependency: transformers has 16 known advisory(ies) (CVE-2023-2800 (transformers has Insecure Temporary File); CVE-2026-4372 (HuggingFace transformers vulnerable to remote code execution); CVE-2025-3933 (Transformers is vulnerable to ReDoS attack through its DonutProcessor class) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
99% confidence
Finding

transformers has multiple known advisories, including remote-code-execution-related issues, yet the manifest does not pin a version. Because this skill concerns medical LLM training and likely interacts with external models and preprocessing pipelines, unverifiable dependency state is more dangerous here than in a narrow offline utility.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The file contains natural-language descriptions and many docstrings in Chinese while the CLI and other strings are in English, but there is no indication that language is selectable or intentionally region-scoped. This can violate a language/locale policy requiring user opt-in before enforcing a specific language.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/main.py (reported line 328)May include surrounding context.

python
logger.info("Using 4-bit quantization (QLoRA)")
            return BitsAndBytesConfig(
                load_in_4bit=True,
                bnb_4bit_compute_dtype=getattr(torch, self.config.bnb_4bit_compute_dtype),
                bnb_4bit_use_double_quant=self.config.bnb_4bit_use_double_quant,
                bnb_4bit_quant_type=self.config.bnb_4bit_quant_type,
            )