Back to skill

Security audit

markdown-indexer

Security checks for vulnerabilities and agentic risk

Overview

This is a simple Markdown indexing skill with disclosed local file reads and local index output; its examples have minor safety caveats but no hidden or purpose-mismatched behavior.

Install only if you are comfortable generating local metadata about your Markdown files. Treat the generated index as sensitive when the source docs are private, inspect any upload URL before using the curl example, and avoid using the sample command on untrusted filenames or headings without hardening JSON escaping first.

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

Unescaped Markdown Metadata Allows JSON Injection and Index Corruption

Content
View full analysis
/dev/null || echo 0) lines=$(wc -l < "$f") frontmatter=$(head -20 "$f" | grep -c '^---$' || echo 0) echo "{\"file\":\"$f\",\"title\":\"$title\",\"headings_count\":$headings,\"lines\":$lines,\"has_frontmatter\":$frontmatter}" done | jq -s '.' > index.json ``` ### Technical Analysis The Skill constructs JSON by directly interpolating the Markdown-derived title and filesystem-derived path into an `echo` string. Neither value is encoded as a JSON string before being inserted. An attacker who controls a Markdown heading or filename can include quotation marks, backslashes, control characters, or JSON syntax. This can produce either: - Valid JSON containing attacker-injected properties. - Invalid JSON that causes `jq` to fail and prevents creation of the index. - Misleading metadata that is subsequently trusted by search, publication, or automation systems. For example, a heading resembling the following can terminate the intended `title` value and introduce additional properties: ```markdown # Example","trusted":true,"injected":"value ``` Because `jq` receives the already assembled text, it parses the injected structure rather than treating the entire heading as an inert string. This is JSON injection rather than shell command injection: the quoted shell expansions prevent heading contents from being directly interpreted as shell commands. No path to arbitrary code execution, privilege escalation, credential access, or network exfiltration was identified. ### Attack Path 1. An attacker creates or supplies a Markdown file within the directory selected for indexing. 2. The attacker places crafted JSON syntax in th ...[truncated 1405 chars]
Remediation
View remediation
/dev/null) || headings=0 lines=$(wc -l < "$f") frontmatter=$(head -20 "$f" | grep -c '^---$') || frontmatter=0 jq -n \ --arg file "$f" \ --arg title "$title" \ --argjson headings_count "$headings" \ --argjson lines "$lines" \ --argjson has_frontmatter "$frontmatter" \ '{ file: $file, title: $title, headings_count: $headings_count, lines: $lines, has_frontmatter: $has_frontmatter }' done | jq -s '.' > index.json ``` Additional hardening measures: 1. Validate that numeric values match a strict integer format before passing them to `--argjson`. 2. Treat filenames and all document content as untrusted input. 3. Write output to a temporary file and atomically rename it only after `jq` succeeds, preventing a failed scan from replacing a valid index. 4. Enable explicit pipeline error handling in a script, such as `set -euo pipefail`, while handling expected non-match statuses from `grep`. 5. Add regression tests using headings and filenames containing quotes, backslashes, tabs, Unicode characters, and embedded JSON syntax. 6. Ensure downstream consumers accept only the documented schema and reject unexpected properties. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

The hardcoded external URL in the example reinforces an outbound network action as part of the workflow. In the context of a file-indexing skill, this is more dangerous because users may run it on private documentation collections and unintentionally disclose filenames, titles, or repository structure to a third party.

Content

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

jq '[.[] | select(.headings_count > 0)]' index.json > valid-index.json

3. Upload to your knowledge base

curl -X POST https://api.example.com/import -d @valid-index.json

text

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

The hardcoded external URL in the example reinforces an outbound network action as part of the workflow. In the context of a file-indexing skill, this is more dangerous because users may run it on private documentation collections and unintentionally disclose filenames, titles, or repository structure to a third party.

Content

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

jq '[.[] | select(.headings_count > 0)]' index.json > valid-index.json

3. Upload to your knowledge base

curl -X POST https://api.example.com/import -d @valid-index.json

text

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documented command creates index.json via shell redirection, which modifies the user's filesystem. While file creation is central to the skill, the surrounding instructions do not explicitly warn the user that running the command will write output in the current directory.

Content

No source excerpt is available for this finding.