Back to skill

Security audit

Kb Web Query

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its stated Research KB web-query purpose, but it handles credentials, attachment paths, and output paths without enough containment.

Review before installing. Only use this skill where payloads are produced by a trusted backend, GITEA_BOT_TOKEN is least-privilege and read-only if possible, Gitea host/repo values are fixed or allowlisted, attachment paths are constrained to an upload directory, and result paths are confined to a task workspace.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gitea_api.py:12
Finding

Gitea Bot Token Can Be Disclosed to a Payload-Controlled Server

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/query_context.py:285
Finding

Payload-Controlled Attachment Paths Allow Arbitrary Local-File Reads

Content
View full analysis
MAX_TOTAL_ATTACHMENT_CHARS: preview = preview[: max(0, len(preview) - (total - MAX_TOTAL_ATTACHMENT_CHARS))] prepared.append({ "attachmentId": item.get("attachmentId"), "fileName": item.get("fileName") or "", "mimeType": item.get("mimeType") or "", "sha256": item.get("sha256") or "", "size": item.get("size") or 0, "temporary": True, "textPreview": preview, "previewAvailable": bool(preview.strip()), "note": "This attachment is a temporary query reference and must not be ingested or cited as a stable KB source.", }) return prepared ``` ```python def read_text_preview(path, max_chars=12000): if not path: return "" file_path = Path(path) if not file_path.exists() or not file_path.is_file(): return "" if file_path.stat().st_size > 50 * 1024 * 1024: return "" suffix = file_path.suffix.lower() try: if suffix == ".docx": return read_docx_text(file_path, max_chars) if suffix == ".pptx": return read_pptx_text(file_path, max_chars) if suffix in TEXT_SUFFIXES: return clip(file_path.read_text(encoding="utf-8", errors="replace"), max_chars) return "" except Exception: return "" ``` ### Technical Analysis The attachment `storagePath` is taken direct ...[truncated 1926 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_task.py:95
Finding

Unrestricted Output Paths Allow Overwriting Process-Writable Files

Content
View full analysis
Remediation
View remediation
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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose is a question-answering skill that performs guided web search, produces external citations, may attach references, and avoids persisting Q&A. The supplied code does none of that. Instead, it operates entirely on local catalog/page metadata for a knowledge base: loading JSON, filtering system/hidden pages, building catalog entries, merging entries, normalizing related page paths, and rendering an index markdown page. There is no dialogue handling, no web search, no citation generation, no attachment handling, and no evident QA-specific non-persistence logic. This is a materially different primary purpose, so it is a clear mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is about answering dialogue questions through guided web search with citations and optional attachments, explicitly stating no QA persistence. The supplied code does none of that: it is a storage/integration component for Gitea that can read files, test for existence, and upsert text content into a repository via authenticated API calls. The persistent write behavior is especially at odds with the declared 'no QA persistence' claim. This is a material description-behavior mismatch, not merely a supporting implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This code chunk is a low-level serialization/input-output helper module, not a KB-answering or web-search skill implementation. Its capabilities are limited to parsing JSON payloads, repairing common JSON formatting issues, extracting JSON from fenced text, escaping control characters, and writing structured result envelopes to disk/stdout. Those behaviors are materially different from the declared end-user purpose. While file I/O utilities can be supporting infrastructure, the absence of any visible logic for search, dialogue response generation, citations, attachments, or QA workflow means the supplied code does not accurately represent the declared description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This code chunk does not implement Research KB question answering or team-guided web search. Instead, its primary function is to read local files and extract preview text from supported formats, including Office documents and source/config/text files. That is a materially different behavior and introduces undeclared local file access/document parsing capabilities not reflected in the description. The absence of the declared search/citation/dialogue behavior and presence of unrelated file-extraction behavior indicate a clear mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The declared purpose focuses on a dialogue-answering skill driven by web search and citations with no persistence. This code chunk does not implement that primary behavior; instead it provides low-level utilities for local content handling and indexing-like operations. Most of these helpers could be supporting implementation details, but the inclusion of local file reading and safe path sanitization indicates access to local KB/doc resources, which is not reflected in the declared description or permissions. Because the actual code behavior centers on utility functions for local document processing rather than the stated QA/web-search flow, this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This file implements authenticated write access to a Gitea repository via upsert_text, which can create or modify repository contents. That capability is materially inconsistent with a skill described as a web-query tool with no QA persistence, increasing the risk of unauthorized data persistence, tampering, or covert exfiltration through repository writes.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill declares no explicit tool restrictions even though its instructions require environment access, local file reads/writes, and network operations. In an agent setting, missing scoped permissions increases the chance the runtime grants broader capabilities than necessary, enabling unintended data access or exfiltration if the skill or upstream inputs are abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example schema explicitly requires the answer to be a '完整中文回答', which imposes a specific language on responses. The file does not indicate that users can choose another language or that this skill is limited to a Chinese-only context for compliance or regional reasons.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code loads a bot token from environment variables and configures a client that can perform authenticated repository operations, including remote writes. In the context of a web-query-only skill, these hidden credentials and mutation capabilities expand the trust boundary unnecessarily and could be abused to alter stored knowledge or persist sensitive material.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

This file accesses a sensitive credential via GITEA_BOT_TOKEN and uses it in Authorization headers for outbound API calls. There is no user-facing notice, logging, or inline documentation here warning that the skill uses stored credentials to authenticate network operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code performs repository writes without any local indication that user interactions may trigger persistent remote changes. Lack of disclosure is dangerous because operators and users may reasonably assume the skill only performs web research, while it can silently modify external state and leave durable artifacts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file hard-codes Chinese natural-language output strings for the reference section heading and default source notices. This creates a locale/language policy issue because generated output is forced into a specific language with no user opt-in or documented region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function constructs user-visible section titles such as "团队上下文" and "外部资料" directly in Chinese. Because these labels are always injected into the final answer, the skill imposes a fixed locale without opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The returned context embeds compacted conversation history, including message content and source metadata, for later processing. Because this forwards prior user/assistant content into downstream analysis and possible web-query planning, the file should provide some visible disclosure or documented warning about reuse of conversation data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The function reads text previews from attachment storage paths and includes that content in the returned context object. This transmits user-provided file content into downstream agent processing, but there is no confirmation prompt, visible user-facing log/print, or code comment warning about this privacy-relevant behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This Python file includes a hardcoded natural-language fallback response in Chinese when answer recovery fails. Because the file does not offer a language/locale option or justify a Chinese-only response, it violates the language/locale policy criterion for natural-language policy violations.

Content

No source excerpt is available for this finding.