Back to skill

Security audit

Asset Library Skill

Security checks for vulnerabilities and agentic risk

Overview

This personal document-library skill is mostly coherent, but it needs review because some code can send documents and API keys to configurable or unvalidated network destinations.

Review this before installing if you will process real personal or business documents. Use dedicated low-privilege API keys, keep CAIXU_AGENT_BASE_URL unset unless you fully trust and validate the endpoint, avoid parser export mode until download URL validation and credential stripping are fixed, and point ingestion only at directories you intend to index because extracted text and file paths are stored in a local SQLite database.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
caixu-shared-core/packages/skill-runner/src/index.ts:2017
Finding
Configurable model endpoint can receive API credentials and sensitive document-derived content<![CDATA[ ## Vulnerability Details **File Location**: `caixu-shared-core/packages/skill-runner/src/index.ts:2017-2066, 2128-2158, 2924-2950, 3128-3155` **Vulnerability Type**: Unrestricted outbound destination with credential and sensitive-data forwarding **Risk Level**: High ### Vulnerable Code ```ts const baseUrl = input.baseUrl ?? "https://open.bigmodel.cn/api/paas/v4/chat/completions"; ``` ```ts const response = await fetchWithRateLimitRetry({ scope, url: baseUrl, timeoutMs: timeoutMs ?? input.timeoutMs, maxAttempts: httpMaxAttempts, baseDelayMs: httpBaseDelayMs, maxDelayMs: httpMaxDelayMs, minIntervalMs, onEvent: input.onEvent, label: `Skill model request for ${skillName} (attempt ${attempt})`, init: { method: "POST", headers: { Authorization: `Bearer ${input.apiKey}`, "Content-Type": "application/json", ...input.extraHeaders }, body: JSON.stringify({ model: input.model, temperature: 0, ...(typeof doSample === "boolean" ? { do_sample: doSample } : {}), ...(Number.isFinite(maxTokens) && (maxTokens ?? 0) > 0 ? { max_tokens: Math.trunc(maxTokens ?? 0) } : {}), ...(responseFormat ? { response_format: { type: responseFormat } } : {}), ...(thinkingMode ? { thinking: { type: thinkingMode } } : {}), messages: [ { role: "system", content: systemPrompt }, { role: "user", content: userPrompt } ] }) } }); ``` ```ts const apiKey = process.env.CAIXU_AGENT_API_KEY?.trim() || process.env.ZHIPU_API_KEY?.trim(); return createOpenAICompatibleSkillModelClient({ apiKey, model: process.env.CAIXU_AGENT_MODEL?.trim() || "glm-4.6", baseUrl: process.env.CAIXU_AGENT_BASE_URL?.trim(), timeoutMs: Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : 30000, httpMaxAttempts: Number.isFinite(httpMaxAttempts) && httpMaxAttempts > 0 ? httpMaxAttempts : 4, httpBaseDelayMs: Number.isFinite(httpBaseDelayMs) && ...[truncated 3589 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Restrict model destinations** - Parse the configured URL with the standard `URL` API. - Require HTTPS outside explicitly identified local development mode. - Maintain an allowlist of approved scheme, hostname, and port combinations. - Reject URLs containing user information, fragments, unexpected ports, or malformed hostnames. 2. **Require explicit opt-in for custom providers** - Disable custom `CAIXU_AGENT_BASE_URL` values by default. - Require a separate flag such as `CAIXU_ALLOW_CUSTOM_AGENT_ENDPOINT=true`. - Clearly display the selected destination before transmitting document-derived content. 3. **Separate credentials by destination** - Remove the fallback from `CAIXU_AGENT_API_KEY` to `ZHIPU_API_KEY`. - Require a destination-specific credential. - Ensure a credential configured for one provider is never forwarded to another origin. 4. **Minimize transmitted personal data** - Send only the minimum fields needed for each decision. - Redact unnecessary names, local paths, identifiers, and document details. - Prefer local deterministic processing where model inference is unnecessary. - Obtain informed user consent before sending personal document content externally. 5. **Protect request headers** - Do not allow `extraHeaders` to override `Authorization`, `Host`, or `Content-Type`. - Merge only explicitly allowlisted additional headers. 6. **Harden redirects and network access** - Disable automatic cross-origin redirects or validate every redirect destination. - Reject loopback, private, link-local, multicast, and cloud metadata destinations unless explicitly required. - Add tests proving that HTTP, unapproved domains, and credential forwarding across origins are rejected. 7. **Operational response** - Rotate any credential that may have been used with an untrusted endpoint. - Audit environment configuration and outbound request logs for unexpected model ...[truncated 19 chars]

T09 · Insecure Skill Coding Practices

Error
Location
caixu-ocr-mcp/src/tools/zhipu-file-parser.ts:275
Finding
Parser-provided download URL can receive the Zhipu Bearer credential and enable SSRF<![CDATA[ ## Vulnerability Details **File Location**: `caixu-ocr-mcp/src/tools/zhipu-file-parser.ts:275-289, 316-340` **Vulnerability Type**: Unvalidated remote URL fetch with authorization-header forwarding **Risk Level**: High ### Vulnerable Code The parser response supplies a download URL that is returned without scheme, origin, port, or address validation: ```ts if (input.formatType === "download_link") { const url = payload && typeof payload.parsing_result_url === "string" ? payload.parsing_result_url.trim() : ""; if (!url) { if (input.allowEmpty) { return null; } throw new ParsePipelineError({ code: getInvalidResponseCode(input.mode), message: "Zhipu parser did not return parsing_result_url", retryable: false, taskId: input.taskId }); } return url; } ``` The returned URL is subsequently fetched while forwarding the Zhipu API key: ```ts async function downloadExportBundle(input: { apiKey: string; downloadUrl: string; onEvent?: (event: ZhipuHttpProgressEvent) => void; }): Promise<{ assets: ParserExportAsset[]; bundleText: string | null }> { const retryConfig = getZhipuHttpRetryConfig(); let response: Response; try { response = await fetchWithZhipuRetry({ scope: `zhipu-parser:${input.apiKey.slice(-8)}`, url: input.downloadUrl, timeoutMs: requestTimeoutMs, maxAttempts: retryConfig.maxAttempts, baseDelayMs: retryConfig.baseDelayMs, maxDelayMs: retryConfig.maxDelayMs, minIntervalMs: retryConfig.minIntervalMs, onEvent: input.onEvent, label: "Zhipu parser export download", init: { headers: { Authorization: `Bearer ${input.apiKey}` } } }); } catch (error) { throw new ParsePipelineError({ code: "ZHIPU_PARSER_EXPORT_FAILED", message: error instanceof Error ? error.message : "Failed to download parser export bundle", retryable: true }); } ``` ### Techni ...[truncated 2626 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Validate the download URL before use** - Parse it with `new URL(...)`. - Require `https:`. - Reject embedded credentials and unexpected ports. - Allowlist documented parser download domains or exact approved origins. 2. **Block SSRF destinations** - Resolve the hostname and reject loopback, private, link-local, multicast, unspecified, and reserved address ranges. - Explicitly block cloud metadata destinations, including link-local metadata addresses. - Repeat validation after DNS resolution and immediately before connection to reduce DNS rebinding risk. 3. **Do not forward the API key cross-origin** - If the parser returns a pre-signed download URL, download it without an `Authorization` header. - If authentication is required, send credentials only when the download origin exactly matches a documented trusted provider origin. - Bind each credential to the expected service and destination. 4. **Control redirects** - Use manual redirect handling. - Validate every redirect target using the same scheme, origin, port, and IP rules. - Strip authorization headers whenever the origin changes. - Set a small maximum redirect count. 5. **Constrain response handling** - Enforce maximum download size before buffering the response. - Verify the expected content type and ZIP signature. - Limit archive entry count, individual uncompressed size, and aggregate uncompressed size to reduce decompression-based denial-of-service risk. 6. **Add security tests** - Verify rejection of HTTP URLs, attacker domains, loopback addresses, private addresses, metadata endpoints, and cross-origin redirects. - Verify that approved pre-signed URLs never receive the Zhipu Bearer credential. 7. **Operational response** - Rotate potentially exposed Zhipu API keys. - Review outbound network logs for parser export requests to unexpected hosts. ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (163)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Direct creation and mutation of libraries, parsed files, asset cards, package/lifecycle records, and maintenance operations contradict the documented non-operational role. This broad hidden authority increases the chance of accidental corruption, unauthorized data retention, or misuse of sensitive library contents under a deceptively safe label.

Static analysis

Detected: suspicious.dangerous_exec, suspicious.env_credential_access, suspicious.exposed_secret_literal

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
caixu-data-mcp/src/search-embedder.ts:90

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
caixu-ocr-mcp/src/tools/zhipu-http.ts:149

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
caixu-ocr-mcp/src/tools/extract-parser-text.ts:81

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
caixu-ocr-mcp/src/tools/parse-materials.ts:538