T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/chart_builder.py:38
- Finding
- Unrestricted Remote CSV Loading Enables Server-Side Request Forgery<![CDATA[ ## Vulnerability Details **File Location**: `scripts/chart_builder.py`, lines 38-40 **Vulnerability Type**: Server-Side Request Forgery (SSRF) through an unrestricted data-source URL **Risk Level**: Medium ### Vulnerable Code ```python elif 'csv' in s: df = pd.read_csv(s['csv'], parse_dates=[s.get('date_col', 'date')]) elif 'fred' in s: ``` ### Technical Analysis The value of `series[].csv` is passed directly to `pandas.read_csv`. Pandas accepts remote URLs, so an attacker who controls or influences the chart configuration can cause the process to send a request to an attacker-selected destination. The implementation does not validate: - The URL scheme - The destination hostname or resolved IP address - Loopback, private, link-local, or reserved network ranges - Cloud instance metadata addresses - Redirect destinations - The size or content type of the response The Skill documentation explicitly advertises URL-based CSV input, making remote fetching intended behavior, but the lack of destination restrictions turns that capability into an SSRF primitive. This issue does not retrieve or execute executable code and therefore is not classified as remote payload execution. ### Attack Path 1. An attacker supplies or influences a chart configuration. 2. The attacker sets `series[].csv` to an internal or otherwise restricted URL, such as a loopback service, private-network endpoint, or cloud metadata endpoint. 3. The Agent invokes the documented chart-generation command. 4. `pd.read_csv` sends a request from the runtime environment to the supplied destination. 5. If the response can be interpreted as CSV, its contents can be processed and potentially represented in the generated chart. Errors and behavioral differences may also reveal service reachability. ### Impact Assessment Exploitation uses the network privileges of the process running the Skill. Depending on its deployment environment, an attacker may be able to: - Probe services acces ...[truncated 519 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable remote CSV loading by default and require an explicit opt-in for network sources. 2. Parse remote locations with a strict URL parser and allow only approved schemes, preferably `https`. 3. Reject URLs containing credentials or ambiguous host representations. 4. Resolve the hostname and reject every address in loopback, private, link-local, multicast, unspecified, and reserved ranges. 5. Maintain an explicit allowlist of approved data hosts where practical. 6. Disable redirects or validate the destination after every redirect. 7. Apply connection and read timeouts, response-size limits, and content-type validation. 8. Enforce outbound network restrictions at the container or firewall layer as defense in depth. 9. Consider downloading approved data through a dedicated, restricted fetcher and passing a validated local file to pandas. ]]>
