Back to skill

Security audit

Ingest Document

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a document-ingestion workflow, but it uses an overpowered Gitea admin token and unsafe defaults that could expose documents and credentials.

Install only in a controlled environment after replacing the default Gitea URL with an HTTPS endpoint you administer, using a narrowly scoped service token instead of a site-admin token, pinning dependencies, and constraining file inputs/outputs to a per-request attachment directory. Treat this as Review-worthy until those controls are in place.

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

T09 · Insecure Skill Coding Practices

Error
Location
env-example.txt:1
Finding

Administrator Token and Knowledge-Base Documents Transmitted over Plaintext 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, ) ``` ```python # scripts/save_document.py:55-73 g.put_file(args.owner, args.repo, path, content, f"paper-kb ingest: {fname}") archived_path = "" archived_url = "" if args.source_file_path: raw_path = Path(args.source_file_path) if raw_path.exists(): ext = raw_path.suffix.lower() if ext == ".pdf": folder_name = "pdfs" elif ext in {".docx", ".doc"}: folder_name = "docs" elif ext in {".xlsx", ".xls"}: folder_name = "sheets" elif ext in {".txt", ".md", ".markdown"}: folder_name = "text" else: folder_name = "other" archived_path = f"source_files/{folder_name}/{fname}{ext or '.bin'}" g.put_file_bytes(args ...[truncated 2075 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/gitea_api.py:28
Finding

Routine Document Ingestion Uses a Site-Administrator Credential

Content
View full analysis
dict: return {"Authorization": f"token {ADMIN_TOKEN}", "Content-Type": "application/json"} ``` ```python # scripts/gitea_api.py:60-66 def token_is_site_admin() -> bool: try: api("GET", "/admin/users", params={"limit": 1}) return True except GiteaError: return False ``` ```python # scripts/gitea_api.py:99-105 def create_repo_for_user(username: str, name: str, description: str, private: bool = True) -> dict: if repo_exists(username, name): return {"created": False, "html_url": f"{GITEA_URL}/{username}/{name}"} data = api("POST", f"/admin/users/{username}/repos", json_body={ "name": name, "private": private, "description": description, "auto_init": True, "default_branch": "main", }) ``` ### Technical Analysis The Skill explicitly requires `GITEA_ADMIN_TOKEN` and uses it as the authorization credential for all API operations, including ordinary document reads and writes. The client also contains site-administrator API operations such as listing administrative users and creating repositories on behalf of arbitrary users. Document ingestion only needs access to designated personal or team repositories. Giving the same process site-wide administrative authority substantially expands the consequences of a token leak, local process ...[truncated 1329 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/save_document.py:53
Finding

Caller-Controlled Paths Permit Arbitrary Local File Read and Upload

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render_summary_template.py:31
Finding

Unrestricted Output Path Allows Arbitrary Writable File Overwrite

