Back to skill

Security audit

Mail Summary

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent Gmail-summary purpose, but it needs review because it stores Google access tokens, prints private email content, writes Calendar events, and starts ongoing token refresh with limited user control.

Install only if you are comfortable giving the skill Gmail read access and Calendar event-write access. Use it in a private environment, protect or delete the stored Google token files, revoke Google OAuth access when finished, avoid enabling the refresh service unless needed, and review Calendar events before allowing automatic creation.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/setup_auth.py:46
Finding

OAuth credentials and PKCE state are stored without restrictive file permissions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup_auth.py:43
Finding

OAuth callback is accepted without state validation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/setup_auth.py:80
Finding

OAuth setup synchronously launches an unnecessary perpetual refresh loop

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_emails.py:75
Finding

Private email content and metadata are exposed through console output and logs

Content
View full analysis
MAX_BODY_LENGTH: body = body[:MAX_BODY_LENGTH] + '...' emails.append({'subject': subject, 'from': sender, 'date': date, 'body': body}) logging.info(f"Email: from={sender}, subject={subject}, date={date}") ``` ```python for email in emails: print(f"From: {email['from']}") print(f"Date: {email['date']}") print(f"Subject: {email['subject']}") print(f"Body:\n{email['body']}") print("=" * 60) ``` ### Technical Analysis Processing email content is necessary for the Skill’s declared summarization functionality. However, the implementation prints the sender, date, subject, and up to 500 characters of each message body to standard output. It also logs sender, subject, and date at the default `INFO` level. Standard output and logs generated by agent frameworks, schedulers, process managers, terminals, or CI systems may be retained beyond the requested operation. Consequently, private email data can be copied into storage outside Gmail’s access controls. The metadata log is not required to produce the summary. Full console output is part of the current agent integration, but it should be treated as sensitive data transfer and minimized accordingly. ### Attack Path 1. The Skill accesses Gmail with the user’s authorized read-only token. 2. It fetches up to 50 messages from the configured lookback period. 3. Sender addresses, subjects, dates, and body excerpts are written to logs or standard output. 4. The hosting agent, scheduler, terminal logger, or process manager retains that output. 5. A user, operator, support account, or compromised log collector with access to retained output reads the private corresp ...[truncated 578 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/create_event.py:47
Finding

Calendar event creation does not enforce the documented duplicate-event check

Content
View full analysis
Remediation
View remediation
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
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (20)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/auth.py (reported line 38)May include surrounding context.

python
]

def find_credentials_file():
    cred_path = os.path.join(CREDENTIALS_DIR, 'credentials.json')
    if os.path.exists(cred_path):
        return cred_path
    matches = glob.glob(os.path.join(CREDENTIALS_DIR, 'client_secret_*.json'))

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/auth.py (reported line 46)May include surrounding context.

python
]

def find_credentials_file():
    cred_path = os.path.join(CREDENTIALS_DIR, 'credentials.json')
    if os.path.exists(cred_path):
        return cred_path
    matches = glob.glob(os.path.join(CREDENTIALS_DIR, 'client_secret_*.json'))

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The skill is designed to persist access to Gmail and Google Calendar over time, including auto-refreshing OAuth tokens and automatically creating calendar events based on email content. Persistent delegated access to sensitive communications and calendar data increases the blast radius if the skill, host agent, or stored tokens are compromised, and automatic actions can also create unwanted or manipulated events from malicious emails.

Content

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

md
---
name: mail-summary
description: Fetch Gmail emails from the last 24h, rank by importance, summarize into bullet points, and auto-create Google Calendar events for detected meetings.


# Email & Calendar Assistant Skill

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs users to send the OAuth client secret JSON and the full localhost redirect URL back through the agent without any explicit warning about the sensitivity of those artifacts or the breadth of Gmail/Calendar access being granted. This can expose OAuth credentials, authorization codes, and account metadata to the agent platform or logs, increasing the risk of account compromise or unintended retention of sensitive access material.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill is presented as a mail summarization tool but its normal behavior includes modifying a separate user resource: Google Calendar. This expands capability from read-only summarization to write actions, increasing the chance of surprising side effects, unwanted event creation, and privilege misuse if the user did not clearly consent to calendar changes.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
81% confidence
Finding

The instruction that the agent must run all setup commands itself encourages autonomous execution of environment setup and dependency installation without a user checkpoint. In a skill that later handles OAuth credentials and mailbox/calendar data, this reduces human oversight and can lead to unintended code execution or privilege use in the local environment.

Content

Scanner excerpt · agent/instructions.md (reported line 5)May include surrounding context.

md
## Setup Before First Use

> **The agent must run all commands below itself. Do NOT ask the user to run them.**

Before running any script, ensure the Python environment is ready:

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
84% confidence
Finding

The autonomous-command instruction applies to operational scripts that read full email contents and create calendar events, allowing the agent to take privacy-sensitive and state-changing actions without an explicit confirmation step. In this context, autonomy increases the risk of overreach, mistaken execution, and silent data access or modification.

Content

Scanner excerpt · agent/instructions.md (reported line 19)May include surrounding context.

md
## Available Commands

> **The agent must run all commands below itself. Do NOT ask the user to run them.**

- `python scripts/fetch_emails.py` — Fetch emails from the last 24 hours and print full content
- `python scripts/create_event.py --title "..." --date "YYYY-MM-DD" --time "HH:MM" [--duration 60]` — Create a Google Calendar event

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instructions tell the agent to fetch and process full email contents and create calendar events, but they do not require a clear notice or confirmation to the user about accessing sensitive mailbox data and making account changes. In practice, this can expose private content and cause unauthorized modifications under broad OAuth grants.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The setup flow instructs the agent to save client secrets and OAuth tokens locally without warning about their sensitivity or defining storage protections. If these files are left unprotected in the workspace, other local processes, users, or later tasks could reuse them to access the user's Gmail and Calendar.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The background refresh service maintains persistent authenticated access by silently refreshing OAuth tokens every 30 minutes, but the instructions do not clearly warn the user about that ongoing access. This increases the persistence of compromise or misuse if the environment is shared, unattended, or later repurposed.

Content

No source excerpt is available for this finding.

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · scripts/auth.py (reported line 41)May include surrounding context.

python
cred_path = os.path.join(CREDENTIALS_DIR, 'credentials.json')
    if os.path.exists(cred_path):
        return cred_path
    matches = glob.glob(os.path.join(CREDENTIALS_DIR, 'client_secret_*.json'))
    if matches:
        return matches[0]
    raise FileNotFoundError(

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script retrieves mailbox contents, including sender, subject, date, and body, and prints them directly to stdout. In agent or automation environments, stdout is often captured by logs, orchestration systems, chat transcripts, or other downstream consumers, which can unintentionally disclose sensitive email data well beyond the intended user.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The header says the script completes auth and saves token.json, but the implementation also automatically launches refresh_service.py. Undocumented post-auth execution is dangerous because users may grant sensitive OAuth access expecting only token storage, while the script immediately starts additional code with those newly obtained credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes OAuth credentials to token.json on disk without any warning, permission hardening, or user guidance about protecting the file. Stored refresh tokens can provide long-lived access to user data if another local user, backup system, malware, or accidental commit exposes the file.

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/setup_auth.py (reported line 103)May include surrounding context.

python
print("refresh_service.py is already running. Skipping auto-run.")
        else:
            try:
                result = subprocess.run([sys.executable, script_path], check=True, capture_output=True, text=True)
                print("\n[refresh_service.py output]\n" + result.stdout)
            except subprocess.CalledProcessError as e:
                print(f"[refresh_service.py error]: {e.stderr}")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The configuration example sets timezone: Asia/Bangkok, which can imply a default locale-specific behavior for calendar event handling. The file does not clearly state that users should choose their own timezone or that the provided value is only an example, which risks a locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The config sets timezone: Asia/Bangkok, which imposes a specific locale/timezone behavior. For a general skill, this can be a natural-language policy concern because it fixes a locale-related setting without any visible opt-in or justification in the file.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

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

python
MAX_BODY_LENGTH = 500

config = get_config()
LOG_LEVEL = getattr(logging, config.get('log_level', 'INFO').upper(), logging.INFO)
logging.basicConfig(
    level=LOG_LEVEL,
    format='%(asctime)s %(levelname)s %(message)s',

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/create_event.py (reported line 32)May include surrounding context.

python
MAX_BODY_LENGTH = 500

config = get_config()
LOG_LEVEL = getattr(logging, config.get('log_level', 'INFO').upper(), logging.INFO)
logging.basicConfig(
    level=LOG_LEVEL,
    format='%(asctime)s %(levelname)s %(message)s',

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/fetch_emails.py (reported line 20)May include surrounding context.

python
MAX_BODY_LENGTH = 500

config = get_config()
LOG_LEVEL = getattr(logging, config.get('log_level', 'INFO').upper(), logging.INFO)
logging.basicConfig(
    level=LOG_LEVEL,
    format='%(asctime)s %(levelname)s %(message)s',