T08 · Insecure Dependencies
- Location
scripts/download.py:19- Finding
Automatic Installation of an Unpinned Third-Party Dependency
- Content
View full analysis
Vulnerability Details
File Location:
scripts/download.py, lines 19-26
Vulnerability Type: Uncontrolled runtime dependency installation
Risk Level: MediumVulnerable Code
python def install_yt_dlp(): """Install yt-dlp.""" print("Installing yt-dlp...") try: subprocess.run(['pip', 'install', 'yt-dlp'], check=True) return True except: print("Error: Could not install yt-dlp") return FalseThe vulnerable function is automatically reached through the following dependency check at lines 100-103:
python # Check dependencies if not check_dependencies(): if not install_yt_dlp(): return 1Technical Analysis
When
yt-dlpis not found, the script automatically invokespip install yt-dlp. It does not pin an approved version, verify a package hash, constrain the package index, or require explicit user confirmation.Consequently, the package selected at execution time may differ from the package that existed when the Skill was audited. Package resolution can also be influenced by pip configuration, environment variables, index configuration, or compromise of the upstream distribution channel. Python package installation may run package-controlled build or installation logic with the privileges of the user executing the Skill.
The script calls the
pipexecutable by name rather than usingsys.executable -m pip. This also creates ambiguity about which Python environment receives the dependency and relies on executable resolution through the process environment.Attack Path
- A user invokes
scripts/download.pyin an environment where theyt-dlpexecutable is unavailable or its version check fails. check_dependencies()returnsFalse.- The script automatically runs
pip install yt-dlpwithout asking for approval. - Pip resolves the latest available package through its active index and configuration, without a pinned version or verified hash.
- If pa ...[truncated 936 chars]
- A user invokes
- Remediation
View remediation
Remediation Suggestions
- Remove automatic dependency installation from normal runtime behavior. If
yt-dlpis unavailable, fail with a clear message and direct the user to an explicit installation process. - Declare
yt-dlpin a reviewed dependency manifest or lockfile and pin an approved version. - Use hash-verified installation, such as a requirements file containing exact versions and
--hashentries together withpip --require-hashes. - Install dependencies during a controlled build or deployment stage from a trusted, explicitly configured package index.
- Periodically review and update the pinned version through a controlled dependency-update process.
- If runtime installation is unavoidable, require explicit user confirmation, constrain the package source and version, verify integrity, and invoke pip through the intended interpreter:
python subprocess.run( [ sys.executable, "-m", "pip", "install", "--require-hashes", "-r", "requirements.txt", ], check=True, )- Run the Skill with least privilege and avoid executing it as an administrator or root user.
- Remove automatic dependency installation from normal runtime behavior. If
