Back to skill

Security audit

smart asistant mail

Security checks for vulnerabilities and agentic risk

Overview

This Gmail automation skill is mostly purpose-aligned, but it asks for durable mailbox authority and includes under-scoped automatic actions that can alter email state without enough user control.

Review this carefully before installing. Only enable it for an account where automated Gmail access is acceptable, do not turn on automatic mode until cron jobs, heartbeat behavior, notification targets, and deactivation are clear, and avoid any setup path that prints or exposes API keys. Prefer review/quarantine for spam and require explicit approval for every persistent rule change.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
Findings (6)

T01 · Skill Instruction Hijacking

Error
Location
hooks/openclaw-handler.js:41
Finding

Agent-Wide Bootstrap Hook Injects Persistent Operational Instructions

Content
View full analysis
{ if (!event?.context || !Array.isArray(event.context.bootstrapFiles)) return; if (event.type !== 'agent' || event.action !== 'bootstrap') return; if ((event.sessionKey || '').includes(':subagent:')) return; const parts = [getBudgetInfo()]; const l = getPendingLearnings(); if (l) parts.push(l); parts.push('Lazy loading: NO cargar los 6 skills de email por separado. Este skill los fusiona todos.'); event.context.bootstrapFiles.push({ path: 'SMART_EMAIL_CTX.md', content: parts.join('\n'), virtual: true, }); }; ``` The hook is registered for every agent bootstrap: ```yaml metadata: openclaw: emoji: "🧠📬" events: ["agent:bootstrap"] ``` ### Technical Analysis The handler inserts a virtual bootstrap file containing imperative model restrictions, budget behavior, and Skill-loading directives into every primary-agent session. It does not verify that the current task is related to email or that this Skill was invoked for the current session. Bootstrap files are instruction-bearing context. Consequently, the injected content can influence model selection, tool use, and session behavior outside the Skill's legitimate task scope. Excluding subagents does not mitigate the impact on the main agent. Although enabling the hook is documented, its effective scope is broader than a task-scoped email integration: once enabled, it affects all subsequent primary-agent bootstraps. ### Attack Path 1. The user enables the hook with `openclaw hooks enable smart-email-agent`. 2. A new primary-agent session starts, including a session unrelated to email. 3. The `agent:bootstrap` event invokes the handler. 4. The handler adds `SMART_EMAIL_CTX.md` to the agent's bootstrap context. 5 ...[truncated 589 chars]
Remediation
View remediation

T06 · System Persistence

Error
Location
SKILL.md:370
Finding

Automatic Mode Establishes Persistent Scheduled Gmail Access

Content
View full analysis
= 8, notifícame.", "model": "anthropic/claude-haiku-4-5-20251001", "enabled": true }, { "id": "email-spam-cleanup", "schedule": "0 8 * * *", "description": "Limpieza diaria de spam — solo reglas locales, costo $0", "message": "Aplica reglas locales de spam. Sin llamadas IA.", "model": "anthropic/claude-haiku-4-5-20251001", "enabled": true }, { "id": "email-weekly-report", "schedule": "0 9 * * MON", "description": "Informe semanal", "message": "Genera informe semanal de correos con email-reporter.", "model": "anthropic/claude-haiku-4-5-20251001", "enabled": true } ] } } ``` The activation workflow explicitly installs persistent state: ```text Usuario: "Activa el agente de correo en modo automático" Agente: 1. Verificar: gog auth status 2. Crear cron jobs recomendados (ver arriba) 3. Copiar HEARTBEAT.md al workspace 4. Preguntar: ¿activar Gmail Push para tiempo real? 5. Confirmar canal de notificaciones (NOTIFY_CHANNEL) 6. "✅ Agente activado. Reviso cada 55 min. Te aviso si hay algo importante." ``` ### Technical Analysis The automatic-mode instructions create enabled cron jobs and copy a heartbeat instruction file into the persistent OpenClaw workspace. These mechanisms ...[truncated 1149 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
assets/HEARTBEAT.email.md:11
Finding

