Back to skill

Security audit

Gemini Openai Chat Export Analyze

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent chat-export analysis guide, but it handles full private chat histories and includes unsafe fixed temporary-file examples that can leave sensitive data exposed.

Install only if you are comfortable giving the agent access to complete ChatGPT/Gemini exports. Use a private working directory with owner-only permissions, avoid the documented fixed /tmp paths, delete intermediate files after analysis, and redact sensitive records before sharing reports.

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
SKILL.md:146
Finding

Predictable Shared Temporary Files May Expose Private Chat History

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 146–151 and 190–205
Vulnerability Type: Predictable and insecure temporary-file handling
Risk Level: Medium

Vulnerable code snippets:

bash
# Lines 146–151
# Alternative using html2text:

html2text "/path/to/My Activity/Gemini/My Activity.html" > /tmp/gemini.txt
# Then search with grep
grep -n "recommend|resign|quit" /tmp/gemini.txt
python
# Lines 190–192
with open("/tmp/unified.jsonl", "w", encoding="utf-8") as f:
    for rec in records:
        f.write(json.dumps(normalize(rec), ensure_ascii=False) + "\n")
bash
# Lines 197–205
# Find resignation-related records across all platforms
grep -E "resign|quit|change jobs" /tmp/unified.jsonl | head -20

# Distribution by platform
jq -r '.source' /tmp/unified.jsonl | sort | uniq -c

# Aggregate by month
jq -r '.created_at[0:7]' /tmp/unified.jsonl | sort | uniq -c

Technical Analysis

The Skill recommends writing complete Gemini and cross-platform conversation exports to fixed filenames in the shared /tmp directory. These exports can contain private conversations, account details, personal identifiers, financial data, business information, and other secrets.

Fixed paths such as /tmp/gemini.txt and /tmp/unified.jsonl provide no isolation between users or concurrent executions. The examples do not establish a restrictive umask, explicitly set file permissions, securely create the files, reject symbolic links, or guarantee deletion. Actual readability depends on the host's operating-system configuration and process umask, but the Skill does not enforce safe behavior.

Predictable shell redirection may also follow a pre-existing symbolic link. If a local attacker can create the documented path before execution, the output could be redirected to another file that the victim process is permitted to overwrite. The Python open(..., "w") call likewise follo ...[truncated 1866 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create a private temporary directory with a unique name and owner-only permissions:

    bash
    umask 077
    workdir="$(mktemp -d "${TMPDIR:-/tmp}/chat-export.XXXXXX")" || exit 1
    trap 'rm -rf -- "$workdir"' EXIT HUP INT TERM
    
    html2text "/path/to/My Activity/Gemini/My Activity.html" \
      > "$workdir/gemini.txt"
    
  2. Use Python's secure temporary-file APIs rather than a fixed path:

    python
    import json
    import os
    import tempfile
    
    with tempfile.TemporaryDirectory(prefix="chat-export-") as workdir:
        output_path = os.path.join(workdir, "unified.jsonl")
        with open(output_path, "x", encoding="utf-8") as f:
            os.chmod(output_path, 0o600)
            for rec in records:
                f.write(json.dumps(normalize(rec), ensure_ascii=False) + "\n")
        # Analyze the file within this context.
    
  3. If results must persist, require a user-selected protected directory rather than a shared temporary directory. Create output files with mode 0600 and directories with mode 0700.

  4. Avoid following symbolic links. For security-sensitive low-level file creation, use exclusive creation and platform-appropriate flags such as O_CREAT | O_EXCL | O_NOFOLLOW where supported.

  5. Add automatic cleanup and clearly warn that intermediate files contain plaintext conversation history. Securely control retained copies according to the storage medium and threat model.

  6. Avoid displaying raw matching records by default. Redact email addresses, telephone numbers, government identifiers, payment-card data, credentials, and other secrets before producing reports or terminal output.

Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest description and the entire instructional content are written as mandatory Chinese guidance, with no indication that users may choose another language. This creates a natural-language policy concern because the skill effectively enforces a specific language/locale without documenting user choice or a justified regional constraint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description states this skill covers ChatGPT web exports and Gemini web exports only, explicitly excluding other sources. Part C expands the skill to handling 'Claude + ChatGPT + Gemini' together for unified analysis, which goes beyond the declared product scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

Line L225 states '三家产物的时区都是 UTC', presenting timestamp handling as uniform across platforms. This conflicts with L160-L163, which explicitly warn that Gemini export timestamps may have timezone problems and should be treated with caution.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.