Back to skill

Security audit

Query Kb

Security checks for vulnerabilities and agentic risk

Overview

This knowledge-base query skill has a coherent purpose, but it requires and uses broad Gitea administrator access in under-scoped ways that can read, write, and log sensitive repository data.

Install only in a tightly controlled environment after replacing the admin token with least-privilege read/write credentials, enforcing HTTPS, adding per-operation authorization checks, and deciding whether raw query logging into Git history is acceptable for your users and data.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
env-example.txt:1
Finding

Site-Administrator Token and Knowledge-Base Data Transmitted over Plain HTTP

Content
View full analysis
dict: return {"Authorization": f"token {ADMIN_TOKEN}", "Content-Type": "application/json"} def api(method: str, path: str, *, json_body: dict | None = None, params: dict | None = None, ok: tuple[int, ...] = (200, 201, 204)): if not GITEA_URL: raise GiteaError("GITEA_URL is not configured") resp = requests.request( method, f"{GITEA_URL}/api/v1{path}", headers=headers(), json=json_body, params=params, timeout=30, ) ``` ### Technical Analysis The example environment installs a hard-coded bare-IP URL using unencrypted HTTP. The setup script copies this configuration into `.env` by default, and the API client attaches `GITEA_ADMIN_TOKEN` to every request as an Authorization header. HTTP provides neither confidentiality nor server authentication. Any network observer or active man-in-the-middle can capture the administrator token, inspect private knowledge-base content, or alter API responses and uploaded data. A timeout does not mitigate transport interception, and TLS certificate validation cannot occur because the configured protocol is HTTP. The token is explicitly named and used as an administrator credential. The same client contains administrative operations such as repository creation for a ...[truncated 1191 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/kb_read.py:14
Finding

Caller-Controlled Repository Access Executes with a Shared Administrator Credential

Content
View full analysis
None: parser = argparse.ArgumentParser() parser.add_argument("--owner", required=True) parser.add_argument("--repo", required=True) parser.add_argument("--path", required=True) args = parser.parse_args() path = args.path.strip().strip("/") if not path.endswith(".md") and "." not in path.split("/")[-1]: path += ".md" result = g.get_file(args.owner, args.repo, path) ``` ```python # scripts/kb_list.py:14-20 def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--owner", required=True) parser.add_argument("--repo", required=True) parser.add_argument("--kind", default="all", choices=["all", "documents", "concepts", "resources", "people", "projects", "reviews", "imports"]) parser.add_argument("--log_question", default="") args = parser.parse_args() cat = catalog.read(args.owner, args.repo) ``` ```python # scripts/log_query.py:14-30 def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--owner", required=True) parser.add_argument("--repo", required=True) parser.add_argument("--open_id", required=True) parser.add_argument("--question", required=True) parser.add_argument("--scope", default="") parser.add_argument("--hits", default="") args = parser.parse_args() entry = f"- `{now_str()}` **query** | user={args.open_id} scope={args.scope} | {args.question}" if args.hits: entry += f" | hits={args.hits}" entry += "\n" existing = g.get_file(args.owner, args.repo, "log.md") if existing: g.put_file(args.owner, args.repo, "log.md", existing[0] + entry, "paper ...[truncated 2695 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/log_query.py:14
Finding

Raw User Identifiers and Sensitive Questions Are Persistently Committed to Git History

Content
View full analysis
None: parser = argparse.ArgumentParser() parser.add_argument("--owner", required=True) parser.add_argument("--repo", required=True) parser.add_argument("--open_id", required=True) parser.add_argument("--question", required=True) parser.add_argument("--scope", default="") parser.add_argument("--hits", default="") args = parser.parse_args() entry = f"- `{now_str()}` **query** | user={args.open_id} scope={args.scope} | {args.question}" if args.hits: entry += f" | hits={args.hits}" entry += "\n" existing = g.get_file(args.owner, args.repo, "log.md") if existing: g.put_file(args.owner, args.repo, "log.md", existing[0] + entry, "paper-kb: log query", sha=existing[1]) else: g.put_file(args.owner, args.repo, "log.md", "# Log\n\n" + entry, "paper-kb: init log") ``` ```bash # SKILL.md:124-130 ### 7. 写查询日志 查了哪个库就写哪个库;跨库两个都写: python3 scripts/log_query.py --owner --repo \ --open_id --question "<用户问题>" --scope "" --hits "<命中页面>" ``` ### Technical Analysis The logger commits the full OpenClaw user identifier, raw question text, scope, and page hits to `log.md`. Git commits preserve historical content even after a later edit, so secrets or personal information included in a question can remain recoverable from repository history. No minimization, redaction, retention policy, consent control, or secret detection is applied. The question and hit values are also interpolated directly into Markdown without normalizing newlines or control characters. A crafted multiline value can forge apparent log records, insert headings or links, or otherwise corrupt the integrity of the audit log. The do ...[truncated 1384 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned Python Dependencies Are Installed from the Active Package Index

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (40)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the packaged implementation creates/manages a private system configuration repository and persists admin metadata, permissions, and invite codes, that is materially more privileged than a simple KB query skill. Hidden control-plane persistence under a benign QA description increases the blast radius of misuse and can expose or alter organizational metadata.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

