T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/smart_scheduler.py:182
- Finding
- Unescaped User-Controlled Values Permit ICS Content Injection## Vulnerability Details **File Location**: `scripts/smart_scheduler.py`, lines 182-195 **Vulnerability Type**: ICS content injection through insufficient output encoding **Risk Level**: Medium ### Vulnerable Code ```python contents = "\n".join( [ "BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//OpenClaw Skill Suite//Smart Scheduler//EN", "BEGIN:VEVENT", f"UID:request-{args.request_id}@openclaw-skill-suite", f"SUMMARY:{booking['title']}", f"DTSTART;TZID={booking['timezone']}:{booking['chosen_start'].replace('-', '').replace(':', '')}", f"DTEND;TZID={booking['timezone']}:{booking['chosen_end'].replace('-', '').replace(':', '')}", f"DESCRIPTION:Organized by {booking['organizer']}; confirmed by {booking['confirmed_by']}", f"LOCATION:{booking['location'] or ''}", "END:VEVENT", "END:VCALENDAR", "", ] ) ``` ### Technical Analysis The ICS document is constructed by directly interpolating database values into RFC 5545 properties. Values such as the meeting title, organizer, timezone, location, confirmed participant, and proposed timestamps originate from command-line input and are not safely validated or encoded before serialization. RFC 5545 text values require escaping of backslashes, commas, semicolons, and newlines. Carriage-return or newline characters are particularly dangerous because they can terminate the intended property and introduce additional calendar properties or components. The timezone is inserted into a property parameter and requires stricter validation rather than ordinary text escaping. An attacker who can influence scheduling data could inject content such as additional event properties, attendees, alarms, or extra calendar components. The exact behavior after import depends on the ...[truncated 1236 chars]
- Remediation
- ## Remediation Suggestions - Use a maintained RFC 5545 serialization library instead of manually concatenating ICS lines. - Escape text-property values according to RFC 5545, including backslashes, commas, semicolons, carriage returns, and newlines. - Reject all CR and LF characters in property parameters such as `TZID`. - Validate timezone identifiers against an approved IANA timezone database. - Parse proposed start and end values as date-time objects, verify that the end follows the start, and serialize them into a canonical ICS representation. - Apply RFC-compliant line folding where necessary. - Add tests covering CRLF injection and reserved characters in every exported field, including title, organizer, confirmer, location, timezone, and timestamps.
