Back to skill

Security audit

Se Gmail Monitor

Security checks for vulnerabilities and agentic risk

Overview

This Gmail skill performs the advertised email monitoring and sending, but its high-impact mailbox access is under-scoped and its send/account behavior is inconsistent enough to require review before use.

Only install this after you verify the intended account names, lock the config to Gmail endpoints, protect the credential file, and require explicit user approval for every outbound email unless a narrow internal allowlist is implemented and enforced in code.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T01 · Skill Instruction Hijacking

Warning
Location
scripts/gmail-monitor.py:25
Finding

Untrusted Email Metadata Can Influence Agent Behavior

Content
View full analysis
= count else ids for mid in reversed(latest): _, data = mail.fetch(mid, '(RFC822)') for part in data: if isinstance(part, tuple): msg = email_lib.message_from_bytes(part[1]) subj = decode_header(msg['Subject'] or '')[0][0] if isinstance(subj, bytes): subj = subj.decode(errors='replace') print(f"From: {msg.get('From','')[:70]}") print(f"Subject: {subj[:100]}") print(f"Date: {msg.get('Date','')[:30]}") print() mail.logout() ``` An external sender controls these headers and can place instruction-like text in them. If an AI agent consumes the command output during a heartbeat, it may mistake this data for trusted operational instructions. The script does not execute the injected text itself; exploitation depends on the surrounding agent in ...[truncated 1063 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gmail-monitor.py:8
Finding

Gmail Credentials Can Be Submitted to Arbitrary Configured Servers

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/gmail-monitor.py:65
Finding

Outbound Email Approval Policy Is Not Enforced by Code

Content
View full analysis
[account]") sys.exit(1) acc = sys.argv[5] if len(sys.argv) > 5 else 'boris' send_email(sys.argv[2], sys.argv[3], sys.argv[4], acc) ``` The account argument is also accepted directly from command-line input and used to select credentials from the configuration. Consequently, the safety rule exists only as documentation and can be bypassed by agent error, indirect prompt injection, or direct invocation. The documentation is internally inconsistent because it requires confirmation for sending while also allowing the Boris account to send operational or internal messages freely. This ambiguity makes reliable policy enforcement less likely. ### Attack Path 1. An attacker influences the agent through untrusted content, or the agent incorrectly determines that a message should be sent. 2. The agent invokes `gmail-monito ...[truncated 859 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill description and documented behavior do not align: it claims specific dual-account support and triage behavior, yet references a different account key ('boris') and lacks the promised urgency-detection logic. This mismatch is dangerous because operators may trust the skill to monitor the right mailboxes and enforce the right safeguards when it may instead act on unintended accounts or omit expected review steps.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill declares no explicit tool scope or permissions even though it is designed to access external Gmail accounts and local credential/config files. Missing scope boundaries increases the chance of unintended networked actions, weakens reviewability, and can allow the skill to be invoked with more authority than users or orchestrators expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The heartbeat guidance says to perform periodic inbox checks but does not define when, how often, for which account, or under what authorization conditions. Ambiguous autonomous polling of email accounts can normalize continuous surveillance, increase exposure of sensitive messages, and cause the skill to access mailboxes outside the user's immediate intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The heartbeat guidance says to perform periodic inbox checks but does not define when, how often, for which account, or under what authorization conditions. Ambiguous autonomous polling of email accounts can normalize continuous surveillance, increase exposure of sensitive messages, and cause the skill to access mailboxes outside the user's immediate intent.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
91% confidence
Finding

The rule that the 'Boris account' can send operational/internal emails freely authorizes autonomous message sending without approval for at least one account. Allowing an agent to independently decide when and what to send can lead to impersonation, data leakage, social engineering, or business-process abuse, especially in a Gmail automation context.

Content

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

md
- **NEVER send emails as YourName** without explicit permission
- **Boris account** can send operational/internal emails freely
- **Flag urgent emails** to the user immediately
- **Do not auto-reply** to external contacts without approval

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script loads a local Gmail config file and uses the app password to authenticate to IMAP, which is access to sensitive credentials. While the module docstring mentions email management generally, there is no explicit warning, comment, or user-facing disclosure that stored credentials will be read and used for mailbox access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The list_emails function connects to IMAP and retrieves full RFC822 message data from the remote mail server. Although listing emails is part of the script's purpose, the code does not provide any warning or explanatory comment that it will transmit mailbox access requests and download message content over the network.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest says the skill supports dual Gmail accounts via "info@ and agent@", and the CLI help says sending occurs as "agent@yourdomain.com". However, the implementation defaults send_email to account='boris' and also uses 'boris' as the fallback CLI account, which contradicts the stated/documented account model rather than merely omitting detail.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.