This module performs repository writes via g.put_file, which conflicts with the stated purpose of a query-only, strictly grounded knowledge-base answering skill. In a read-oriented skill, write capability expands the attack surface from passive retrieval to persistent state modification, enabling unauthorized content changes, tampering with knowledge-base artifacts, or abuse if an attacker can influence inputs reaching this function.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The index regeneration function derives content from catalog entries and writes index.md back to the repository, creating a persistent modification path inside a skill that should only answer questions. Because generated content incorporates fields like title, brief, and file-derived names, an attacker who can influence catalog data may cause misleading or malicious repository content to be published, violating least privilege and strict query-only expectations.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/gitea_api.py (reported line 20)May include surrounding context.

python
except ImportError:
        return
    here = Path(__file__).resolve().parent
    for candidate in (here / ".env", here.parent / ".env"):
        if candidate.exists():
            load_dotenv(candidate)
            return

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The module reads a Gitea admin token from the environment and uses it for all API requests, granting the skill administrative power unrelated to answering KB questions. If the agent, its prompts, or any connected code path are abused, an attacker could leverage this token to perform privileged repository and user-management actions across the Gitea instance.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This helper includes repo creation, collaborator management, and file write primitives even though the skill is described as query-only knowledge-base access. In an agent context, exposing broad mutation capabilities creates a clear privilege/intent mismatch and could let prompts or higher-level logic modify repositories, permissions, or stored content instead of only retrieving grounded answers.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This module creates and mutates a separate remote 'system-config' repository that acts as a control plane, storing operational state such as users, teams, bindings, jobs, and permissions. For a skill described as query-only, this is a major scope expansion: if exposed through the agent, it enables persistent state changes and administrative side effects unrelated to grounded KB answering, increasing the risk of unauthorized configuration tampering or hidden backchannel behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The initialized files include users, teams, chat bindings, pending bindings, events, jobs, active tasks, and permissions, which are administrative data domains far beyond answering KB questions. In the context of a query-grounded assistant, maintaining this state creates an unnecessary privilege surface that could allow account mapping, task orchestration, or permission manipulation if the surrounding system exposes these helpers.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · setup.sh (reported line 4)May include surrounding context.

sh
#!/usr/bin/env bash
set -e
python3 -m pip install -r requirements.txt
if [ ! -f .env ]; then cp env-example.txt .env; fi
echo "setup complete"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill specifies execution of multiple local scripts and implies access to environment data, repository/network resources, and files, but it does not declare any explicit tool scope or permission boundaries. That creates an over-privilege risk: a runtime may grant broader capabilities than necessary, making misuse or accidental access to unrelated data more likely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly logs the user's identifier, question text, scope, and hits, but the markdown provides no user-facing notice, consent flow, retention policy, or access restrictions for those logs. This creates privacy and compliance risk because sensitive queries about personal or team knowledge may be stored without transparency or minimization.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The logging command captures open_id, the full user question, the queried scope, and hit pages, which can reveal identity, interests, and internal knowledge structure. In the context of personal/team KB queries, that metadata can itself be sensitive, especially if stored broadly or retained indefinitely.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill is described as a query-only knowledge-base retriever, but it requests a GITEA_ADMIN_TOKEN, which is a highly privileged capability unrelated to answering grounded KB questions. Granting admin-level repository or platform access to a retrieval skill violates least-privilege and creates a serious risk that a prompt injection, implementation flaw, or future code change could abuse the token to read, modify, or administer Gitea resources far beyond the intended scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generated index content is hard-coded in Chinese, including section headings like "文档", "概念", and use of meta['cn']. This imposes a specific language choice on output without any visible user preference, opt-in, or justification for a region-specific constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code performs state-changing operations against Gitea, including repository creation, collaborator changes, and file writes, but provides no confirmation prompt, logging, print statement, or explanatory docstring/comment to disclose those actions to the user. Because these operations modify remote repositories and access them using an admin token, the absence of any in-file warning makes the behavior insufficiently disclosed under the code-file warning criterion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script logs the full user question and optional hit data directly into a repository file, creating persistent storage of potentially sensitive user content outside the minimum needed to answer KB queries. In the context of a personal/team knowledge-base skill, questions may contain confidential business information, secrets, or personal data, and storing them in versioned repo history makes later deletion and access control harder.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script writes raw user-supplied question text to a repository log without any evidence of disclosure, consent, filtering, or sensitivity checks. For a skill handling personal and team KB queries, users may reasonably enter private or regulated information, so silent capture into a repo can create an unexpected privacy leak and broaden access to that data through repository readers and commit history.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
77% confidence
Finding

This script reads and writes log.md in a Gitea repository using get_file and put_file. For a skill whose stated purpose is answering questions from knowledge bases, persistent repository modification is not an obvious core capability unless explicitly declared as the mechanism for audit logging.

Content

No source excerpt is available for this finding.