Back to skill

Security audit

Email News Digest

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed email digest workflow, but it handles Gmail content and outbound email with weak guardrails and produces a hard-coded digest instead of a true email summary.

Review this skill carefully before installing. It needs Gmail mailbox access and can send email to supplied recipients, so use narrowly targeted Gmail queries and trusted recipient lists only. Treat the current summarizer as a placeholder that may send unrelated digest content, and avoid using it for confidential, regulated, or business-critical mail until it has a true input-based summarizer, a preview/confirmation step, and safer temporary-file handling.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/process_and_send.sh:1
Finding
Predictable and Insecure Storage of Raw Email Content## Vulnerability Details **File Location**: `scripts/process_and_send.sh`, lines 1-7 **Vulnerability Type**: Predictable temporary file, unsafe file creation, and plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code ```bash EMAIL_DIGEST_DIR="memory/$(date +%Y-%m-%d)-email-digests" TEMP_EMAIL_FILE="${EMAIL_DIGEST_DIR}/raw_email_content.txt" TEMP_HTML_FILE="${EMAIL_DIGEST_DIR}/final_digest.html" mkdir -p "${EMAIL_DIGEST_DIR}" # --- Trap for cleanup on exit --- trap 'rm -f "${TEMP_EMAIL_FILE}" "${TEMP_HTML_FILE}"' EXIT # Save decoded email body to a temporary file for summarization script echo "$EMAIL_BODY_DECODED" > "${TEMP_EMAIL_FILE}" ``` ### Technical Analysis The script stores the complete decoded email in a deterministic path based only on the current date. It creates neither the directory nor the file with explicit restrictive permissions, so their accessibility depends on the process umask and the permissions of the working directory. Shell output redirection follows symbolic links and does not provide exclusive file creation. If another local user or process can write to the `memory` directory, it can predict the destination and pre-create `raw_email_content.txt` as a symbolic link. When the skill runs, the shell opens the linked target for truncation and writes the decoded email into it. The exit trap reduces retention after normal script termination, but it does not prevent disclosure while the script is running, protect against symbolic-link attacks, or guarantee cleanup after abrupt termination such as `SIGKILL`. The predictable `final_digest.html` path is subject to the same unsafe-file-creation design, although the shown script does not currently write that file. ### Attack Path 1. An attacker obtains local write access to the skill's working directory or its `memory` subdirectory. 2. The attacker predicts the directory name from the current date: `memory/YYYY-MM-DD-email-digests`. 3. Before the victim invokes th ...[truncated 1289 chars]
Remediation
## Remediation Suggestions 1. Set a restrictive umask before creating any files containing email data: ```bash umask 077 ``` 2. Create a private, unpredictable temporary directory and clean up the entire directory: ```bash TEMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/email-news-digest.XXXXXXXX")" trap 'rm -rf -- "$TEMP_DIR"' EXIT TEMP_EMAIL_FILE="$TEMP_DIR/raw_email_content.txt" TEMP_HTML_FILE="$TEMP_DIR/final_digest.html" ``` 3. Create sensitive files with exclusive creation and mode `0600`. Do not reuse predictable paths or follow pre-existing symbolic links. 4. Prefer avoiding plaintext storage entirely. Pipe decoded content directly into the summarization process or provide it through standard input: ```bash printf '%s' "$RAW_MESSAGE_B64" | base64 -d | uv run "$SUMMARIZE_SCRIPT" ``` The Python script would need to read from standard input when no input file is supplied. 5. If persistent digest artifacts are required, create a dedicated directory owned by the executing account with mode `0700`, validate ownership before use, and generate unique filenames. 6. Avoid `echo` for arbitrary message content because option-like values and implementation-specific escape handling can alter data. Use `printf '%s' "$EMAIL_BODY_DECODED"` when file storage is unavoidable. 7. Remove the unnecessary `raw_summary` field from `scripts/summarize_content.py` unless callers explicitly require it, because it duplicates the complete source email in the generated JSON and shell memory.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • 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
97% confidence
Finding
The documented purpose understates or misstates sensitive behavior, including Gmail access, selective processing of only one matching message, and email/image delivery semantics. This mismatch is dangerous because users and reviewers may approve the skill believing it performs a benign digest workflow while it actually accesses mailbox data and sends outbound content under different assumptions.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The documented purpose understates or misstates sensitive behavior, including Gmail access, selective processing of only one matching message, and email/image delivery semantics. This mismatch is dangerous because users and reviewers may approve the skill believing it performs a benign digest workflow while it actually accesses mailbox data and sends outbound content under different assumptions.

