T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/extract_transcript.py:87
- Finding
- TLS Certificate Verification Disabled for yt-dlp Network Requests<![CDATA[ ## Vulnerability Details **File Location**: `scripts/extract_transcript.py:79-91` **Vulnerability Type**: Improper certificate validation **Risk Level**: High ### Vulnerable Code ```python self.ydl_opts = { 'writesubtitles': True, 'writeannotations': True, 'writeautomaticsub': True, 'subtitleslangs': ['en', 'en-US', 'en-CA'], 'skip_download': True, 'quiet': False, 'no_warnings': False, 'no_playlist': True, # Enhanced reliability (from user's yt-dlp config) 'nocheckcertificate': True, # Bypass SSL issues 'retries': 100, 'fragment_retries': 100, 'continuedl': True, } ``` ### Technical Analysis The `nocheckcertificate` option instructs `yt-dlp` not to validate TLS certificates. HTTPS encryption without certificate validation does not securely authenticate the remote server. An attacker capable of intercepting network traffic can present an arbitrary certificate and impersonate a YouTube or related media endpoint. The setting applies to the `yt-dlp` operations that retrieve video metadata and caption information. When the optional cookie file is configured, authenticated requests may include sensitive session cookies. Disabling certificate validation therefore increases the potential impact beyond transcript manipulation and may expose authentication material to a network-positioned attacker. The separate caption download performed through `requests.get()` retains default certificate verification, but that does not protect the preceding `yt-dlp` metadata and caption-discovery requests. ### Attack Path 1. A user runs the transcript extraction script while connected through a network controlled or monitored by an attacker. 2. The script invokes `yt-dlp` with `nocheckcertificate` enabled. 3. The attacker intercepts a TLS connection to a YouTube-related endpoint and supplies an untrusted certificate. 4. Because certificate validation is disabled, `yt-dlp` accepts the attacker's endpoint. 5. The a ...[truncated 1050 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the insecure option entirely or explicitly enable certificate verification: ```python self.ydl_opts = { 'writesubtitles': True, 'writeannotations': True, 'writeautomaticsub': True, 'subtitleslangs': ['en', 'en-US', 'en-CA'], 'skip_download': True, 'quiet': False, 'no_warnings': False, 'no_playlist': True, 'retries': 100, 'fragment_retries': 100, 'continuedl': True, } ``` 2. Correct certificate-store failures instead of bypassing verification. Install or configure an appropriate CA bundle for the operating environment. 3. Do not offer an insecure fallback that silently disables verification. 4. Protect cookie files with restrictive filesystem permissions and use narrowly scoped, temporary cookies where possible. 5. Add a security regression test that verifies `nocheckcertificate` is absent or false. 6. Document failures caused by invalid certificates as security errors rather than generic connectivity problems. ]]>
