T08 · Insecure Dependencies
- Location
send_email.py:9- Finding
Unpinned Third-Party Dependencies Are Installed and Executed at Runtime
- Content
View full analysis
Vulnerability Details
File Location:
send_email.py:9-13andsend_email.py:50-53
Vulnerability Type: Runtime installation of unpinned dependencies
Risk Level: MediumVulnerable Code
python try: import requests except ImportError: os.system(f"{sys.executable} -m pip install requests -q") import requestspython try: from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes # type: ignore except ImportError: os.system(f"{sys.executable} -m pip install cryptography -q") from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes # type: ignoreTechnical Analysis
When either dependency is unavailable, the Skill invokes
pipautomatically and installs the latest package version selected by the active package-index configuration. No version constraint, package hash, lockfile, trusted repository restriction, or explicit user approval is applied.Python package installation can execute package build and installation logic. Consequently, runtime dependency installation introduces a mutable remote supply-chain execution path that is not necessary for the Skill's core email-sending operation. Although the package names shown are legitimate, compromise of the package repository, configured index, dependency chain, network path, or selected package release could cause attacker-controlled code to execute.
The use of
os.systemdoes not create a direct command-injection issue here becausesys.executableis not derived from a command-line argument. The primary issue is automatic installation and execution of unpinned remote dependencies.Attack Path
- The Skill runs in an environment where
requestsorcryptographyis missing. - An attacker compromises a selected package release, a transitive dependency, the configured Python package index, or the package-resolution path.
- The exception handler automatic ...[truncated 956 chars]
- The Skill runs in an environment where
- Remediation
View remediation
Remediation Suggestions
- Remove all runtime
pip installcalls fromsend_email.py. - Declare dependencies in a dedicated manifest and lock them to reviewed versions.
- Require hash verification, such as a fully pinned requirements file installed with
pip --require-hashes. - Install dependencies during an explicit, trusted deployment phase rather than during Skill execution.
- Use an isolated virtual environment with only the packages required by this Skill.
- Configure a trusted package repository and retain dependency provenance or integrity metadata.
- If a dependency is unavailable at runtime, terminate with a clear error instead of downloading executable code automatically.
- Remove all runtime