Heartbeat Moves Messages to Trash Without Explicit Confirmation

Content
View full analysis
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:551
Finding

Mailbox-Derived Patterns Are Promoted into Persistent Rules Without Approval

Content
View full analysis
$0.01/mes? → Proponer: "Aprendí que X. ¿Lo aplico a las reglas?" → Si acepta → editar corp_routing_rules.json → Status=applied 3. ¿3+ learnings del mismo dominio/patrón? → Promover a regla permanente sin preguntar → Status=promoted 4. Reportar: "Apliqué N mejoras. Ahorro estimado: $X/mes" ``` The learning reference defines automatic consequences: ```markdown **Remitente siempre ignorado** (3+ veces archivado sin leer) → Añadir a known_ignore_senders.txt. Auto-archivo, skip IA. **Dominio corporativo nuevo** (2+ correos clasificados igual) → Añadir a corp_routing_rules.json. Routing directo, skip IA. **Newsletter recurrente** (mismo from + subject normalizado) → Marcar leído + archivar automáticamente, sin IA. ``` It also permits promotion based only on recurrence: ```text pending → (usuario aprueba OR patrón 3x) → applied applied → (funciona 2+ semanas) → promoted → archivado ``` ### Technical Analysis The learning system treats repeated mailbox observations as sufficient authorization to write persistent routing and ignore rules. Email senders influence the observations from which those rules are derived. Recurrence is not evidence that a sender is trusted or that automatic archival is safe. An external party can generate repeated messages with controlled sender and subject characteristics. Classification errors, spoofed display names, or repeated crafted messages can therefore influence persistent state. Promoted learnings are also excluded from routine session summaries, reducing visibility into the active behavior. This creates a memory-poisoning path in which externally influenced content affects future sessions and future mailbox operations. ## ...[truncated 993 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/init_orchestrator.py:22
Finding

Initializer Prints the Complete Safe Browsing API Key

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:49
Finding

Documentation Recommends Global Installation of an Unpinned Gmail CLI Package

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a full-featured Gmail agent for essentially any email-related task. However, the supplied code chunk does not implement email functionality at all. It only runs during an OpenClaw agent bootstrap event, reads local files like budget_tracker.json and LEARNINGS.md, computes budget status/model restrictions, and injects that information into a virtual context file. While the injected text references a fused email skill and cost controls, this code itself is not an email reader/organizer/responder/scheduler. That is a material description-behavior mismatch, not merely a supporting implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a full-featured Gmail agent that can handle essentially any email-related task. However, the supplied code chunk is only an initialization/setup utility. It validates required environment variables, checks for the gog CLI, creates local budget and learning files, and runs gog auth status to verify authentication. While budget tracking and learning-file scaffolding loosely relate to the description's budgeting/self-improvement claims, the core advertised capabilities—interacting with Gmail messages, organizing inbox content, drafting replies, scheduling actions, and generating email reports—are absent from this code. Therefore the code chunk's actual behavior is materially narrower than the declared purpose.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger list is extremely broad, including generic words for email, drafts, reports, budgets, and agent improvement, which can cause unintended activation in unrelated contexts. Because the skill can read mail, modify labels, send replies, and alter persistent local state, accidental invocation materially increases risk.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

Referencing a Gmail credentials.json path as an optional environment input introduces credential-access capability into a skill that also has shell and file access. While not exfiltration by itself, it meaningfully raises risk because the skill could be induced to read, misuse, or mishandle sensitive OAuth material stored on disk.

Content

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

md
description: "Presupuesto mensual en USD (default: 1.00)"
      env_optional:
        - name: GMAIL_CREDENTIALS_PATH
          description: "Fallback: ruta a credentials.json de Gmail API"
        - name: NOTIFY_CHANNEL
          description: "Canal de notificaciones (telegram/slack/whatsapp)"
        - name: SAFE_BROWSING_API_KEY

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill states that destructive actions require explicit confirmation, but later allows automatic promotion of permanent rules without asking the user. That contradiction can lead to unauthorized persistent behavior changes affecting message routing, classification, and possible deletion/archival outcomes.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Permitting permanent rule changes without asking the user enables durable behavior modification from accumulated interactions, which is particularly dangerous in a mail-management skill. A bad learned rule could suppress, reroute, archive, or deprioritize important messages without immediate visibility.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares broad capabilities to read environment variables, execute shell commands, and read/write local files, but does not constrain tool scope with explicit permissions or allowed-tools. In an email-handling skill that can access credentials, logs, learnings, and local state, this increases the blast radius if the skill is mis-invoked or prompt-influenced into performing unintended actions.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

bash
# Guardar como borrador
gog gmail draft create --to "juan@empresa.com" \
  --subject "Re: Propuesta Q2 2026" \
  --body "Hola Juan,..." \
  --reply-to <message_id>

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow instructs the agent to move spam directly to trash using local rules, but does not prominently warn users that this is effectively a deletion path with false-positive risk. In email operations, silent disposal can cause loss of legitimate messages and make recovery harder if done automatically on a schedule.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The self-improvement engine is authorized to edit routing rules and promote learned behavior over time, which creates persistent state changes from prior interactions. In an email agent, this can silently expand filtering, rerouting, or spam-handling behavior and make accidental or adversarial prompt influence durable across sessions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The heartbeat instructs the agent to send unread spam directly to trash based on a domain list, with no user confirmation, review queue, or safeguard for false positives. In an email-management skill, this creates a real risk of silently deleting legitimate messages that were misclassified as spam or came from domains incorrectly added to the allow/block logic.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill manifest context presents this skill as an all-in-one Gmail agent for reading, organizing, responding, scheduling, and reporting on email. In this file, however, the declared behavior is only to inject budget state, active mode, allowed model, and pending learnings at session bootstrap, which is materially different from the stated email-centric purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file injects natural-language bootstrap instructions entirely in Spanish, including an imperative directive at L48, without offering any user language choice or documenting that the skill is intended only for Spanish-speaking users. This can violate language/locale policy because it implicitly constrains agent behavior to a specific language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Todo el archivo está redactado en español y no indica que el idioma sea opcional, configurable o requerido por un contexto regional específico. Según la política dada, imponer un idioma sin opt-in del usuario constituye una violación de política de lenguaje/locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire skill reference is written in Spanish and does not offer any language choice, opt-in, or justification that the skill is intended only for Spanish-speaking users or a Spanish-specific environment. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script prints raw environment variable values such as GOG_ACCOUNT and optional configuration values directly to the console. Console output is often captured in terminal history, logs, CI output, screenshots, or support bundles, so exposing secret or sensitive configuration values can leak credentials or account identifiers unnecessarily.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The setup routine requires ANTHROPIC_API_KEY to proceed and probes for SAFE_BROWSING_API_KEY even though this file is only performing local initialization and Gmail auth checks. Expanding required secret scope beyond what initialization minimally needs increases the blast radius of credential exposure and pushes users to provision unnecessary third-party access for a basic setup path.

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

python
def check_gog_auth():
    print("\n── Autenticación Gmail")
    import subprocess
    r = subprocess.run(['gog', 'auth', 'status'], capture_output=True, text=True)
    if r.returncode == 0: ok(f"Autenticado: {r.stdout.strip()}")
    else: warn(f"No autenticado — ejecutar: gog auth add {os.environ.get('GOG_ACCOUNT', 'tu@gmail.com')}")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The line uses prescriptive language ("SIEMPRE") to force a fixed setting rather than offering user choice. Under the policy category, forcing a specific language/locale-style preference without opt-in can be a natural-language policy issue when no justification or user selection mechanism is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The user-facing description and instructions are written entirely in Spanish, which can impose a language choice on users without any stated opt-in or alternative. The policy for natural-language violations applies to all file types and specifically covers forced language or locale choices.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

User-facing messages, status output, and instructions throughout the script are written only in Spanish. This imposes a specific language on users without any opt-in or documented justification, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.