T09 · Insecure Skill Coding Practices
Warning
- Location
- final_tripit_ical.py:87
- Finding
- Unrestricted Feed URL Enables Server-Side Request Forgery and Insecure Transport## Vulnerability Details **File Location**: `final_tripit_ical.py`, lines 87–104 **Vulnerability Type**: Unrestricted outbound request destination **Risk Level**: Medium **Vulnerable Code**: ```python def get_feed_url(cli_url: Optional[str]) -> str: if cli_url and cli_url.strip(): return cli_url.strip() env_url = get_env_value("TRIPIT_ICAL_URL") if env_url: return env_url raise ValueError( "Missing TripIt iCal URL. Pass it as an argument or set TRIPIT_ICAL_URL in the environment or ~/.openclaw/.env." ) def fetch_ics(url: str) -> str: response = requests.get( url, headers={"User-Agent": "TripIt-iCal-Skill/1.1"}, timeout=30, ) response.raise_for_status() return response.text ``` ### Technical Analysis The script accepts a URL from either its first command-line argument or an environment configuration without validating its scheme, hostname, resolved IP address, port, or path. Although the Skill is declared to retrieve a private TripIt iCalendar feed, the implementation can issue an HTTP request to any destination accepted by `requests`. This creates a server-side request forgery condition when an attacker can influence the argument or `TRIPIT_ICAL_URL`. Potential destinations include loopback interfaces, private network services, link-local addresses, and cloud instance metadata endpoints. In addition, `requests` follows redirects by default, so an initially acceptable destination could redirect to a restricted address unless every redirect target is revalidated. Plain HTTP URLs are also accepted. A private TripIt feed URL acts as a bearer credential and the feed contains sensitive itinerary information; using cleartext transport can expose both to interception or modification. ### Attack Path 1. An attacker influences the command-line feed argument, environment variable, or an accepted `.env` file. 2. The atta ...[truncated 1186 chars]
- Remediation
- ## Remediation Suggestions - Require the `https` scheme and reject URLs containing unsupported schemes, embedded user information, or unexpected ports. - Allowlist the official TripIt feed hostnames and expected path structure if this Skill is intended exclusively for TripIt. - Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and unspecified addresses for both IPv4 and IPv6. - Disable redirects with `allow_redirects=False`, or manually follow redirects while applying the same scheme, hostname, and resolved-address validation to every destination. - Consider binding the configured URL through trusted OpenClaw configuration rather than accepting an arbitrary positional argument. - Apply an appropriate response-size limit before parsing the calendar.
