Back to skill

Security audit

Find My iCloud CLI

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it claims, but it handles live family location data and has an unsafe state-file design that could execute commands if the stored username is tampered with.

Review before installing. Only use this with an Apple account and family devices you are authorized to locate, avoid exposing precise coordinates in logs or chat history, and fix the account.env handling so it is parsed as data rather than sourced as shell code. The state directory and files should also be permission-restricted.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/state.sh:10
Finding

Arbitrary Command Execution Through Unsafe Username State File Sourcing

Content
View full analysis
" >&2 exit 1 fi set_username "$username" echo "Stored Apple ID username: $username" ``` From `scripts/state.sh:10-13`: ```bash if [[ -f "$STATE_FILE" ]]; then # shellcheck disable=SC1090 source "$STATE_FILE" if [[ -n "${ICLOUD_FINDMY_USERNAME:-}" ]]; then ``` From `scripts/state.sh:22-27`: ```bash set_username() { local username="$1" ensure_state_dir cat > "$STATE_FILE" <
Remediation
View remediation
"$STATE_FILE" } get_username() { [[ -f "$STATE_FILE" ]] || return 1 local username IFS= read -r username < "$STATE_FILE" [[ -n "$username" ]] || return 1 printf '%s\n' "$username" } ``` 2. **Validate the input before storage.** Reject control characters, line breaks, NUL bytes, and values that do not conform to the expected Apple ID email format. Validation should supplement—not replace—removal of `source`. 3. **Protect state-file permissions.** Set a restrictive umask and explicitly enforce permissions: ```bash umask 077 mkdir -p "$STATE_DIR" chmod 700 "$STATE_DIR" printf '%s\n' "$username" > "$STATE_FILE" chmod 600 "$STATE_FILE" ``` 4. **Write state atomically.** Create a securely permissioned temporary file inside the state directory, write and validate the content, and then rename it over the destination. 5. **Avoid relying solely on shell escaping.** Although `printf '%q'` would reduce immediate exposure, treating the state file as executable shell code remains unnecessary and fragile. A non-executable data format is the preferred fix. 6. **Add regression tests** using values containing command substitutions, semicolons, quotes, backticks, variable expansions, and newline characters. Verify that retrieving a stored value never executes commands. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill invokes shell commands and reads/writes deterministic state files but does not declare any explicit tool scope or permissions boundary. In a skill that handles Apple account identifiers and precise device/family location data, missing scope metadata increases the chance of overbroad execution or unintended file/shell access by the agent runtime.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill is designed to retrieve highly sensitive real-time and family-shared location information, yet the description does not clearly warn about the sensitivity of this data or the need for careful disclosure. This can lead to accidental exposure of live locations, especially for family members, through normal use, logging, summaries, or misuse by an operator without appreciating the privacy risk.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/device-find.py (reported line 25)May include surrounding context.

python
raise SystemExit('Usage: device-find.py <device name substring>')
    needle = normalize(' '.join(sys.argv[1:]))
    username = load_username()
    result = subprocess.run(
        ['icloud', 'devices', 'list', '--username', username, '--with-family', '--locate', '--format', 'json'],
        check=True,
        capture_output=True,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/person-find.py (reported line 69)May include surrounding context.

python
raise SystemExit('Usage: device-find.py <device name substring>')
    needle = normalize(' '.join(sys.argv[1:]))
    username = load_username()
    result = subprocess.run(
        ['icloud', 'devices', 'list', '--username', username, '--with-family', '--locate', '--format', 'json'],
        check=True,
        capture_output=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script performs a live network lookup of Apple device and family-shared device locations and prints potentially sensitive location data without any runtime notice, confirmation, or scope restriction. In the context of a reusable agent skill, this increases privacy risk because invoking the skill may disclose or retrieve highly sensitive location information with minimal user friction.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script executes the state file with source, treating persistent data as shell code. If an attacker can modify account.env or influence its contents, arbitrary shell commands will run in the context of the user invoking the skill. In this skill's context, the file stores an Apple ID identifier and lives in a predictable per-user state path, so it should be handled strictly as data rather than executable content.

Content

No source excerpt is available for this finding.