Back to skill

Security audit

Peft Fine Tuning

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent PEFT fine-tuning guide with some normal but important supply-chain and publishing cautions.

Install in a virtual environment or container, avoid running setup commands with administrator privileges, pin dependencies for production, and do not push merged models or adapters to Hugging Face Hub unless you intend to publish them and have verified permissions, licensing, and data-sensitivity concerns.

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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:8
Finding
Unpinned Third-Party Dependencies Permit Unreviewed Package Resolution## Vulnerability Details **File Locations**: - `SKILL.md:8` - `SKILL.md:39-45` - `references/troubleshooting.md:16` - `references/troubleshooting.md:32` - `references/troubleshooting.md:46` **Vulnerability Type**: Unpinned and lower-bound-only third-party dependencies **Risk Level**: Medium **Complete Code Snippets**: `SKILL.md:8`: ```yaml dependencies: [peft>=0.13.0, transformers>=4.45.0, torch>=2.0.0, bitsandbytes>=0.43.0] ``` `SKILL.md:39-45`: ```bash # Basic installation pip install peft # With quantization support (recommended) pip install peft bitsandbytes # Full stack pip install peft transformers accelerate bitsandbytes datasets ``` `references/troubleshooting.md:16`: ```bash pip install bitsandbytes --no-cache-dir ``` `references/troubleshooting.md:32`: ```bash pip install triton ``` `references/troubleshooting.md:46`: ```bash pip install peft>=0.13.0 --upgrade ``` ### Technical Analysis These installation instructions use unconstrained dependencies or minimum-version constraints instead of exact, reviewed versions. Package resolution therefore depends on the contents of the package index at installation time. The resolved package and its transitive dependencies can change after the Skill has been audited. Python packages may execute build backends or installation-related code during installation. Consequently, compromise of a package publisher account, malicious dependency publication, dependency confusion in a mixed public/private index environment, or a compromised transitive dependency could turn these commands into a local code-execution path. The use of `--no-cache-dir` does not provide integrity protection. It only bypasses the local package cache and may increase reliance on newly downloaded artifacts. ### Attack Path 1. An attacker compromises a referenced package, one of its transitive dependencies, or the package index account used to publish it. 2. ...[truncated 1226 chars]
Remediation
## Remediation Suggestions 1. Replace unconstrained and minimum-only requirements with exact versions that have been reviewed and tested. 2. Maintain a lock file or fully resolved requirements file containing all transitive dependencies. 3. Record and enforce artifact hashes, for example: ```bash python -m pip install --require-hashes -r requirements.txt ``` 4. Generate the hashed requirements file from a controlled environment and review dependency changes before updating it. 5. Recommend installation in a dedicated virtual environment or disposable container rather than a system Python environment. 6. Avoid installing packages with administrator privileges. 7. Configure trusted package indexes explicitly and prevent unintended fallback to public indexes where private package names are involved. 8. Add automated dependency vulnerability, provenance, and license scanning to the release process. 9. Document a tested version matrix for PEFT, Transformers, PyTorch, bitsandbytes, Triton, CUDA, and related dependencies.

T03 · Remote Payload Retrieval and Execution

Warning
Location
references/troubleshooting.md:19
Finding
Mutable Remote Repository Is Retrieved and Executed Without Revision or Integrity Verification## Vulnerability Details **File Location**: `references/troubleshooting.md:19-22` **Vulnerability Type**: Remote payload retrieval and execution from a mutable repository revision **Risk Level**: Medium **Complete Code Snippet**: ```bash git clone https://github.com/TimDettmers/bitsandbytes.git cd bitsandbytes CUDA_VERSION=118 make cuda11x # Adjust for your CUDA pip install . ``` ### Technical Analysis The troubleshooting procedure clones the repository's default branch without selecting an immutable commit, verified signed tag, or reviewed release archive. It then executes the downloaded project's build system through `make` and invokes its Python installation process through `pip install .`. Because the default branch can change after the Skill is reviewed, the effective code executed by this procedure is not fixed by the audited project. A compromise of the upstream repository, maintainer account, release workflow, or relevant network trust chain could therefore substitute malicious build or installation behavior. HTTPS protects transport in normal operation but does not establish that the retrieved repository state is the specific state reviewed by this Skill. No commit identifier, signature validation, checksum verification, or sandboxing requirement is provided. ### Attack Path 1. An attacker compromises the upstream repository, an authorized maintainer account, or the repository's default branch. 2. The attacker modifies build files, Python packaging configuration, or source code to include a malicious payload. 3. A user experiencing the documented CUDA issue follows the troubleshooting instructions. 4. `git clone` retrieves the attacker-controlled current branch state. 5. `make cuda11x` executes attacker-controlled build rules or commands. 6. `pip install .` executes the downloaded package's build backend and installs the resulting component. 7. The malicious payload runs with the user's privileges and ...[truncated 805 chars]
Remediation
## Remediation Suggestions 1. Pin the checkout to an immutable, reviewed commit: ```bash git clone https://github.com/TimDettmers/bitsandbytes.git cd bitsandbytes git checkout --detach REVIEWED_COMMIT_SHA ``` 2. Verify the checked-out commit against the expected full commit hash before building. 3. Prefer a signed upstream release and verify its signature or published checksum. 4. Avoid relying on the repository's mutable default branch in executable documentation. 5. Review the build files and packaging configuration associated with every version update. 6. Run compilation and installation in an isolated, unprivileged container or virtual machine with minimal credentials and filesystem access. 7. Do not execute the procedure with administrator privileges. 8. Where practical, use a trusted, version-pinned binary artifact with hash verification instead of compiling arbitrary current source. 9. Document provenance information, including the reviewed release, commit identifier, expected checksum, and compatible CUDA version.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill includes instructions to push a merged fine-tuned model to the Hugging Face Hub, which is an external publication action, but it does so without any warning about disclosure risks. In a fine-tuning workflow, published artifacts may unintentionally expose proprietary model weights, licensed base-model derivatives, embedded secrets, or training-data leakage if users follow the example blindly.

Static analysis

No suspicious patterns detected.