Back to skill

Security audit

Gmail Label Manager

Security checks for vulnerabilities and agentic risk

Overview

This Gmail automation is under-documented and can forward sensitive email details to Telegram, write Google Calendar events, mutate Gmail labels, and expose a shell-injection risk from email-derived calendar fields.

Do not install this without review. At minimum, remove eval, disable or explicitly opt into Telegram forwarding, redact email content from notifications and logs, document and gate Calendar writes, and test Gmail mutations in a dry-run or limited account before using it on a real mailbox.

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

other

Error
Location
script.sh:272
Finding

Undisclosed Transmission of Sensitive Email Content to Telegram

Content
View full analysis
&1) local exit_code=$? echo "[$(date '+%Y-%m-%d %H:%M:%S')] ${response}" >> "$TELEGRAM_LOG" } ``` One of several handlers that supplies email content to this function is: ```bash handle_child_mention() { local email_content="$1" local subject="$2" local sender="$3" local child_name child_name=$(extract_child_name "$email_content $subject") log_info "Processing email mentioning child: ${child_name:-one of the children}" local sender_name sender_name=$(echo "$sender" | grep -oP '^[^<]+' | xargs) local preview preview=$(echo "$email_content" | head -c 300) local telegram_message=" Child Mentioned: ${child_name:-Children} From: ${sender_name} Subject: ${subject} Preview: ${preview}...  Check email - may require attention" send_telegram "$telegram_message" "high" } ``` ### Technical Analysis The script retrieves complete Gmail threads and passes email-derived information to numerous c ...[truncated 1994 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
script.sh:333
Finding

Arbitrary Shell Command Injection Through Email-Derived Calendar Fields

Content
View full analysis
&1) || log_warn "Failed to create calendar event: $result" return 0 } ``` An affected call site derives calendar parameters from untrusted email content: ```bash handle_permission_slip() { local email_content="$1" local subject="$2" log_info "Processing school permission slip" local child_name local event_name local event_date local deadline child_name=$(extract_child_name "$email_content") event_name=$(echo "$subject" | sed 's/permission.*slip//i' | xargs) event_date=$(extract_date "$email_content") deadline=$(echo "$email_content" | grep -oiP "deadline[: ]*\K.*" | head -n 1 | xargs) # Other notification and digest operations occur here. if [ -n "$deadline" ]; then add_calendar_event "school Permission Slip Due: ${event_name}" "$deadline" true "" "Child: ${child_name}. Event: ${event_date}" fi return 0 } ``` ### Technical Analysis `add_calendar_event` builds a shell command as a string and then executes that string with `eval`. Several arguments—including the title, date, time, and description—can originate from an email subject or body. Embedding a value inside textual double quotes does not make it safe when the completed s ...[truncated 1881 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
script.sh:333
Finding

Undisclosed Automatic Calendar Modification Triggered by Untrusted Email

Content
View full analysis
&1) || log_warn "Failed to create calendar event: $result" return 0 } ``` Representative automatic event creation includes: ```bash if [ -n "$deadline" ]; then add_calendar_event "school Permission Slip Due: ${event_name}" "$deadline" true "" "Child: ${child_name}. Event: ${event_date}" fi ``` ```bash add_calendar_event "Absence: ${absence_child}" "$absence_date" true "" "Reason: ${reason:-Not specified}. Submit excusal note." ``` ### Technical Analysis The documented skill purpose is Gmail label organization and archiving. However, the implementation also invokes the authenticated Google CLI to create calendar events. Neither the calendar-write behavior nor the need for Calendar API authorization is disclosed in `SKILL.md`. Event creation is driven by pattern matching and data extraction from incoming email. Pattern matching alone does not establish that the sender is trusted or that the extracted date and event details are correct. Consequently, an external sender can influence calendar state merely by sending a message that matches one of the supported categories. This behavior exceeds the least- ...[truncated 1436 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
script.sh:14
Finding

Plaintext Retention of Email Metadata and Sensitive Extracted Information

Content
View full analysis
> "$TELEGRAM_LOG" ``` Digest entries are also written directly to disk: ```bash add_to_digest() { local category="$1" local entry="$2" local priority="${3:-normal}" { echo "" echo "[$(date '+%Y-%m-%d %H:%M:%S')] [${priority^^}]" echo "Category: $category" echo "$entry" echo "---" } >> "$DIGEST_FILE" } ``` Email metadata is included in the general log: ```bash log_info "==========================================" log_info "Processing: $subject" log_info "From: $sender" log_info "Thread ID: $thread_id" log_info "==========================================" ``` ### Technical Analysis The script writes Gmail subjects, senders, thread identifiers, handler-generated digest entries, and Telegram API responses into files under the skill directory. Handler-generated digest entries can contain family, school, financial, medical, travel, and account-related information. The script creates the log directory with `mkdir -p` but does not establish a restrictive `umask`, explicitly assign file mode `0600`, encrypt stored data, redact sensitive fields, or implement retention limits. File permissions therefore depend on the invoking environment's default `umask`. The project documentation does not disclose that email-derived information will be retained locall ...[truncated 1118 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
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (11)

