Back to skill

Security audit

Save Video

Security checks for vulnerabilities and agentic risk

Overview

The skill is a straightforward video downloader, but it accepts arbitrary web URLs and saves remote content locally without enough scoping or safeguards.

Install only if you are comfortable with the agent making outbound requests and writing downloaded media under a local videos directory. Prefer running it in a restricted environment, use only trusted public video URLs, and consider requiring an allowlist of supported video sites plus a pinned yt-dlp version before broad use.

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)

T09 · Insecure Skill Coding Practices

Error
Location
save_video.py:5
Finding

Unrestricted User-Controlled URL Enables Server-Side Request Forgery

Content
View full analysis

Vulnerability Details

File Location: save_video.py, lines 5-22
Vulnerability Type: Unrestricted outbound request / Server-Side Request Forgery (SSRF)
Risk Level: High

Vulnerable Code

python
def extract_url(text):
    url_pattern = r'https?://[^\s]+'
    urls = re.findall(url_pattern, text)
    return urls[0] if urls else None

def download_video(url):
    try:
        output_dir = os.path.join(os.getcwd(), "videos")
        os.makedirs(output_dir, exist_ok=True)
        
        command = [
            sys.executable, "-m", "yt_dlp",
            "--format", "best",
            "--output", os.path.join(output_dir, "%(title)s.%(ext)s"),
            url
        ]
        
        subprocess.run(command, check=True)
        return f"Video downloaded successfully to {output_dir}"
    except Exception as e:
        return f"Error downloading video: {str(e)}"

Technical Analysis

The regular expression accepts the first arbitrary HTTP or HTTPS URL in user-controlled input. The application performs no validation of the URL hostname, resolved IP address, port, redirect destination, or protocol transition before passing it to yt_dlp.

Because yt_dlp performs outbound network requests on behalf of the process, an attacker can provide URLs targeting resources that are inaccessible from the attacker's own network position but reachable from the host running this skill. Potential targets include loopback services, RFC 1918 private networks, link-local addresses, container or orchestration control endpoints, and cloud instance metadata services.

Using a subprocess argument list without shell=True prevents direct shell metacharacter injection here, but it does not prevent SSRF because the URL remains an attacker-controlled network destination.

Attack Path

  1. An attacker submits text containing an HTTP or HTTPS URL that refers to an internal or otherwise privileged netw ...[truncated 1299 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce an explicit allowlist of supported video-service hostnames rather than accepting arbitrary HTTP or HTTPS destinations.
  2. Parse URLs with urllib.parse.urlsplit() and reject malformed URLs, embedded credentials, unsupported schemes, unexpected ports, and ambiguous host representations.
  3. Resolve the hostname before making a request and reject all loopback, private, link-local, multicast, unspecified, reserved, and otherwise non-global IPv4 and IPv6 addresses.
  4. Protect against DNS rebinding by ensuring the address actually used for the connection is one of the previously validated addresses.
  5. Disable redirects where practical. If redirects are required, apply the same scheme, hostname, port, and resolved-address validation to every redirect destination.
  6. Block known metadata endpoints at both application and network layers, including link-local metadata addresses.
  7. Run the downloader in a restricted environment with outbound network filtering, no access to sensitive internal services, minimal filesystem permissions, and strict resource limits.
  8. Add automated tests covering loopback addresses, private IPv4 and IPv6 ranges, encoded IP representations, malicious redirects, DNS rebinding scenarios, and unsupported domains.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned Third-Party Dependency Produces Non-Reproducible and Unsafe Builds

Content
View full analysis

Vulnerability Details

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

Vulnerable Code

text
yt-dlp

Technical Analysis

The dependency is declared without an exact version or integrity hash. Each installation can therefore resolve to whichever yt-dlp release the configured package index currently considers appropriate.

This prevents reproducible builds and makes the security properties of the deployed skill differ from those of the reviewed source tree. A future compromised, malicious, or vulnerable package release could be downloaded and installed without any project change. Python package installation can execute package build logic, while the installed dependency is subsequently executed directly through:

python
command = [
    sys.executable, "-m", "yt_dlp",
    "--format", "best",
    "--output", os.path.join(output_dir, "%(title)s.%(ext)s"),
    url
]

No evidence in the audited files establishes that the current yt-dlp package is malicious. The confirmed weakness is the absence of version and artifact integrity controls.

Attack Path

  1. A deployment or user installs dependencies using requirements.txt.
  2. The package installer queries the configured package repository and resolves an unconstrained yt-dlp version.
  3. If the selected release or repository is compromised, its build or installation logic may execute during installation.
  4. When the skill downloads a video, python -m yt_dlp executes the installed package in the skill process's security context.
  5. A malicious dependency could access files and credentials available to that process, make network requests, alter downloaded content, or execute additional commands.

Impact Assessment

A compromised resolved dependency would generally execute with the same operating-system identity, filesystem permissions, environment a ...[truncated 533 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin yt-dlp to an exact version that has been reviewed and tested, for example with an exact == constraint.
  2. Generate a lock file containing cryptographic hashes for all direct and transitive artifacts.
  3. Install with hash verification enabled, such as pip install --require-hashes -r requirements.txt.
  4. Use a trusted, controlled package index and prohibit unapproved fallback indexes.
  5. Perform dependency vulnerability and provenance scanning in CI before updating the pinned release.
  6. Review and update the pin regularly rather than relying indefinitely on an obsolete version.
  7. Build dependencies in an isolated, unprivileged environment and deploy immutable reviewed artifacts to production.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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 (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly states it will download content and save it to the local directory, but it does not warn the user that local file writes will occur or describe where files will be stored. This can lead to unexpected persistence of downloaded media, storage misuse, or accidental handling of untrusted content on disk, especially because the workflow is presented as automatic and immediate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This skill downloads remote content and writes files to disk without any user-facing disclosure, confirmation, or constraint on what source will be fetched. In an agent setting, that can lead to unexpected network access, storage consumption, and retrieval of untrusted media from attacker-controlled URLs, making the behavior riskier than a normal local utility script.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · save_video.py (reported line 23)May include surrounding context.

python
url
        ]
        
        subprocess.run(command, check=True)
        return f"Video downloaded successfully to {output_dir}"
    except Exception as e:
        return f"Error downloading video: {str(e)}"

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
99% confidence
Finding

The dependency is specified as plain yt-dlp without an exact version pin, which makes builds non-reproducible and can cause the environment to install a newly introduced vulnerable or breaking release. In a security context this is a real supply-chain weakness because the actual package version cannot be verified or audited reliably.

Content

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

text
yt-dlp

Unverifiable Dependency: yt-dlp has 16 known advisory(ies) (CVE-2023-46121 (yt-dlp Generic Extractor MITM Vulnerability via Arbitrary Proxy Injection); GHSA-3v33-3wmw-3785 (yt-dlp has dependency on potentially malicious third-party code in Douyu extract); CVE-2023-40581 ( yt-dlp on Windows vulnerable to `--exec` command injection when using `%q`) +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
95% confidence
Finding

yt-dlp has multiple known advisories, and because the manifest does not pin a version there is no way to determine whether installation will resolve to an affected release. This increases risk because a vulnerable version could be pulled at install time, exposing the skill to known issues such as command injection or unsafe third-party extractor behavior depending on how the package is used.

Content

No source excerpt is available for this finding.