Back to skill

Security audit

macOS Contacts

Security checks for vulnerabilities and agentic risk

Overview

This skill can read and change macOS Contacts, including deleting, merging, and restoring records, with safeguards that are too weak for its lower-risk description.

Install only if you are comfortable giving the skill authority over your local macOS Contacts, including update, delete, merge, and database restore workflows. Use it in a Review posture: prefer read/search and single-contact create operations, require explicit human confirmation before any update/delete/merge/restore, keep an independent Contacts backup, and avoid using the transaction, dedupe, or merge helpers until their scoping and input-safety issues are fixed.

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

Error
Location
scripts/contacts_dedupe.sh:16
Finding

Python Source Injection Through Unquoted Heredoc Interpolation

Content
View full analysis
/dev/null || echo '{"ok":false,"error":"rollback_failed"}')" python3 - <
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/contacts_backup.sh:9
Finding

Live SQLite File Copy Produces Unreliable Backups and Rollbacks

Content
View full analysis
/dev/null [ -f "$SRC/AddressBook-v22.abcddb-wal" ] && cp -av "$SRC/AddressBook-v22.abcddb-wal" "$DST/" >/dev/null || true [ -f "$SRC/AddressBook-v22.abcddb-shm" ] && cp -av "$SRC/AddressBook-v22.abcddb-shm" "$DST/" >/dev/null || true ``` `scripts/contacts_restore.sh:14-18`: ```bash osascript -e 'tell application "Contacts" to quit' >/dev/null 2>&1 || true sleep 1 cp -av "$BACKUP_DIR/AddressBook-v22.abcddb" "$SRC/AddressBook-v22.abcddb" >/dev/null [ -f "$BACKUP_DIR/AddressBook-v22.abcddb-wal" ] && cp -av "$BACKUP_DIR/AddressBook-v22.abcddb-wal" "$SRC/AddressBook-v22.abcddb-wal" >/dev/null || true [ -f "$BACKUP_DIR/AddressBook-v22.abcddb-shm" ] && cp -av "$BACKUP_DIR/AddressBook-v22.abcddb-shm" "$SRC/AddressBook-v22.abcddb-shm" >/dev/null || true ``` ### Technical Analysis The backup helper copies a live SQLite main database, WAL file, and shared-memory file as three independent filesystem operations. It does not obtain a database snapshot, checkpoint the WAL, lock the database, or stop the process responsible for maintaining the Contacts store. If the database changes between copies, the main database and WAL can represent different points in time. Copying the SHM file does not make this sequence atomic. Restore has a complementary flaw. If the selected backup does not contain a WAL or SHM file, the script leaves any existing destination sidecar in place. The restored main database can therefore be combined with a stale WAL or SHM file from a different database state. Quitting the Contacts UI is only best effort and does not establish that all database-owning background services have stopped. The script ...[truncated 1395 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/contacts_merge.swift:126
Finding

Merge Accepts Unrelated Identifiers and Deletes Unpreserved Contact Fields

Content
View full analysis
(ok: false, count: nil, item: nil, items: nil, applied: nil, error: "missing_keep")); exit(2) } let dropIds = args.enumerated().compactMap { idx, val in val == "--drop" && idx + 1 < args.count ? args[idx+1] : nil } if dropIds.isEmpty { printJSON(Envelope(ok: false, count: nil, item: nil, items: nil, applied: nil, error: "missing_drop")); exit(2) } let contacts = try allContacts() let mapped = contacts.map(mapContact) guard let keep = mapped.first(where: { $0.identifier == keepId }) else { printJSON(Envelope(ok: false, count: nil, item: nil, items: nil, applied: nil, error: "keep_not_found")); exit(2) } let originals = mapped.filter { [$0.identifier].contains(where: { _ in false }) } let allSet = mapped.filter { ([keepId] + dropIds).contains($0.identifier) } let merged = mergedContact(from: allSet, keep: keep) let current = try store.unifiedContact(withIdentifier: keepId, keysToFetch: keys) let mutable = current.mutableC ...[truncated 3473 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (41)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README advertises update, delete, merge/dedupe, backup/restore, and transactional mutation capabilities that exceed the stated skill scope of read/search/safely create contacts. This scope mismatch is dangerous because an agent or operator may rely on the README as authoritative usage guidance and invoke destructive operations that were not intended, reviewed, or permissioned under the published contract.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The design section explicitly describes native mutation paths, including Swift framework writes and AppleScript fallback, beyond the declared limited write scope. In an agent setting, undocumented alternate mutation paths increase risk because they can bypass user expectations and expand the effective attack surface for unauthorized or destructive contact changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The examples provide concrete commands for updating contacts and planning duplicate merges, which operationalizes behavior outside the stated read/search/create purpose. Executable examples are especially risky in agent ecosystems because they make misuse straightforward and can normalize destructive operations that users, orchestrators, or reviewers did not expect this skill to perform.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The README advertises update, delete, deduplication, merge, backup, and restore capabilities even though the declared skill scope is limited to read, search, and safe creation. This scope expansion is dangerous because operators or downstream agents may rely on the documentation and invoke destructive functionality that was not expected, reviewed, or consented to under the manifest, increasing the chance of unauthorized data modification or loss in a sensitive contacts datastore.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The transaction wrapper is documented as executing arbitrary commands supplied as arguments while also orchestrating backup and rollback. A skill marketed as simple contacts access should not silently include generic command-execution behavior, because that can be abused to run unintended shell commands under the guise of contact management.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest says the skill is limited to reading/searching and safe creation, but the body documents update, delete, dedupe, merge, backup, and restore operations. This security-documentation inconsistency is dangerous because it hides privileged and destructive behaviors behind a lower-risk description.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/contacts_applescript.py (reported line 24)May include surrounding context.

python
def cmd_exists(args):
    env = os.environ.copy()
    env.update({
        'FN': args.first_name or '',
        'LN': args.last_name or '',

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/contacts_applescript.py (reported line 81)May include surrounding context.

python
def cmd_exists(args):
    env = os.environ.copy()
    env.update({
        'FN': args.first_name or '',
        'LN': args.last_name or '',

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs destructive deletion of contacts via contacts_txn.sh ... delete --identifier, which exceeds the declared skill scope of read/search/create-only behavior. This creates a capability mismatch: callers or reviewers may trust the skill as non-destructive while it can permanently remove contact records, increasing the chance of unauthorized or accidental data loss.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs contact updates and deletions during apply-plan, which exceeds the skill metadata's stated write scope of 'safely create contacts'. This mismatch is dangerous because an agent or user relying on the manifest could grant or invoke the skill expecting additive-only behavior, while the code can irreversibly alter and remove existing sensitive records.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script executes a CNSaveRequest that updates one contact and deletes others without any in-script confirmation, approval gate, or rollback support. Because duplicate detection is heuristic and merge content is synthesized, a mistaken or manipulated invocation could silently destroy contact data and merge incorrect phone/email fields into the wrong record.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script directly overwrites the macOS Contacts SQLite database and related WAL/SHM files in the live AddressBook directory. This exceeds the declared read/search/create scope of the skill and can destroy or replace a user's local contacts data, enabling data loss or unauthorized rollback/injection of contact records if the backup source is untrusted or incorrect.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The restore operation overwrites local Contacts database files in place with no confirmation, preview, or warning about destructive consequences. In the context of a skill advertised as safe contact access and contact creation, this makes accidental or unauthorized data replacement especially dangerous because users would not reasonably expect a full database restore side effect.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill metadata says it is for reading, searching, verifying existence, and safely creating contacts, but the code also exposes full update and delete operations. This hidden capability materially expands the skill’s authority beyond user and orchestrator expectations, increasing the risk of unauthorized modification or destruction of a user’s address book if the skill is invoked or routed based on its declared purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Delete support is especially risky because it enables irreversible destruction of personal data while being absent from the stated skill purpose. In an agent setting, undisclosed destructive functionality is dangerous because higher-level policy may permit this skill for benign contact lookup/creation tasks without anticipating silent deletion capability.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The wrapper executes whatever command and arguments are passed via "$@" with the script's privileges, rather than restricting execution to a specific Contacts write helper. In an agent skill context, this creates a generic command-execution primitive that can be abused to run unrelated programs, access other data, or trigger side effects far beyond contact creation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The document states that writes must not directly modify the macOS contacts SQLite database, but it also documents restore and dedupe scripts that operate on contacts database/files outside the supported API path. That inconsistency can lead users or agents to bypass system safeguards, potentially corrupting the contacts store, violating platform expectations, or restoring stale/malicious data into a sensitive local database.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README presents deletion and merge commands for contacts without an explicit warning that these actions are destructive and may be irreversible or lossy despite backup tooling. In the context of a production-grade contacts skill handling personal data, omission of confirmation requirements materially increases the risk of accidental bulk deletion, incorrect merges, and privacy-impacting data loss by human users or autonomous agents.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill advertises broad capabilities that imply shell, file access, and potentially network use, but it does not declare an explicit tool scope such as allowed-tools or permissions. That creates an avoidable trust gap: an agent may grant more capability than the manifest communicates, increasing the chance of unintended command execution or filesystem modification during contact operations.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

This skill operates on the user's persistent macOS Contacts database, which is a long-lived personal data store. Any create, update, delete, backup, dedupe, or restore action affects durable state and can expose or alter sensitive personal information beyond the current session.

Content

Scanner excerpt · SKILL.md (reported line 3)May include surrounding context.

md
---
name: macos-contacts
description: Read, search, and safely create contacts in macOS Contacts (Address Book). Use when the user asks to inspect the native macOS contacts database, search contacts by name/phone/email/company, verify whether a contact exists, or add a new contact to Apple Contacts. Prefer this skill for production-grade contact access on macOS. Use SQLite for read-heavy search/list operations and AppleScript for writes, so reads stay fast and writes stay on supported system APIs.
---

# macOS Contacts

Static analysis

No suspicious patterns detected.