T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_spotify_news.py:119- Finding
Configuration-controlled outbound requests enable server-side request forgery
- Content
View full analysis
List[Dict]: keyword = source.get('keyword_filter', '').lower() resp = requests.get( source['url'], timeout=self.timeout, headers=HEADERS, verify=True, # Explicit: TLS verification ON ) resp.raise_for_status() ``` The Hacker News API path uses the same unrestricted configuration value: ```python def _fetch_hn(self, source: Dict, cutoff: datetime) -> List[Dict]: resp = requests.get( source['url'], timeout=self.timeout, headers=HEADERS, verify=True, # Explicit: TLS verification ON ) data = resp.json() ``` ### Technical Analysis The request destination is read directly from `sources.json` and passed to `requests.get()` without validating: - The URL scheme - The destination hostname - The resolved IP address - Redirect destinations - Whether the destination is loopback, link-local, private, or reserved TLS verification protects connection authenticity for HTTPS destinations, but it does not prevent requests to unauthorized destinations. The `ALLOWED_DDG_DOMAINS` restriction only filters links returned by DuckDuckGo; it is not applied to RSS or API requests. In addition, `requests.get()` follows redirects by default. A public source can therefore redirect the fetcher to an internal service unless every redirect hop is separately validated. ### Attack Path 1. An attacker causes a crafted source to be added to `config/sources.json`, such as an internal HTTP service, loopback address, or cloud metadata endpoint. This may occur through configuration modification or an unsafe custom-source workflow. 2. Alternatively, an existing public sou ...[truncated 1164 chars]- Remediation
View remediation
