T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/contacts.py:92
- Finding
- Undocumented Bulk Access to Sensitive Fastmail Contact Data<![CDATA[ ## Vulnerability Details **File Location**: `scripts/contacts.py`, lines 92–106 **Vulnerability Type**: Undeclared sensitive-data access that exceeds the Skill's documented email functionality **Risk Level**: Medium ### Vulnerable Code ```python def cmd_search(query): # Fetch all and filter client-side (JMAP Contacts search support varies) resp = _call([ ["ContactCard/query", {"accountId": None, "limit": 500}, "0"], ["ContactCard/get", {"accountId": None, "#ids": {"resultOf": "0", "name": "ContactCard/query", "path": "/ids"}, "properties": ["name", "emails", "phones", "organizations"]}, "1"] ]) contacts = resp["methodResponses"][1][1]["list"] q = query.lower() results = [] for c in contacts: full, emails, phones, org = _format_contact(c) haystack = " ".join([full, org] + emails + phones).lower() ``` The same utility can retrieve additional sensitive fields, including addresses and notes, when a specific contact is requested: ```python for v in c.get("addresses", {}).values(): parts = [v.get("street",""), v.get("locality",""), v.get("region",""), v.get("country","")] addr = ", ".join(p for p in parts if p) if addr: print(f"Addr: {addr}") if c.get("notes"): for v in c["notes"].values(): print(f"Notes: {v.get('note','')}") ``` ### Technical Analysis The declared Skill functionality in `SKILL.md` is Fastmail email management: reading, searching, sending, moving, marking, and trashing email. Its documented token scopes are Email and Email Submission. However, the package also contains `scripts/contacts.py`, which requires Contacts scope and can access names, email addresses, telephone numbers, organizations, postal addresses, and free-form contact notes. The contacts capability is not documented in the Skill's command list or its file inventory. In particular, `cmd_search` does not perform a narrow ...[truncated 2323 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `scripts/contacts.py` from this email-only Skill if contact access is not required for its declared functionality. 2. If contact support is intentional, document it prominently in `SKILL.md`, including: - All contacts commands - The categories of personal data retrieved - The separate Contacts scope requirement - The fact that search may currently retrieve hundreds of records 3. Require a separately issued Contacts-only token rather than encouraging one token with Email, Email Submission, and Contacts permissions. 4. Use Fastmail-supported server-side filtering where available instead of downloading up to 500 complete contact records. 5. Request only fields needed for the active operation. For example, an email-address lookup should not retrieve telephone numbers, organizations, addresses, or notes. 6. Add explicit user confirmation before bulk listing or searching contacts when commands are invoked by an autonomous agent. 7. Provide structured output modes that redact sensitive values by default and expose complete contact data only through an explicit flag. 8. Warn users that command output may enter agent context or logs and recommend appropriate retention and access controls. ]]>