Content
View full analysis
Remediation
View remediation
/`. 3. Create the root directory with restrictive permissions and a server-generated request identifier. 4. Reject symlinks and validate each parent path before writing. 5. Use safe file creation flags such as `O_NOFOLLOW` and, when replacement is not required, `O_EXCL`. 6. Write to a temporary file within the permitted directory and atomically rename it to the final destination. 7. Run the process as an unprivileged account with no write access to application code, startup files, credentials, or system configuration. ]]>

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned Dependencies Are Installed Directly During Setup

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (50)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The code does not implement document-ingestion workflows such as summarization, duplicate detection, source archiving policy, or project/person aggregation updates. Instead, it is a generic Gitea integration/helper module with administrative and repository-management capabilities. While such storage operations could support a knowledge base, the supplied code chunk’s actual behavior is materially different and broader than the declared purpose, especially because it includes undeclared admin-level repo/user operations and collaborator management.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description says this skill ingests a document or note into a knowledge base and includes downstream processing like summarization, archival, duplicate detection, and aggregation updates. The supplied code chunk does none of that. Its primary function is pre-ingestion routing and authorization: identify the sender, determine whether the chat is group or direct, enforce that group chats can only target team KBs, resolve team/group context, infer whether a message may be a team meeting note, and return JSON describing the chosen or pending target KB. It also emits an interactive confirmation card when the target is ambiguous. These behaviors are related to ingestion workflow, but they are materially different from actual ingestion and omit the core declared capabilities. Therefore this code chunk does not accurately represent the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The code only saves an existing local file into a Gitea repo and updates catalog metadata for a small set of page kinds (concept, resource, person, review, import). While this partially aligns with knowledge-base ingestion and duplicate replacement by matching on name, the declared description is broader and emphasizes ingesting uploaded documents/meeting notes/chat material with summaries, source archiving, duplicate checks, and project/person aggregation updates. Those behaviors are not present here except for a limited name-based replace and index/catalog refresh. The code’s concrete primary behavior is repository page save/update, which is narrower and materially different from the fuller ingestion workflow described.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code does not perform document ingestion, summarization, source archiving of an uploaded item, duplicate detection, or project/person aggregation logic. Instead, it sets up and maintains administrative system state in a repository, including users, teams, permissions, jobs, tasks, and chat-account binding metadata. While a 'sources.json' file exists, this chunk only provides generic storage accessors and broader control-plane management, making its primary purpose materially different from the declared ingestion-focused description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied code chunk does not implement the declared ingestion functionality. Its primary purpose is environment/bootstrap setup: installing dependencies and initializing a .env file. While setup scripts can support a skill, this chunk by itself materially differs from the declared purpose and shows none of the stated ingestion behaviors.

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

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This file provisions and manages a system-wide control-plane repository containing users, teams, chat bindings, permissions, jobs, and task state, which materially exceeds the declared purpose of ingesting a single document into a knowledge base. In a skill that should handle document ingestion, introducing centralized administrative state expands authority and blast radius, enabling persistence and cross-user/team control if the skill or its backing account is abused.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Maintaining users, teams, chat bindings, pending bindings, events, and permissions gives the skill identity and access-management capabilities unrelated to simple document ingestion. In context, this is dangerous because it creates covert persistence and authorization surfaces that could be used to map identities, alter access, or bind chats to accounts beyond user 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 · 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
87% confidence
Finding

The skill declares no explicit tool scope or permission boundaries even though its instructions invoke local scripts, temporary file writes, message/context handling, and remote repository operations. In a skill that processes uploaded documents and routes data into personal or team knowledge bases, missing tool restrictions increases the chance of over-broad file, network, or environment access being used unintentionally or abused through prompt-influenced workflows.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The metadata describes very broad ingestion targets ('daily document/link/message') without defining boundaries, allowed sources, or exclusion rules. In a skill that also consumes chat context and uploaded media, this ambiguity can lead to accidental ingestion of sensitive, irrelevant, or attacker-supplied content into the knowledge base, increasing the risk of data poisoning, privacy leakage, and overbroad collection.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The function writes to catalog.json in the repository via g.put_file(...), which modifies user/project data. In this file there is no confirmation prompt, logging/print statement, or explanatory comment/docstring disclosing that the skill performs remote file updates.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The generated index headings and labels are hard-coded in Chinese (文档, 概念, 资源, 人物, 项目, 综述, and meta['cn']). This imposes a specific language/locale in output without any user opt-in or explanation that the repository is intentionally Chinese-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This call writes index.md back to the repository, replacing generated content and potentially affecting user-managed documentation. The code provides no visible confirmation, user-facing log, or inline explanation warning that the skill will overwrite the index file.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This module loads an admin-scoped Gitea token and exposes privileged operations such as creating repositories for arbitrary users and managing collaborators. In a document-ingestion skill, that is excessive capability: if upstream inputs or calling code are compromised, the module can be abused to make unauthorized repository or permission changes across the Gitea instance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

These functions perform admin-token-backed repository creation and collaborator modification with no built-in approval, policy check, or user confirmation boundary. That makes silent privilege-affecting changes possible from application logic, increasing the blast radius of prompt injection, misuse, or simple programming mistakes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The functions write content to repository paths via POST and PUT requests, which can create or overwrite files remotely. The code includes no confirmation prompt, user-facing logging, or inline documentation warning that invoking these helpers will modify repository contents.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The meeting classifier relies entirely on Chinese markers such as "组会" and "会议", and the script also returns Chinese-only user messages. This effectively forces a specific language/locale behavior for all users, which matches the policy-violation category when no opt-in or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated README, schema, and team info templates are entirely in Chinese, and the schema string also includes an instruction that all answers must follow this template language. There is no indication that the user can choose another language or that the skill is explicitly limited to a Chinese-only context, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code emits natural-language messages in Chinese (无法识别入库目标。, 无法识别 ingest_document 卡片动作。) for all users, with no opt-in or indication that the skill is intended only for Chinese-speaking contexts. That creates a language/locale policy concern because the skill forces a specific language in user-visible output.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code writes generated content to a remote repository and may also upload a local source file, but the script provides no confirmation prompt, user-facing print/log message, or inline warning describing those side effects. These operations can affect user data and transmit local file contents over the network, so some visible disclosure is expected.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script uploads file contents to a remote repository with g.put_file and then updates catalog metadata and regenerates an index, which are persistent write operations. Within this code there is no confirmation prompt, user-facing log/print explaining these actions before they occur, or inline comment/docstring disclosing the remote write behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language rules are written as mandatory instructions in Chinese, including statements like '只能基于输入资料填写' and '最后一节必须保留“来源与可追溯信息”', which effectively require summaries to be produced in Chinese. The file does not offer a user language/locale option or document a justified region-specific constraint, so this creates a language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Invite-code generation supports team onboarding and expansion of access, which is outside the stated document-ingestion scope. While the function alone is not exploit code, in this skill context it signals unnecessary account/team lifecycle capability that can facilitate unauthorized enrollment or broaden access pathways if coupled with other weak controls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The function writes or creates repository files via g.put_file, which can alter project documentation and people records, but the code provides no confirmation prompt, no user-facing log/print about the change, and no inline comment or docstring disclosing that behavior. This is a safety-relevant file write operation covered by the code-file criteria for missing user warnings.

Content

No source excerpt is available for this finding.