Back to skill

Security audit

PayLessTax Email Campaign

Security checks for vulnerabilities and agentic risk

Overview

This bulk email skill is not clearly malicious, but it needs Review because it can automatically send large campaigns using privileged delegated Gmail access and mailbox searches with limited guardrails.

Install only after an administrator confirms the Gmail scopes, delegated account, campaign mailbox, mailing-list source, schedule, and unsubscribe/contact-scraping rules. Prefer a dedicated campaign mailbox, least-privilege Gmail scopes, explicit send previews or confirmations, and clear consent rules before running scheduled batches.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
index.py:29
Finding
Overprivileged Gmail Access Through Domain-Wide Delegation## Vulnerability Details **File Location**: `index.py`, lines 29–33 **Vulnerability Type**: Excessive delegated permissions and violation of least privilege **Risk Level**: High ### Vulnerable Code ```python SCOPES = ['https://www.googleapis.com/auth/gmail.modify'] credentials = service_account.Credentials.from_service_account_info( self.service_account, scopes=SCOPES, subject=self.user_email ) self.gmail = build('gmail', 'v1', credentials=credentials) ``` ### Technical Analysis The application creates Google Workspace credentials using a service account with domain-wide delegation and impersonates the user specified by `self.user_email`. It requests the broad `gmail.modify` OAuth scope. The implemented workflow sends messages and searches for bounce and unsubscribe messages. It does not need general mailbox modification privileges. The delegated `gmail.modify` scope permits substantially more access than required, including reading mailbox content and modifying mailbox state. Because domain-wide delegation bypasses ordinary per-user consent, compromise or unauthorized use of the service-account credential would allow an attacker to assume the configured user's delegated Gmail privileges. Whether other domain users could also be impersonated depends on the Google Workspace delegation policy and service-account authorization configured outside this repository. ### Attack Path 1. An attacker obtains access to the Google service-account credential used by the application. The configured credential location is disclosed in `config/settings.json`, although the credential itself is not included in the audited project. 2. The attacker constructs delegated Google credentials using the service account and an authorized Workspace user as the impersonation subject. 3. The attacker requests the already authorized `gmail.modify` scope. 4. The attacker uses Gmail API operations beyond the application's legitimate sending and search requirements. 5. Within the per ...[truncated 916 chars]
Remediation
## Remediation Suggestions 1. Replace `gmail.modify` with the minimum scopes required: - Use `https://www.googleapis.com/auth/gmail.send` for message delivery. - Add only the narrowest Gmail read or metadata scope that supports the required bounce and unsubscribe searches. 2. If Gmail's available narrow scopes cannot support the search workflow, separate sending and inbox processing into distinct identities or services so the bulk sender does not retain mailbox-modification access. 3. Restrict Google Workspace domain-wide delegation to explicitly approved OAuth scopes and dedicated campaign identities. 4. Use a dedicated campaign mailbox rather than a general-purpose employee mailbox. 5. Store the service-account credential in a managed secret store with strict filesystem and IAM controls. Do not expose it through source control, logs, command output, or broadly readable paths. 6. Rotate the service-account key and review Google Workspace audit logs for unauthorized impersonation or mailbox activity. 7. Where supported, replace long-lived service-account keys with workload identity federation or another short-lived credential mechanism. 8. Add automated tests or deployment checks that reject OAuth scopes broader than the documented operational requirements.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared purpose presents this as routine email automation, but the skill also includes inbox scraping, bounce/unsubscribe monitoring, service-account delegation, and use of external mailing-list files. This mismatch is dangerous because it hides materially more invasive behavior than the headline description suggests, increasing the risk of unauthorized mailbox access, privacy violations, and misuse of delegated credentials.

Lp3

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding
The skill describes capabilities that require file access, network access, and privileged Gmail operations, but it declares no explicit tool scope or permissions. This is dangerous because it obscures the real execution boundary, making it easier for an agent or operator to run a bulk-email workflow with undeclared access to local files, contact lists, and Gmail data.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill explicitly states that it will scrape inboxes for new contacts, but it provides no user-facing warning about the privacy and consent implications of harvesting contact data from mailbox contents. In context, this is especially risky because the skill is built for high-volume campaign automation, so silently converting inbox data into marketing leads can enable large-scale unauthorized collection and outreach.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill relies on a Google service account with domain-wide delegation to manage Gmail, but it does not warn users that this grants highly privileged access to mailbox data and actions. This is dangerous because such access can enable reading, sending, and modifying email on behalf of users at scale, and the absence of a warning reduces the chance of meaningful review or constrained deployment.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill sends up to hundreds of emails automatically with no interactive confirmation, preview, recipient summary, or safeguard in the execution path. If triggered with the wrong mailing list, impersonated alias, or compromised credentials, it can immediately send bulk messages at scale, causing spam, reputational damage, and potential policy or legal violations.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
The code uses the delegated Gmail account with the broad gmail.modify scope to read inbox contents and search for bounce and unsubscribe messages. While bounce/unsubscribe handling is related to campaign management, it still introduces mailbox monitoring capability over a user's inbox that is more privacy-sensitive than simple outbound sending and can expose unrelated email metadata if misused or expanded.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The script reads a service account JSON file containing credentials used to authenticate to Gmail. There is no visible warning, prompt, or user-facing logging indicating that sensitive credentials are being accessed during execution.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
This JSON config hard-codes the timezone to "Africa/Johannesburg", which is a locale-specific setting expressed in natural-language-like configuration. Under the policy rule, forcing a specific locale without user opt-in or clear justification can be a policy violation.

Missing User Warnings

Low
Confidence
84% confidence
Finding
The script writes campaign output to a JSON file, which is a file-write operation affecting local state. Although the CLI argument names the output path, there is no explicit warning or notice at write time that execution will create or overwrite a file.

Static analysis

No suspicious patterns detected.