T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/rss_fetcher.py:39
- Finding
- RSS downloads disable TLS certificate verification<![CDATA[ ## Vulnerability Details **File Location**: `scripts/rss_fetcher.py:39-52` **Vulnerability Type**: Improper certificate validation **Risk Level**: High ### Vulnerable Code ```python # Use requests or urllib to retrieve RSS content if HAS_REQUESTS: response = requests.get(url, timeout=30, verify=False, headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' }) rss_content = response.text else: import ssl context = ssl._create_unverified_context() req = urllib.request.Request(url, headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' }) with urllib.request.urlopen(req, context=context, timeout=30) as f: rss_content = f.read().decode('utf-8') ``` ### Technical Analysis Both supported HTTP implementations explicitly disable server-certificate verification. `requests.get(..., verify=False)` accepts an untrusted certificate, while `ssl._create_unverified_context()` disables equivalent checks in the urllib fallback. TLS authentication is necessary even when the retrieved information is public because the RSS response is treated as trusted report input. A network-positioned attacker could impersonate an RSS server and provide forged titles, links, authors, and summaries. These values are subsequently parsed and included in generated reports. The code also does not call `response.raise_for_status()`, meaning HTTP error bodies can be treated as RSS input. ### Attack Path 1. The crawler invokes `rss_fetcher.py` for an HTTPS RSS endpoint. 2. An attacker gains a network interception position, such as through a malicious access point, compromised proxy, or DNS/network infrastructure. 3. The attacker presents an arbitrary certificate and returns a forged RSS document. 4. The helper accepts the certificate because validation is disabled. 5. Attacker-controlled article metadata is parsed and returned to the crawler. 6. The malicious titles, ...[truncated 430 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove `verify=False` and use the default verified TLS configuration. - Remove `ssl._create_unverified_context()` and use `ssl.create_default_context()`. - Call `response.raise_for_status()` before parsing the response body. - Restrict RSS retrieval to an explicit allowlist of expected HTTPS hosts. - Validate redirect destinations and reject redirects to loopback, private, link-local, or otherwise unexpected addresses. - Apply a reasonable response-size limit before parsing RSS data. - If a site has a certificate problem, fix its trust chain or configure a narrowly scoped custom CA bundle rather than globally disabling verification. ]]>
