Back to skill

Security audit

GitHub Analyzer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward GitHub repository analyzer that fetches public GitHub data and saves a local Markdown report, with no evidence of hidden persistence, credential access, or destructive behavior.

Install only if you are comfortable with the skill contacting GitHub for repositories you ask it to analyze and saving reports locally. Treat README excerpts and repository descriptions inside generated reports as untrusted content, especially before feeding those reports back into an AI agent or opening them in a Markdown renderer that allows active HTML.

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/analyze_repo.sh:56
Finding

Unsanitized Remote Repository Content Embedded in Generated Reports

Content
View full analysis

Vulnerability Details

File Location: scripts/analyze_repo.sh, lines 56–62 and 271–283
Vulnerability Type: Markdown content injection and potential indirect prompt injection
Risk Level: Medium

Vulnerable Code

bash
README_URL="https://raw.githubusercontent.com/${REPO}/main/README.md"
README_CONTENT=$(curl -sL "$README_URL" 2>/dev/null)
if [ -z "$README_CONTENT" ]; then
    README_URL="https://raw.githubusercontent.com/${REPO}/master/README.md"
    README_CONTENT=$(curl -sL "$README_URL" 2>/dev/null)
fi
README_FIRST_LINES=$(echo "$README_CONTENT" | head -50)

The remotely supplied content is subsequently written directly into the report:

bash
cat >> "$REPORT_FILE" << EOF

---

## 📖 README 摘要 (前 50 行)

\`\`\`markdown
$README_FIRST_LINES
\`\`\`

---

*报告由 github-analyzer 技能自动生成*
EOF

Technical Analysis

The script retrieves a README from a repository selected by the user and embeds its first 50 lines verbatim in a generated Markdown report. The README is attacker-controlled input, but it is not escaped or sanitized before interpolation into the here-document.

An attacker can include a closing Markdown fence in the README and thereby terminate the report's intended code block. Subsequent attacker-controlled content may then be rendered as active Markdown or HTML, including deceptive headings, links, images, or instructions. Repository metadata such as the description is also interpolated into the report without Markdown escaping, although the README inclusion provides the clearest injection path.

This script does not itself execute the injected text as shell commands. However, if the report is later opened in a Markdown renderer, its visual integrity can be compromised. If an AI agent processes the report, attacker-supplied instructions may also act as indirect prompt injection unless that agent treats report excerpts as untrusted data.

Attack Path

  1. An at ...[truncated 1407 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat all GitHub API fields and downloaded repository files as untrusted input.
  2. Do not place untrusted content inside a fixed-length Markdown fence. Select a fence longer than the longest consecutive backtick or tilde sequence present in the input.
  3. Alternatively, prefix every README line with indentation and escape Markdown or HTML metacharacters before writing the report.
  4. Sanitize other remote fields, including repository name, description, language, URLs, and license identifiers, before interpolating them into Markdown tables or links.
  5. Add explicit labels around repository excerpts stating that they are untrusted data and must not be interpreted as operational instructions.
  6. Ensure downstream AI systems use a trust boundary that prevents instructions found in repository content or generated reports from overriding system or user instructions.
  7. Add regression tests using README content containing backtick fences, tilde fences, HTML, misleading links, and prompt-injection text, and verify that all such input remains visibly contained within the excerpt.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises shell-based execution via ./scripts/analyze_repo.sh and declares required binaries (curl, jq), but it does not define any explicit tool scope such as permissions or allowed-tools. This creates an authorization gap where the agent may invoke shell capabilities more broadly than intended, increasing the risk of unintended command execution, filesystem writes, or network access during repository analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Comments, status messages, usage instructions, and output are presented exclusively in Chinese throughout the script. This forces a specific language for end users without opt-in or a documented regional requirement, matching the language/locale policy violation category.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/analyze_repo.sh (reported line 30)May include surrounding context.

sh
# 1. 获取基本信息
echo "📦 获取项目基本信息..."
REPO_INFO=$(curl -s "https://api.github.com/repos/$REPO" 2>/dev/null)

if [ -z "$REPO_INFO" ] || echo "$REPO_INFO" | grep -q '"message": "Not Found"'; then
    echo "❌ 无法获取项目信息,请检查仓库名是否正确"

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/analyze_repo.sh (reported line 61)May include surrounding context.

sh
# 1. 获取基本信息
echo "📦 获取项目基本信息..."
REPO_INFO=$(curl -s "https://api.github.com/repos/$REPO" 2>/dev/null)

if [ -z "$REPO_INFO" ] || echo "$REPO_INFO" | grep -q '"message": "Not Found"'; then
    echo "❌ 无法获取项目信息,请检查仓库名是否正确"

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file is entirely written in Chinese and does not provide an alternative language option or note that the content is intentionally region- or audience-specific. Under the policy for natural-language issues, a skill artifact that effectively requires a specific language without opt-in can be treated as a locale/language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This shell script creates an output directory and writes a generated markdown report to a file under the user's Desktop path. Although the behavior is implicit in the code, there is no explicit warning or confirmation near the write operation that local files will be created, which is the kind of file-write disclosure this rule checks for in code files.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.