Description-Behavior Mismatch

High
Confidence
99% confidence
Finding
The script advertises that it summarizes input text, but the emitted JSON contains a fixed digest regardless of the provided emails, while also labeling the original input as 'raw_summary'. In the context of an automated email-news-digest skill, this can cause false reports to be distributed to recipients, undermining trust and potentially leaking or misrepresenting source content in downstream HTML email generation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding
The skill declares behavior that reads email-related content and references supporting files, but it does not specify any explicit tool scope or permissions. In a skill that handles potentially sensitive mailbox data and dispatches emails, missing capability declarations weakens reviewability and can enable broader-than-expected access at runtime.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill is designed to retrieve email content, generate external derivative content from it, and send an HTML report, yet it provides no explicit warning about sensitive-data handling or onward transmission. Because emails often contain confidential or regulated information, the absence of disclosure and guardrails increases the risk of unintended data exposure to external tools, models, or recipients.

YARA rule 'network_reconnaissance': Network reconnaissance and scanning patterns [hacktools]

Medium
Category
YARA Match
Content
mage, and sending a formatted HTML report.

## Usage

To use this skill, run the `process_and_send.sh` script with the required parameters:

```bash
skills/email-news-digest/scripts/process_and_send.sh \
    --recipients "matthewxfz@gmail.com,salonigoel.ssc@gmail.com" \
    --email-query "newer_than:2d subject:news" \
    --image-prompt "A sharp, modern western style image representing AI growth, fierce competition, and diverse applications."
```

### Parameters

*   `--recipients`: Comma-separated list of email addresses to send the digest to.
*   `--email-query`: Gmail search query to filter recent emails (e.g., "newer_than:2d subject:AI"). See [email-filters.md](references/email-filters.md) for more examples.
*   `--image-prompt`: A descriptive prompt for the AI image generation.

## How it Works

1.  **Email Retrieval:** Fetches the most recent email matching your query.
2.  **Content Summarization:** Extracts content and generates a structured summary (TL;DR, main title, and secti
Confidence
65% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Missing User Warnings

Medium
Confidence
96% confidence
Finding
This script retrieves raw email content, summarizes it, generates derived content from it, and then sends an HTML digest with an attachment to arbitrary recipients supplied at runtime. Even though this appears to be the stated purpose of the skill, it enables outbound transmission of potentially sensitive email data without any explicit consent check, recipient restriction, data classification guardrail, or user-facing warning, so accidental exfiltration is a real risk.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The function is documented as a summarizer but returns hard-coded AI-news content instead of deriving output from the supplied input. In an email digest skill, this is a security-relevant integrity issue because users may believe they are sending summaries of recent emails while the tool silently substitutes unrelated content, enabling deceptive or misleading reporting.

YARA rule 'network_reconnaissance': Network reconnaissance and scanning patterns [hacktools]

Medium
Category
YARA Match
Content
ctured summary template.
    tldr = "AI growth is accelerating across industries, driven by significant capital spending on infrastructure and a surge in application-layer funding for startups. This rapid expansion is intensifying market competition and bringing AI into novel applications, from enterprise solutions to professional sports analytics."
    main_title = "AI's Accelerating Investment, Fierce Competition, and Diverse Applications"
    sections = [
        {
            "title": "Massive Investment & Infrastructure Race",
            "content": "Major players like **Alphabet are significantly increasing AI infrastructure spending**, signaling a long-term commitment to foundational AI capabilities. This suggests a continued arms race in AI development, with a focus on core infrastructure to support next-generation models and services."
        },
        {
            "title": "Intensifying Competition & Ethical Scrutiny",
            "content": "The public spat between **Anth
Confidence
65% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Static analysis

No suspicious patterns detected.