Back to skill

Security audit

Icloud Calendar Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says in broad terms, but it handles iCloud credentials and calendar writes in ways users should review carefully before installing.

Review this before installing. Use only an Apple app-specific password, do not put credentials directly in source code, and be aware that the skill can write events to your iCloud Calendar and send event details to Apple's CalDAV service. The script should be fixed so help or invalid invocations never create calendar entries, and user-provided calendar text should be escaped or serialized with a proper iCalendar library.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/add_event.py:51
Finding
Unescaped User Input Permits iCalendar Content Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/add_event.py`, lines 51–66 **Vulnerability Type**: iCalendar content injection caused by unsafe serialization **Risk Level**: Medium ### Vulnerable Code ```python SUMMARY:{title} DESCRIPTION:{description} STATUS:CONFIRMED SEQUENCE:0 BEGIN:VALARM TRIGGER:-PT{alarm_minutes}M ACTION:DISPLAY DESCRIPTION:{title} END:VALARM BEGIN:VALARM TRIGGER:-PT5M ACTION:DISPLAY DESCRIPTION:马上开始: {title} ``` ### Technical Analysis The user-supplied `title` and `description` values are interpolated directly into an iCalendar document without RFC 5545 escaping or validation. iCalendar text fields require special handling for backslashes, commas, semicolons, and line breaks. An attacker who controls either argument can include newline characters followed by additional iCalendar properties or component delimiters. Depending on iCloud CalDAV parsing behavior, this may modify the generated event's semantics, inject extra alarms or properties, prematurely terminate a component, or cause malformed calendar data to be uploaded. The current script also lacks strict timestamp validation and uses manual string construction instead of a format-aware serializer. ### Attack Path 1. The attacker supplies or influences an event title or description processed by the Skill. 2. The value contains CR/LF characters followed by attacker-selected iCalendar directives. 3. `create_ics_event()` inserts the value directly into the `.ics` document. 4. `add_event_to_icloud()` submits the resulting document to the configured iCloud calendar through an authenticated CalDAV PUT request. 5. If accepted by the server, the injected directives alter calendar content beyond the intended title or description field. For example, an input containing a newline followed by additional `VALARM` or event properties could change event behavior rather than remaining ordinary text. ### Impact Assessment Exploitation is limited to the authenticated calendar ...[truncated 594 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Use a maintained iCalendar library rather than constructing calendar documents with string interpolation. 2. Escape all RFC 5545 text values, including backslashes, commas, semicolons, carriage returns, and line feeds. 3. Reject unexpected CR or LF characters in scalar fields such as the title. 4. Validate start and end timestamps against an explicit accepted format and ensure that the end time follows the start time. 5. Apply length limits to titles and descriptions. 6. Add tests using malicious values containing `\r`, `\n`, `BEGIN:`, `END:`, `VALARM`, commas, semicolons, and backslashes. 7. Confirm that the final serialized document contains exactly one intended `VEVENT` before transmission. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/add_event.py:142
Finding
Invalid Invocation Triggers an Unexpected Authenticated Calendar Write<![CDATA[ ## Vulnerability Details **File Location**: `scripts/add_event.py`, lines 142–155 **Vulnerability Type**: Unsafe default behavior and unintended external side effect **Risk Level**: Low ### Vulnerable Code ```python def main(): if len(sys.argv) < 3: print(__doc__) print("\nQuick demo - adding test event:") # Demo add now = datetime.now() start = now + timedelta(hours=2) end = start + timedelta(hours=1) add_event_to_icloud( "测试日程 - Test Event", start.strftime("%Y-%m-%dT%H:%M:%S"), end.strftime("%Y-%m-%dT%H:%M:%S"), "这是通过 OpenClaw 添加的测试日程" ) return ``` ### Technical Analysis Supplying too few arguments normally represents a usage error. Instead of terminating without side effects, the script is designed to create a test event using the configured iCloud credentials. This behavior violates least-surprise and minimum-operation principles. An accidental, malformed, or incomplete Agent invocation can result in an authenticated write to an external calendar even though the caller did not provide a valid event request. The reviewed version also has missing imports that currently cause execution errors on this path. Nevertheless, the explicit intended behavior is an external write, and it would become active if the import defects were corrected. ### Attack Path 1. The Skill is invoked with fewer than three command-line arguments. 2. The script interprets the malformed invocation as a request to run its demo. 3. It generates a test event scheduled two hours in the future. 4. It calls `add_event_to_icloud()` with the configured credentials. 5. The event is submitted to the hard-coded iCloud calendar path without explicit user confirmation. ### Impact Assessment The behavior can create unwanted calendar entries under the authority of the configured iCloud credential. Repeated malformed invocations could cause calendar clutter and un ...[truncated 209 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Treat insufficient arguments as an error: print usage information and exit with a nonzero status. 2. Move demonstration behavior behind an explicit `--demo` option. 3. Require clear user confirmation before a demo performs any external write. 4. Provide a `--dry-run` mode that prints the generated event without transmitting it. 5. Validate all arguments before loading credentials or initiating network activity. 6. Add automated tests confirming that malformed invocations never make network requests. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
README.md:25
Finding
Documentation Encourages Storing iCloud Credentials in Source Code<![CDATA[ ## Vulnerability Details **File Location**: `README.md`, lines 25–30 **Vulnerability Type**: Insecure credential-management guidance **Risk Level**: Low ### Vulnerable Documentation ```markdown Edit `scripts/add_event.py` and replace the credentials: ```python ICLOUD_EMAIL = "your-email@icloud.com" ICLOUD_PASSWORD = "your-app-specific-password" ``` ``` ### Technical Analysis The README instructs users to embed an iCloud email address and app-specific password directly in the Python source. This conflicts with the implemented credential-loading behavior and with `SKILL.md`, which recommends environment variables or a local `.env` file. Credentials stored in source are more likely to be committed to version control, copied into archives, exposed in reviews, or distributed with the Skill package. Removing a secret from the latest revision does not remove it from repository history. ### Attack Path 1. A user follows the README and places an iCloud app-specific password in `scripts/add_event.py`. 2. The modified file is committed, backed up, shared, logged, or packaged. 3. Another party obtains the source or repository history. 4. The party extracts the email address and app-specific password. 5. The exposed credential is used against Apple services within the permissions and restrictions applied to that credential. ### Impact Assessment Exposure may allow unauthorized use of the app-specific credential. The precise accessible services and operations depend on Apple's controls and the credential's effective permissions. Potential consequences include unauthorized calendar operations, disclosure or modification of data accessible through that credential, and the need to revoke and rotate the password. This issue does not itself grant local system privileges. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove all instructions recommending credentials be placed in source code. 2. Align `README.md` with `SKILL.md` and the actual implementation. 3. Recommend environment variables, a platform secret manager, or a local `.env` file excluded from version control. 4. Include a `.env.example` containing placeholders only. 5. Ensure `secrets/.env` is covered by `.gitignore`. 6. Recommend restrictive file permissions for local secret files. 7. Tell users to use an Apple app-specific password rather than their primary account password. 8. Document immediate revocation and rotation procedures for accidentally committed credentials. 9. Add secret-scanning checks to repository CI and pre-commit workflows. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The documented behavior does not fully match the reported code behavior: it accesses local credential files and environment variables without declared permissions, and may include automatic/demo execution paths not disclosed in the high-level description. Mismatches like this are dangerous because users may grant trust based on incomplete documentation while the code handles secrets or performs actions unexpectedly.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Usage: python3 add_event.py "Event Title" "2026-03-06T10:00:00" "2026-03-06T11:00:00" "Description"

Setup:
1. Copy secrets/.env.example to secrets/.env
2. Fill in your iCloud credentials in secrets/.env
"""
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# Load credentials from .env file
def load_credentials():
    env_path = os.path.join(os.path.dirname(__file__), '..', 'secrets', '.env')
    if os.path.exists(env_path):
        with open(env_path) as f:
            for line in f:
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The description says the skill adds events to iCloud Calendar but does not clearly warn that event titles, descriptions, and reminder metadata are transmitted to Apple's iCloud CalDAV service. This can cause users to unknowingly send sensitive personal or business scheduling data to a third-party cloud provider, creating privacy and compliance risk.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The README tells users to hardcode iCloud credentials directly into the script, which encourages insecure secret handling and makes accidental disclosure via source control, backups, logs, or screenshots much more likely. Because these are valid iCloud app-specific credentials tied to a real account, exposure can allow unauthorized calendar access and misuse of the connected Apple account capability.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill declares that it requires environment variables and performs network communication, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens reviewability and sandbox enforcement because consumers cannot clearly see or constrain the skill's access to secrets and outbound network use.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The manifest requires ICLOUD_EMAIL and ICLOUD_PASSWORD but does not present any user-facing warning that highly sensitive personal credentials are needed to operate the skill. This creates a real risk of users supplying primary iCloud credentials without understanding the trust boundary, account sensitivity, or need for safer alternatives such as app-specific passwords, increasing the chance of credential exposure or misuse.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
The documented usage implies the script adds an event only when called with the required arguments, but the actual help/error path triggers a test event creation. This mismatch increases the chance of accidental execution and makes the behavior deceptive from a safety perspective, especially because it uses stored credentials to write to a remote calendar.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This code sends event data and stored credentials to a remote CalDAV endpoint using an HTTP PUT request, which changes the user's calendar state. Although success and error messages are printed after the fact, there is no pre-action confirmation prompt or explicit warning before transmitting data and creating the event.

Description-Behavior Mismatch

Medium
Confidence
98% confidence
Finding
When invoked with too few arguments, the script does not stop after printing usage; instead it creates and uploads a demo event to the user's iCloud calendar. This is dangerous because a help or error path should never perform an authenticated write action, and an accidental invocation can cause unintended remote state changes without user consent.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The usage examples and natural-language invocation examples are written in Chinese, while the rest of the README is in English, which may signal an implicit language expectation for interacting with the skill. The file does not clarify that other languages are supported or that Chinese input is merely illustrative, so this creates a possible language/locale policy concern.

Vague Triggers

Low
Confidence
82% confidence
Finding
This manifest provides a broad capability description but does not specify when the skill should or should not be invoked, nor any limiting trigger context. Without explicit scope, an agent could match generic calendar-related requests too broadly.

Context-Inappropriate Capability

Low
Confidence
78% confidence
Finding
The manifest describes a calendar-writing skill, but does not mention credential-file or environment access as part of its scope. While authentication is needed for CalDAV, this code adds a local secret-loading capability that is not stated in the skill description and goes beyond the user-facing purpose.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The string literal "马上开始" forces a specific language for reminder content regardless of the user's locale or preference. The file does not offer a language selection mechanism or explain why Chinese-only output is required.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
When run with insufficient arguments, the script creates a demo event using mixed Chinese/English text and a Chinese description. This imposes a language choice on the user without any configuration, opt-in, or documented region-specific purpose.

Static analysis

No suspicious patterns detected.