Ssd 3

High
Category
Not specified by scanner
Confidence
92% confidence
Finding

Multiple handlers extract and relay private email content in plain language to an external Telegram chat, including previews, children's names, school matters, medical details, travel documents, financial transactions, and account-related information. This is a natural-language data leakage pattern because the script is designed to collect user-provided email contents and include them in outbound messages and logs, even though it does not use explicit exfiltration wording.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script sends email-derived content, including previews and sensitive categories such as medical, financial, family, and security alerts, to Telegram via an external API. This is dangerous because it transfers potentially confidential Gmail data to a third-party service without minimization, explicit consent flow, or clear access controls, increasing privacy and data-exposure risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Sensitive email content is forwarded to Telegram automatically with no interactive warning, approval step, or visible consent checkpoint. Because the script handles highly personal categories, this silent sharing can expose confidential family, financial, and medical information outside Gmail's trust boundary.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script creates Google Calendar events directly from parsed email content, which exceeds passive classification and can cause unintended state changes from untrusted input. Malicious or malformed emails could create misleading events, spam the calendar, or manipulate scheduling based on forged content.

Content

No source excerpt is available for this finding.

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · script.sh (reported line 338)May include surrounding context.

sh
rity^^}]"
    echo "Category: $category"
    echo "$entry"
    echo "---"
  } >> "$DIGEST_FILE"
}

#==============================================================================
# CALENDAR FUNCTIONS
#==============================================================================

add_calendar_event() {
  local title="$1"
  local date="$2"
  local all_day="${3:-true}"
  local time="${4:-}"
  local description="${5:-}"

  log_info "Creating calendar event: $title on $date"

  local cmd="gog calendar event create --title \"$title\" --startDate \"$date\""

  if [ "$all_day" = "true" ]; then
    cmd="$cmd --allDay true"
  elif [ -n "$time" ]; then
    cmd="$cmd --startTime \"$time\""
  fi

  if [ -n "$description" ]; then
    cmd="$cmd --description \"$description\""
  fi

  local result
  result=$(eval "$cmd" 2>&1) || log_warn "Failed to create calendar event: $result"

  return 0
}

#==============================================================================
# EMAIL PROCESSING UTILITIE

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script automatically modifies Gmail threads by applying/removing labels and archiving messages without an explicit warning or confirmation step. Automatic mailbox mutation on untrusted email input can hide important emails, interfere with workflows, and make phishing or other messages less visible to the user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill describes automatically labeling, removing labels, and archiving unread Gmail messages, but it does not prominently warn users that it will modify mailbox state and can move messages out of the inbox without manual review. This creates a real risk of unintended email handling, missed important messages, and user confusion, especially because the behavior is automated and based on inferred patterns from prior archived emails.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The header describes classification and processing, but the script also modifies labels and archives Gmail threads, which are materially different and more intrusive actions. This mismatch can mislead users about the script's real capabilities and reduce informed consent for mailbox-altering behavior.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This curl call transmits notification content to the Telegram Bot API, crossing a trust boundary to a third-party service. In this script, the transmitted content is often derived from email bodies and may include sensitive personal, medical, financial, and security information.

Content

Scanner excerpt · script.sh (reported line 293)May include surrounding context.

sh
local formatted_message="${emoji} ${message}"

  local response
  response=$(curl -s -X POST \
    "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
    -d "chat_id=${TELEGRAM_CHAT_ID}" \
    --data-urlencode "text=${formatted_message}" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The hardcoded Telegram API endpoint confirms external transmission of collected email-derived data to a non-Gmail service. Given the script's broad handling of personal categories, this transmission materially increases confidentiality and compliance risks.

Content

Scanner excerpt · script.sh (reported line 294)May include surrounding context.

sh
local response
  response=$(curl -s -X POST \
    "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
    -d "chat_id=${TELEGRAM_CHAT_ID}" \
    --data-urlencode "text=${formatted_message}" \
    --data-urlencode "parse_mode=HTML" 2>&1)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script performs automatic calendar creation from email-derived content without warning or confirmation, allowing untrusted email text to trigger account-side actions. This can be abused to clutter calendars, create deceptive reminders, or influence user behavior through crafted messages.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.