T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/yt_search.py:237- Finding
Automatic Browser Cookie Access Exceeds Least-Privilege Requirements
- Content
View full analysis
Vulnerability Details
File Location:
scripts/yt_search.py:237-242; related instructions inSKILL.md:145-150, 180-199
Vulnerability Type: Automatic access to sensitive browser authentication data
Risk Level: MediumCode Snippet:
python cmd_parts = ["yt-dlp"] # Try to use browser cookies for age-restricted or region-locked videos for browser in ["chrome", "firefox", "safari"]: if shutil.which(browser) or os.path.exists(f"/Applications/{browser.capitalize()}.app"): cmd_parts += ["--cookies-from-browser", browser] breakThe documentation also repeatedly directs the agent to use browser cookies:
bash yt-dlp --cookies-from-browser chrome \ --write-auto-sub --write-sub \ --sub-lang en,zh-Hans \ --convert-subs srt \ --skip-download \ -o "~/Downloads/%(title)s.%(ext)s" \ "VIDEO_URL"Technical Analysis
The download implementation automatically passes
--cookies-from-browsertoyt-dlpwhenever Chrome, Firefox, or Safari appears to be installed. Browser cookies are sensitive authentication material that can provide access to logged-in sessions, account-specific content, subscription data, and other authenticated platform features.Reading browser cookies can be necessary for explicitly requested age-restricted, private, or region-restricted content. It is not necessary for ordinary public video or subtitle downloads. Applying this behavior to every download therefore violates least privilege.
The subprocess call uses an argument list rather than
shell=True, so the reviewed code does not expose a direct shell-command injection path. The risk instead arises because a third-party executable receives access to browser credential storage without an explicit user decision for each operation.Attack Path
- A user asks the Skill to download a public video, audio track, or subtitle.
- The Skill checks whether a supported browser app ...[truncated 1008 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove automatic browser-cookie detection from the default download path.
- Add an explicit option such as
--browser-cookies chromethat is disabled by default. - Display a clear warning before cookie access, including which browser profile will be read and why authenticated access is required.
- Attempt unauthenticated downloads first and request cookie access only when the platform reports that authentication is necessary.
- Prefer a dedicated, low-privilege browser profile containing only the minimum session data required for video access.
- Where practical, support an explicitly supplied cookie file with restrictive filesystem permissions rather than reading the user's primary browser profile.
- Validate download URLs against an allowlist of supported HTTPS platform domains before enabling authenticated requests.
- Update
SKILL.mdso that subtitle and playlist examples do not enable browser cookies by default. - Pin and verify the
yt-dlpinstallation because the process is being entrusted with sensitive authentication material.
