Back to skill

Security audit

github-trending

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent GitHub trending helper, but its optional GitHub token handling is unsafe enough that users should review or patch it before installing.

Use unauthenticated mode unless you patch the script. Before setting GH_TOKEN, change the script to pass curl headers with a Bash array or equivalent argument-safe construction, and use only a short-lived, minimally scoped GitHub token.

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

Error
Location
scripts/fetch-trending.sh:16
Finding

Unsafe Shell Expansion May Expose the GitHub Authentication Token

Content
View full analysis
=$SINCE&sort=stars&order=desc&per_page=$COUNT" \ $AUTH \ -H "Accept: application/vnd.github.v3+json" \ ``` ### Technical Analysis The script constructs a curl header as a plain string and later expands `$AUTH` without quotes. Shell quotation marks stored inside a variable do not become shell syntax when that variable is expanded. Consequently, a value such as: ```text -H "Authorization: token SECRET" ``` is split into multiple command-line arguments rather than passed as the intended two arguments: ```text -H "Authorization: token SECRET" ``` Curl may interpret the remaining fragments as positional URLs or options. This can result in unintended outbound requests containing token material and may expose the token through URL handling, DNS resolution attempts, proxy logs, curl diagnostics, or other network telemetry. It also causes the authenticated request to be malformed and likely prevents authentication from working as documented. Because `GH_TOKEN` is incorporated into an unquoted argument string, a specially crafted value containing whitespace and curl options could also alter curl's command-line behavior. This requires an attacker to influence the process environment, but the script should still treat authentication material as opaque data rather than executable command-line structure. The request to GitHub's official API is necessary for the declared trending-repository functionality, and optional authenticated access is legitimate. However, creating potential unintended destinations is not necessary and violates least-privilege network behavior. ### ...[truncated 1421 chars]
Remediation
View remediation
=$SINCE&sort=stars&order=desc&per_page=$COUNT" \ -H "Accept: application/vnd.github.v3+json" \ -H "User-Agent: openclaw-trending" \ | jq -r '.items | to_entries[] | "\(.key+1). \(.value.full_name) ⭐ \(.value.stargazers_count) 🍴 \(.value.forks_count) 🔤 \(.value.language // "N/A") 📝 \(.value.description // "No description" | .[0:120]) 🔗 https://github.com/\(.value.full_name) "' ``` Additional hardening measures: - Use a minimally scoped and short-lived GitHub token. - Keep the API endpoint fixed to `https://api.github.com` and avoid allowing environment variables to override it. - Do not print authentication values in errors, debug traces, or command logs. - Avoid running the script with `set -x`, which could expose header arguments. - Add a regression test that captures curl's argument vector and verifies that the complete authorization header is passed as exactly one argument after `-H`. - Consider using curl's configuration or header-file mechanisms with appropriately protected temporary storage only if process argument visibility is a concern. ]]>
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 (2)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill invokes shell scripts (bash scripts/fetch-trending.sh) and declares required binaries (curl, jq), but it does not define any explicit tool scope such as permissions or allowed-tools. In an agent environment, missing scope boundaries can allow the skill to run with broader shell/network capabilities than intended, increasing the risk of command execution or unintended external access if the script is modified or misused.

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/fetch-trending.sh (reported line 14)May include surrounding context.

sh
SINCE="${1:-$(date -v-7d +%Y-%m-%d)}"
fi
COUNT="${2:-15}"
API="https://api.github.com/search/repositories"

# Optional auth header
AUTH=""

Static analysis

No suspicious patterns detected.