Back to skill

Security audit

Ghost Catalog

Security checks for vulnerabilities and agentic risk

Overview

The cataloging skill mostly matches its stated purpose, but it includes broad auto-invocation and an unrelated meta-skill that can inspect and modify skill files.

Review this package before installing. Use it only when you want a local catalog that may read many project files, create a SQLite database, generate a markdown report, and modify files by adding headers. Avoid running tag operations on executable scripts unless the insertion keeps shebangs and directives in place, and check why the unrelated improve-skill is bundled if you only intended to install Ghost Catalog.

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

Unconditional Header Prepending Can Break Executable Scripts

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:142-147
Vulnerability Type: Unsafe source-file mutation
Risk Level: Medium

Vulnerable Code

text
Apply a Ghost Catalog header to one or more files:

1. Read the file content
2. Determine the category from file extension and location
3. Query the catalog DB for the next available sequence number in that category
4. Generate the header with appropriate comment syntax
5. Prepend the header to the file (preserve existing content)
6. Insert into the catalog DB

The same vulnerable instructions are duplicated at ghost-catalog/SKILL.md:142-147. The generated header for Python and shell files is defined in ghost-catalog/header-templates.md:3-17:

python
# ==============================================================================
# file_id: SOM-XXX-NNNN-vX.X.X
# name: filename.py
# description: Brief description of what this file does
# project_id: PROJECT-NAME
# category: script
# tags: [tag1, tag2, tag3]
# created: YYYY-MM-DD
# modified: YYYY-MM-DD
# version: X.X.X
# agent_id: AGENT-DROID-001
# ==============================================================================

Technical Analysis

The tagging procedure directs the agent to prepend a generated metadata block to every selected file. Python and shell scripts are explicitly supported, but the procedure does not detect or preserve shebang lines.

On Unix-like systems, a shebang such as #!/usr/bin/env python3 or #!/bin/sh must remain at the beginning of the file for direct execution. Prepending the catalog header moves the shebang away from byte zero and prevents the operating system from selecting the intended interpreter. This can cause an Exec format error, fail CI or deployment tasks, or produce interpreter-dependent fallback behavior.

The procedure also lacks explicit handling for other position-sensitive content, including byte-order marks, Pyth ...[truncated 1645 chars]

Remediation
View remediation

Remediation Suggestions

  1. Detect a shebang before modifying Python, shell, Ruby, Perl, or other executable scripts. Preserve it as the first line and insert the metadata block immediately after it.
  2. Define language-specific insertion rules for other position-sensitive content, including byte-order marks, Python encoding declarations, XML declarations, strict-mode directives, and framework pragmas.
  3. Replace the unconditional “prepend” instruction with a safe insertion algorithm that parses the file type and determines the first valid metadata location.
  4. Preserve file encoding, line endings, executable permissions, and final-newline state during writes.
  5. Generate and display an exact diff before mutation. Require confirmation for batch operations and for executable files.
  6. Create a recoverable backup or patch so failed tagging operations can be rolled back.
  7. Extend post-write verification to confirm that the shebang remains at byte zero, required directives retain valid positions, permissions are unchanged, and directly executable scripts still resolve to the intended interpreter.
  8. Apply the same correction to both duplicated definitions: SKILL.md and ghost-catalog/SKILL.md.
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description does not clearly warn that some operations modify existing files by prepending headers and create persistent artifacts such as a local SQLite database and markdown reports. Users may invoke the skill expecting a read-only catalog query, but instead cause unintended workspace mutations, which is especially risky when operating across many files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The auto-invocation guidance is overly broad and can cause the skill to trigger on generic requests like asking what files are in a project. Because this skill can scan the workspace, create a SQLite database, write reports, and potentially lead into tagging flows that modify files, overbroad invocation increases the chance of unexpected file access and side effects without explicit user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description and command documentation do not prominently warn that operations like tag and report write to workspace files and create or update a SQLite database. Users may invoke the skill expecting analysis only, but it can prepend headers to files and save reports, creating a consent and integrity risk if run on sensitive or production-managed repositories.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The auto-invocation guidance uses broad phrases such as asking what files are in a project, which can cause the skill to trigger in routine conversations unrelated to explicit cataloging intent. Because this skill can scan the workspace and may later perform write-capable operations, overbroad triggering increases the chance of unintended file enumeration and follow-on modification workflows without sufficiently specific user consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly positions itself for auto-use after a skill invocation and around vague 'skill friction' signals, which creates a trigger surface that can activate without a clear, specific user request. In an agentic environment, broad trigger conditions can cause unintended execution, context expansion, and follow-on file edits, especially because this skill's post-report workflow includes modifying SKILL.md and supporting files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The contextual trigger using phrases like 'improve it' relies on pronoun resolution and recent conversation state, which is inherently ambiguous and prone to misbinding to the wrong skill or action. That can lead the agent to inspect or modify an unintended skill, creating integrity and authorization risks through accidental cross-target changes.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The auto-invocation guidance includes ordinary conversational phrases like 'that didn't work right' and 'how can we make this better,' which are common in normal dialogue and can collide with benign feedback. Because this skill is capable of scanning the project, analyzing other skills, and then editing skill files, accidental activation increases the chance of unintended tool use and unapproved changes.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.