Back to skill

Security audit

Huggingface Hub

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward Hugging Face Hub helper, but users should treat uploads and the HF token carefully.

Install only if you are comfortable giving the skill access to a Hugging Face token and using it to transfer files. Use a minimally scoped HF token, avoid uploading sensitive local files, double-check repo IDs before upload, and consider pinning huggingface_hub in your environment.

Vulnerability Patterns
  • 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
  • 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 (1)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:15
Finding
Unpinned Third-Party Dependency Installation## Vulnerability Details **File Location**: `SKILL.md`, lines 15–18 **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Medium ```markdown Install the library: ```bash pip install huggingface_hub ``` ``` ### Technical Analysis The installation command retrieves `huggingface_hub` without a version constraint, lockfile, or cryptographic hash verification. Consequently, the installed package and its transitive dependencies may differ from the versions reviewed during this audit. This creates supply-chain exposure because a compromised, malicious, or unexpectedly incompatible future release could execute code during package installation or when `scripts/hf_hub.py` imports the package. The package name itself is legitimate and no current package compromise was established; the finding concerns the mutable and unverified installation process. ### Attack Path 1. An attacker compromises a future release of `huggingface_hub` or one of its transitive dependencies. 2. A user follows the prerequisite command in `SKILL.md`. 3. `pip` resolves and installs the mutable latest package release. 4. Malicious package code executes during installation or when `scripts/hf_hub.py` imports `huggingface_hub`. 5. The code runs with the permissions of the user executing the installation or skill. ### Impact Assessment Successful exploitation could permit arbitrary code execution within the installing user's privilege boundary. Depending on that user's permissions, the malicious dependency could access local files, environment variables such as `HF_TOKEN`, the fallback token file if readable, network resources, and Hugging Face repositories authorized by the token. No privilege escalation beyond the executing user's existing permissions is demonstrated by the audited project.
Remediation
## Remediation Suggestions - Pin `huggingface_hub` to a reviewed exact version rather than installing an unconstrained latest release. - Record and pin all transitive dependencies in a lockfile. - Require cryptographic hashes during installation, such as through a hash-locked requirements file and `pip install --require-hashes`. - Explicitly use the official Python package index or an organization-controlled package mirror. - Automate dependency vulnerability and provenance checks before updating pinned versions. - Review and test dependency upgrades before changing the lockfile.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The skill documents capabilities that rely on environment access for `HF_TOKEN` and local file access for upload/download behavior, but it declares no explicit tool scope or permissions boundary. This creates a trust gap where an agent may use broader-than-expected capabilities without clear user visibility or policy enforcement.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs users to store an HF access token and supports network operations such as upload/download, but it does not warn that the token is sensitive or that data may be transmitted to external services. This increases the risk of accidental credential exposure or unintended transfer of private data to Hugging Face repositories or APIs.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The documented `upload-file` capability can modify remote repository state and exfiltrate local files, yet the skill provides no explicit warning about these consequences. In an agent setting, that omission makes it easier for users to invoke destructive or privacy-impacting actions without informed consent.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The code reads an authentication token from the HF_TOKEN environment variable and falls back to /etc/secrets/HF_TOKEN, but there is no confirmation prompt, log message, or comment/docstring warning the user that credentials will be accessed automatically. This is a safety-relevant operation because it consumes sensitive credentials implicitly.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The whoami command makes an authenticated API call and prints personal account information including full name and email, but the code provides no prior warning that invoking this command will retrieve and display sensitive profile data. For code files, this kind of network/data-access behavior should have some visible disclosure unless explicitly documented.

Cloud Storage Exfiltration

Medium
Category
Data Exfiltration
Content
def cmd_upload_file(args):
    api = get_api()
    api.upload_file(
        path_or_fileobj=args.local_path,
        path_in_repo=args.path_in_repo or Path(args.local_path).name,
        repo_id=args.repo_id,
Confidence
84% confidence
Finding
This command can upload an arbitrary local file to a remote Hugging Face repository based solely on user-supplied arguments, creating a straightforward exfiltration channel if a higher-level agent is prompt-injected or tricked into selecting sensitive paths. In an agent skill context, file-upload primitives are more dangerous because they bridge local filesystem access and external network transfer without any guardrails, path restrictions, or confirmation.

Description-Behavior Mismatch

Low
Confidence
95% confidence
Finding
The manifest and command table describe listing, searching, downloading, uploading, and account info operations on Hugging Face Hub assets. However, the API reference additionally claims `InferenceClient` can be used to run inference on hosted models/spaces, which expands the described behavior beyond the implemented command surface shown in this file.

Static analysis

No suspicious patterns detected.