Back to skill

Security audit

geocode

Security checks for vulnerabilities and agentic risk

Overview

This reverse-geocoding skill is mostly coherent, but it needs review because its script can be redirected to arbitrary network endpoints through an environment setting.

Review before installing in shared, automated, or network-sensitive environments. Use it only if you are comfortable sending queried coordinates to geocode.com.cn and can keep GEOCODE_BASE_URL fixed to a trusted HTTPS endpoint; avoid letting untrusted prompts, users, or configuration set that variable.

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/geocode.sh:22
Finding
Unrestricted geocoding endpoint override enables server-side request forgery<![CDATA[ ## Vulnerability Details **File Location**: `scripts/geocode.sh:22-24, 28-33, 51, 103-116` **Vulnerability Type**: Server-Side Request Forgery through an unvalidated configurable endpoint **Risk Level**: Medium ### Vulnerable Code ```bash curl_json() { curl -fsSL "$@" printf '\n' } curl_hint() { local response response="$( curl -sSL \ -A "$user_agent" \ -w $'\n%{http_code}' \ "${base_url%/}/" )" local http_code="${response##*$'\n'}" local body="${response%$'\n'*}" ``` ```bash base_url="${GEOCODE_BASE_URL:-https://geocode.com.cn}" ``` ```bash args=( --get "${base_url%/}/" -A "$user_agent" --data "lat=$latitude" --data "lon=$longitude" ) if [[ "$lang" != "" ]]; then args+=(--data-urlencode "accept-language=$lang") fi curl_json "${args[@]}" ``` ### Technical Analysis The `GEOCODE_BASE_URL` environment variable is used directly as a curl destination without validating its scheme, hostname, port, resolved IP address, or URL components. Both the `hint` and `reverse` commands consequently permit requests to an arbitrary destination selected through the environment. The curl calls also use `-L`, which follows HTTP redirects. Therefore, even if the initial address appears acceptable, an attacker-controlled server can redirect the request to loopback, private, link-local, or other internally reachable addresses. No validation is performed on redirect destinations. The script returns the fetched response through standard output. The `hint` command may also print an unexpected response body to standard error. This creates a response-capable SSRF condition rather than merely a blind network probe. Exploitation requires the attacker to control `GEOCODE_BASE_URL` or a deployment configuration that supplies it. The documented support for endpoint overrides increases the likelihood that external orchestration or agent-controlled execution could expose this configuration surface. ### Attack Path 1. The attack ...[truncated 1942 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Restrict supported schemes** - Parse the configured URL and permit only `https`. - Reject URLs containing embedded credentials, fragments, or unexpected ports. - Configure curl with `--proto '=https'` and `--proto-redir '=https'`. 2. **Enforce an endpoint allowlist** - In production, allow only the documented `geocode.com.cn` hostname. - If self-hosted providers are required, accept an explicit administrator-managed allowlist rather than an unrestricted URL. - Keep arbitrary endpoint overrides limited to isolated test environments. 3. **Block internal destinations** - Resolve the hostname before making the request. - Reject loopback, private, link-local, multicast, reserved, and cloud metadata address ranges for both IPv4 and IPv6. - Account for all DNS answers and DNS rebinding instead of validating only the textual hostname. 4. **Harden redirect behavior** - Prefer disabling redirects by removing `-L`. - If redirects are functionally required, limit their number and validate every redirect target against the same scheme, hostname, port, and resolved-address policy. - Do not assume validating only the initial URL is sufficient. 5. **Reduce response exposure** - Do not print arbitrary provider error bodies to standard error. - Apply response size and timeout limits, such as `--max-time`, `--connect-timeout`, and `--max-filesize` where supported. - Validate that successful responses have the expected JSON structure and content type before returning them. 6. **Separate testing configuration** - Require an explicit test-mode flag before honoring a custom endpoint. - Ensure production launchers clear or securely define `GEOCODE_BASE_URL`. - Prevent untrusted users or agent-generated input from setting process environment variables. ]]>
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 (3)

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill invokes shell-based functionality via curl but does not declare any explicit tool scope such as permissions or allowed-tools. That creates an avoidable policy gap: an agent may execute network-capable shell commands without clear restriction or review boundaries, increasing the chance of unintended command use or abuse in downstream implementations.

External Transmission

Medium
Category
Data Exfiltration
Content
## Public API Limits

- Use public endpoints only for low-frequency, interactive lookups.
- Send an identifying `User-Agent`; do not use default curl UA for repeated calls.
- Do not loop, bulk geocode, or aggressively retry against the public endpoint.

## Commands
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The script defaults to `https://geocode.com.cn` and its user-facing messages describe that provider as the expected service, which imposes a specific regional service choice by default. This is a natural-language locale/policy concern because users are not offered an explicit opt-in or rationale for the China-specific provider selection.

Static analysis

No suspicious patterns detected.