Back to skill

Security audit

librag-recall

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently calls a configured LibRAG knowledge-base recall API, with some disclosure and transport-safety caveats users should understand.

Install only if you intend to send knowledge-base questions to your configured LibRAG service. Keep the API key private, prefer a loopback or HTTPS base_url, avoid confidential questions if the endpoint or logs are not trusted, and rotate the key if it may have been exposed.

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/recall.py:160
Finding
Bearer Credential and Sensitive Query Exposure over Unencrypted HTTP<![CDATA[ ## Vulnerability Details **File Location**: `config.json:2` and `scripts/recall.py:160-166` **Vulnerability Type**: Plaintext transmission of sensitive information and sensitive data in URL query parameters **Risk Level**: Medium ### Vulnerable Code `config.json:2`: ```json "base_url": "http://127.0.0.1:8000", ``` `scripts/recall.py:160-166`: ```python request = urllib.request.Request( url=f"{endpoint}?{urllib.parse.urlencode(params)}", headers={ "Accept": "application/json", "Authorization": f"Bearer {api_key}", }, method="GET", ) ``` ### Technical Analysis The script permits an unrestricted `base_url` and does not validate the URL scheme or require TLS for non-loopback destinations. The bundled configuration uses loopback HTTP, but an operator can configure an arbitrary remote `http://` endpoint. In that case, the bearer API key, request, and server response are transmitted without transport encryption. The complete user-supplied question and retrieval parameters are encoded into the URL query string. URLs are commonly recorded by web-server access logs, reverse proxies, monitoring platforms, debugging tools, and error telemetry. Consequently, confidential questions may be exposed even when the endpoint uses HTTPS, because TLS protects data in transit but does not prevent endpoint infrastructure from logging URLs. The API key is correctly placed in the `Authorization` header and is not printed by the script. The vulnerability arises from allowing plaintext remote transport and placing sensitive query content in the URL. ### Attack Path 1. An operator or deployment configuration changes `base_url` to a remote endpoint using the `http://` scheme. 2. A user invokes the skill with a confidential knowledge-base question. 3. The script appends the question and all retrieval parameters to the request URL. 4. The script sends the request over plaintext HTTP with the knowledge-base API key in the `Authorization` he ...[truncated 1134 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require HTTPS for all non-loopback destinations. Parse `base_url` with `urllib.parse.urlparse` and reject unsupported schemes and remote `http://` URLs. 2. If loopback HTTP must remain supported for local development, allow it only for explicit loopback addresses such as `127.0.0.1`, `::1`, and `localhost`, and document that exception. 3. Replace the GET request with a POST request and place the question and retrieval options in an `application/json` request body. 4. Continue sending the API key only through the `Authorization` header. Never include it in URLs, output, logs, or exception messages. 5. Redact questions and other sensitive fields from request diagnostics and operational logs. 6. Apply short credential lifetimes, least-privilege knowledge-base permissions, and routine key rotation to limit the impact of credential disclosure. 7. Consider rejecting URLs containing user information, fragments, or unexpected schemes and explicitly validate the intended LibRAG endpoint before sending credentials. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (5)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill invokes a Python script that reads local configuration and performs outbound network requests, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege controls and increases the chance the skill is invoked with broader capabilities than users or the host expect, especially since it handles secrets like an API key and can contact arbitrary endpoints from config.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The name and description explicitly position the skill for Chinese scenarios only ("zh", "适用于中文场景下") without indicating that users may choose another language or that the restriction is mandatory for compliance reasons. This can violate language/locale policy expectations when no opt-in or justification is provided.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The trigger phrases are broad, natural-language requests such as '去知识库里查一下' and '从文档中找到答案', which can easily overlap with ordinary user intent and cause accidental invocation. In this skill, unintended activation is more concerning because execution reads local config and sends the user's query plus a stored API key to an external service, potentially exposing data or causing unauthorized retrieval from a knowledge base.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
This code sends the user-provided question and multiple request parameters to a remote API endpoint, and includes a bearer API key in the request headers. The script has no confirmation prompt, warning print, or inline user-facing disclosure before transmitting that data, so users may not realize their query content is being sent off-host.

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
The display name and description explicitly present the skill as Chinese-only ("中文召回", "做中文知识库检索") with no indication that users can opt into another language or locale. This can violate language/locale policy when a skill appears to force a specific language without documented justification or user choice.

Static analysis

Detected: suspicious.exposed_secret_literal, suspicious.install_untrusted_source

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
scripts/recall.py:138

Install source points to URL shortener or raw IP.

Warn
Code
suspicious.install_untrusted_source
Location
config.json:2