Back to skill

Security audit

qunar-travel-query

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Qunar travel-query helper, but its script can send the user's Qunar API key to any caller-supplied URL.

Install only if you trust every endpoint the agent will use. Before using this skill, restrict requests to known Qunar HTTPS domains and avoid supplying arbitrary or third-party URLs, because the current script can disclose the configured Qunar API key to the chosen endpoint.

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/qunar_query.py:71
Finding
Caller-Controlled API Endpoint Enables Credential Disclosure and Server-Side Request Forgery<![CDATA[ ## Vulnerability Details **File Location**: `scripts/qunar_query.py:71-90` and `scripts/qunar_query.py:151-155` **Vulnerability Type**: Unrestricted authenticated outbound request / SSRF **Risk Level**: High ### Vulnerable Code ```python headers = { "Content-Type": "application/json", "Authorization": api_key } # 3. 发起请求 if method.upper() == "GET": response = requests.get( api_endpoint, headers=headers, params=api_params, timeout=30 ) else: response = requests.post( api_endpoint, headers=headers, json=api_params, timeout=30 ) ``` The destination is supplied directly through a required command-line argument: ```python parser.add_argument( "--api_endpoint", required=True, help="API端点URL(根据去哪儿网API文档填写)" ) ``` ### Technical Analysis The script loads the Qunar API key from the environment and places it in the `Authorization` header of a request sent to the caller-controlled `api_endpoint`. It does not validate the URL scheme, hostname, port, resolved IP address, or redirect destination. Consequently, a caller who can influence the endpoint can direct the authenticated request to an attacker-controlled server and capture the API key. An endpoint using plain HTTP could also expose the credential to network interception. The same primitive can be used for server-side request forgery if the execution environment permits access to internal destinations. Potential targets include loopback services, private-network hosts, link-local addresses, and cloud instance metadata endpoints. GET query parameters or POST bodies are also forwarded to the selected destination. No redirect policy is specified. If the underlying HTTP client follows redirects, an initially acceptable destination could redirect the request elsewhere. Secure handling must ensure credentials are never forwarded to an unvalidated redirect target. This behavior conflicts with the security st ...[truncated 2042 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Eliminate arbitrary endpoint input** - Define fixed API endpoints internally for each supported query type. - Do not allow users, model-generated instructions, or command-line input to select an arbitrary host. 2. **Apply an exact destination allowlist** - Require HTTPS. - Allow only explicitly approved Qunar hostnames. - Normalize and parse the URL before validation. - Reject embedded credentials, fragments, unexpected ports, malformed hostnames, and hostname suffix tricks. 3. **Prevent SSRF through address validation** - Resolve the destination and reject loopback, private, link-local, multicast, reserved, and unspecified addresses for both IPv4 and IPv6. - Protect against DNS rebinding by ensuring the validated address is the address used for the connection. - Avoid relying on hostname string checks alone. 4. **Harden redirect handling** - Prefer disabling redirects for authenticated requests. - If redirects are required, validate every redirect destination using the same scheme, hostname, port, and resolved-address rules. - Strip the `Authorization` header whenever the origin changes. 5. **Minimize credential exposure** - Add the authorization header only after the final request destination has passed validation. - Scope the credential to the narrowest supported API permissions. - Rotate the current credential if the script has previously been used with untrusted endpoints. 6. **Improve documentation and tests** - Remove instructions that tell users to supply arbitrary API endpoints. - Correct the claim that the credential cannot be disclosed to third parties. - Add security tests for attacker-controlled domains, HTTP URLs, user-info URLs, nonstandard ports, redirects, private addresses, IPv6 literals, DNS rebinding, and cloud metadata endpoints. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill instructs the agent to use a script, configure credentials, and call external API endpoints, which implies environment access and outbound network use, yet it declares no explicit tool scope or permission boundaries. This is dangerous because the agent may be allowed to access credentials and make network requests without clear least-privilege constraints, increasing the risk of unintended data exposure or abuse if the skill or referenced resources are modified or adversarial.

Natural-Language Policy Violations

Medium
Confidence
82% confidence
Finding
The skill metadata and user-facing documentation are entirely written in Chinese and present the skill as operating in that language, with no indication that users may choose another language or locale. Under the policy criteria, a language/locale constraint should either be optional or clearly justified; neither is stated here.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The document explicitly states that the skill supports custom API endpoints and parameters, which can cause user-supplied travel queries and other request data to be sent to arbitrary third-party services. In a travel-query skill, this increases SSRF/data-exfiltration style risk and privacy exposure, especially because users may assume requests only go to Qunar-controlled infrastructure.

External Transmission

Medium
Category
Data Exfiltration
Content
timeout=30
            )
        else:
            response = requests.post(
                api_endpoint,
                headers=headers,
                json=api_params,
Confidence
95% confidence
Finding
The external transmission here is not merely expected API usage because the destination is attacker-controlled via api_endpoint while the request includes the loaded API key in headers and arbitrary user-supplied payload data. In the context of a travel-query skill, outbound transmission should be limited to Qunar APIs, so sending secrets and request contents to any URL significantly increases the risk of credential leakage and misuse.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
The script accepts a fully user-controlled --api_endpoint and then sends authenticated requests to that URL using the Qunar API key in the Authorization header. This enables server-side request forgery and credential exfiltration to arbitrary external hosts, because the secret intended for Qunar can be transmitted to attacker-controlled infrastructure.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
文件标题、说明、参数解释和帮助信息全部以中文呈现,没有提供用户可选择的语言或声明该技能仅面向特定中文用户群体。根据语言/区域策略,这可能构成未提供用户选择的语言限定。

Static analysis

No suspicious patterns detected.