Back to skill

Security audit

Google Doc Format

Security checks for vulnerabilities and agentic risk

Overview

This Google Docs formatting skill is mostly coherent, but it teaches agents to run forced Google Drive rename, move, and delete commands without explicit confirmation safeguards.

Review before installing. Use this only when you intentionally want an agent to create or modify Google Docs through your gog credentials. For replacements, require the agent to confirm exact document IDs and names, keep a backup or archive instead of immediate deletion, and use a private temporary file or directory rather than /tmp/doc_name.md.

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:130
Finding

Predictable Temporary File Enables Symlink Attacks and Cross-Run Data Exposure

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 130–131
Vulnerability Type: Predictable and insecure temporary-file handling
Risk Level: Medium

Vulnerable code:

bash
1. **Write markdown to temp file** — `cat > /tmp/doc_name.md << 'EOF'`
2. **Create doc** — `gog docs create "Title" --file /tmp/doc_name.md --parent FOLDER_ID --pageless --force --no-input`

Technical Analysis

The workflow writes document content to the fixed, globally predictable path /tmp/doc_name.md. It neither creates the file atomically nor verifies that the path is a regular file owned by the current process. It also provides no isolation between concurrent executions.

On a shared host, a local attacker or another process operating under the same account could pre-create this path as a symbolic link. Shell redirection would then follow the link and overwrite its target, subject to the executing account's filesystem permissions and operating-system symlink protections. An attacker could also replace or modify the temporary file between its creation and the subsequent gog docs create command, causing attacker-controlled content to be uploaded.

Concurrent legitimate executions can overwrite the same file, resulting in one user's document being uploaded by another run. Because the Markdown may contain confidential report data, this creates both integrity and confidentiality risks.

Attack Path

  1. An attacker with local access capable of manipulating /tmp/doc_name.md predicts the documented filename.
  2. Before the skill runs, the attacker creates /tmp/doc_name.md as a symbolic link to a file writable by the skill's operating-system account, or creates a file that can subsequently be replaced.
  3. The skill executes the documented shell redirection.
  4. If symlink protections do not block the operation, the shell follows the link and overwrites the target file with the generated Markdown.
  5. Alternative ...[truncated 1042 chars]
Remediation
View remediation

Remediation Suggestions

Replace the fixed path with a private, unpredictable temporary directory and ensure cleanup occurs even if a command fails:

bash
tmp_dir="$(mktemp -d)" || exit 1
chmod 700 "$tmp_dir"
trap 'rm -rf -- "$tmp_dir"' EXIT HUP INT TERM

source_file="$tmp_dir/source.md"
umask 077
cat > "$source_file" << 'EOF'
# Document content
EOF

gog docs create "Title" \
  --file "$source_file" \
  --parent "$FOLDER_ID" \
  --pageless \
  --force \
  --no-input

Additional hardening measures:

  • Never use a constant filename directly under a shared temporary directory.
  • Quote every temporary path and variable expansion.
  • Set umask 077 so generated files are readable and writable only by the executing account.
  • Validate that the temporary file is a regular file owned by the current user before uploading it.
  • Keep the file descriptor or isolated temporary directory under process control throughout the workflow.
  • Remove temporary content through a shell cleanup trap on both normal and abnormal termination.
  • Use a distinct temporary directory for every invocation to prevent interference between concurrent runs.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The replacement workflow includes forced rename, delete, and move operations with --force --no-input, including deletion of the old document, but provides no requirement for explicit user confirmation or backup. In an automated or mis-scoped invocation, this can irreversibly destroy user data or replace the wrong document with no interactive safeguard.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description says the skill triggers on phrases like "create formatted doc," "format doc for client," and "create deliverable doc," which are generic enough to match ordinary requests outside this skill's intended Google Docs workflow. The file does not provide exclusion conditions or tighter scope constraints to distinguish when this skill should or should not activate.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
89% confidence
Finding

The skill explicitly recommends --force to skip confirmations during document creation, normalizing non-interactive execution. In context with later destructive examples, this reduces friction for autonomous actions and increases the chance that an agent will perform file operations without validating user intent or target resources.

Content

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

md
- `--file` — Import markdown file (required for proper table rendering)
- `--parent` — Google Drive folder ID
- `--pageless` — Use pageless layout (recommended for reports/audits)
- `--force` — Skip confirmations

## Markdown → Google Docs Mapping

Static analysis

No suspicious patterns detected.