Back to skill

Security audit

Kb Ingest

Security checks for vulnerabilities and agentic risk

Overview

The skill’s main behavior matches its knowledge-base ingestion purpose, but it trusts task-supplied local file paths and repository targets while using an administrative Gitea token.

Review before installing. Use a repository-scoped service token instead of an admin token, enforce a server-side upload root and repository allowlist, reject symlinks and path traversal, verify file hashes, and scan/redact secrets before archiving or publishing uploaded material.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/run_task.py:453
Finding

Unrestricted uploadedPath permits arbitrary local file disclosure to Gitea repositories

Content
View full analysis
tuple[str, dict]: uploaded = Path(file["uploadedPath"]) if not uploaded.exists(): raise FileNotFoundError(str(uploaded)) owner = target["repoOwner"] repo = target["repoName"] source_file_key = sanitize_filename(file.get("sourceFileId") or uploaded.stem) folder = "code" if is_code_related(file) else source_folder(file.get("fileKind", ""), file.get("originalFileName", "")) archived_path = normalize_repo_path(f"source_files/{folder}/{source_file_key}-{sanitize_filename(file.get('originalFileName') or uploaded.name)}") if (task.get("payload") or {}).get("options", {}).get("archiveSourceFile", True): g.put_file(owner, repo, archived_path, uploaded.read_bytes(), f"research-kb archive source: {uploaded.name} [{task.get('taskId')}]") return archived_path, {"sourceFileId": file.get("sourceFileId"), "path": archived_path} ``` `scripts/run_task.py:482-493`: ```python for file in files: if remaining <= 0: break uploaded = Path(file["uploadedPath"]) try: text = text_extractors.extract_text(str(uploaded), min(max_file_chars, remaining)) except Exception as exc: text = f"[Could not extract text: {exc}]" if not text.strip(): continue header = f"\n\n### {file.get('relativePath', '')}\n\n" chunk = text[:min(max_file_chars, remaining)] lines.append(header + chunk) ``` ### Tech ...[truncated 2468 chars]
Remediation
View remediation
Path: candidate = Path(value) if candidate.is_symlink(): raise ValueError("Symbolic links are not permitted") resolved = candidate.resolve(strict=True) try: resolved.relative_to(UPLOAD_ROOT) except ValueError as exc: raise ValueError("uploadedPath is outside the upload root") from exc if not resolved.is_file(): raise ValueError("uploadedPath must identify a regular file") return resolved ``` 2. Prefer an opaque upload identifier supplied by the task and resolve it to a path through trusted backend state. Do not allow clients to provide arbitrary filesystem paths. 3. Reject symlinks and mitigate time-of-check/time-of-use races. Where practical, open files using platform protections such as `O_NOFOLLOW`, then validate the opened file descriptor. 4. Recompute and compare the file's SHA-256 digest with trusted upload metadata before processing or archiving it. 5. Enforce maximum file sizes before reading content into memory. 6. Validate `repoOwner`, `repoName`, `repoFullName`, `kbType`, and branch against targets authorized by the trusted backend. 7. Replace the administrative token with a repository-scoped bot token holding only the minimum required read and write permissions. 8. Add tests covering absolute paths, `..` traversal, symlink escapes, non-regular files, hash mismatches, and unauthorized repository targets. ]]>

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Setup installs unpinned third-party dependencies without integrity verification

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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (42)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description presents a pipeline that compiles uploaded source files into Markdown wiki pages, writes them to Gitea, archives the original sources, and returns structured JSON. The supplied code chunk instead implements catalog maintenance: it reads/writes catalog.json, upserts document metadata, and generates an index.md listing compiled pages. While writing to Gitea is consistent, the primary behavior here is metadata/index management rather than source compilation or source archiving. Those declared core capabilities are absent from this chunk, making the description materially inaccurate for the code shown.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description describes a pipeline that compiles uploaded source files into Markdown wiki pages, writes them to Gitea, archives the sources, and returns structured results. This code chunk does something materially different: it only reads a catalog and checks for duplicates based on source_file_id or source_path, then emits a small JSON result. It does not generate Markdown, compile content, write anything to Gitea, or archive sources. Duplicate checking could be part of a larger pipeline, but for this supplied code chunk the actual behavior is a distinct capability not represented by the declared purpose, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises a pipeline that compiles backend-uploaded source files into Research KB wiki pages, writes them to Gitea, archives the sources, and returns structured JSON. The provided code only accepts --code_pack and --save_to, derives the source filename/stem, constructs a fixed Markdown template, and writes that text to a local file. There is no archive expansion, source inspection, KB compilation logic, Gitea interaction, archiving, or JSON output. This is therefore a clear material mismatch in both primary purpose and implemented capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code chunk is not the described end-to-end workflow. It is a low-level Gitea client utility for repository content access: building auth headers, calling Gitea endpoints, reading file contents, and creating/updating files. While writing files to Gitea is consistent with one part of the description, the code does not compile uploaded source files, generate Research KB Markdown wiki pages, archive sources, or orchestrate/return structured workflow results. It also uses privileged Gitea admin-token access, which is an undeclared external capability/resource. Therefore the declared description does not accurately represent this code chunk's actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The supplied code chunk only contains static folder mappings plus helper functions to detect a document type and choose a corresponding folder. It does not implement the declared end-to-end workflow of compiling uploaded sources into Markdown, writing results to Gitea, archiving inputs, or returning structured JSON. While this code could be a supporting component within such a system, taken on its own its actual behavior is materially narrower and different from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description promises a substantial content-processing and publishing pipeline: transforming backend-uploaded source files into Markdown wiki pages, writing them to Gitea, archiving sources, and returning structured JSON results. The supplied code does none of those core actions. It is a small CLI utility that selects template data from a local module, packages it into JSON, optionally saves it to a local path, and prints the JSON. While it does return structured JSON-like output, that is only a minor subset of the declared behavior and not the primary purpose described. Therefore, the code chunk materially differs from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The declared description suggests a fuller ingestion pipeline: transforming uploaded source files into KB Markdown pages, archiving sources, writing to Gitea, and returning structured JSON results. This code chunk only implements a narrower save step. It reads text from an existing summary file, determines a destination path, writes the file to Gitea, updates catalog metadata, regenerates an index, and prints a result object. There is no visible compilation of source inputs into the summary, no source archival action, and no explicit JSON serialization. Because the primary behavior is only partially aligned and omits key declared functions while adding catalog/index updates, this is a material description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The code's actual function is narrowly focused on saving an already-generated report file into a Gitea repository under an imports path. It does not perform compilation of source files, does not create wiki pages from uploaded backend sources, and does not archive any sources. While it does write Markdown content to Gitea and print a small JSON-like result, the primary purpose is materially narrower and different from the declared end-to-end import/compile/archive workflow.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code chunk only contains constant template data and a simple lookup function. It does not perform the declared end-to-end workflow of compiling uploaded source files, generating wiki pages, writing to Gitea, archiving inputs, or returning structured JSON results. This is a materially different behavior from the declared purpose, so it should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a full KB ingestion pipeline: transforming uploaded source files into Markdown pages, writing them to Gitea, archiving the originals, and returning structured results. The supplied code chunk only performs basic schema validation on a task object by checking protocol, task type, KB target count, and file presence. This is materially different from the declared primary purpose and lacks the main advertised capabilities. While validation could be a supporting detail within such a system, this code chunk by itself does not implement the described behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied code chunk is a file content extraction helper, not a pipeline that compiles uploaded source files into wiki pages and publishes them. It reads local files, extracts text from supported document formats, and lists contents of ZIP/TAR/GZ archives. There is no logic for generating Markdown wiki pages, interacting with Gitea, archiving sources, or producing structured JSON outputs. This is a material description-to-behavior mismatch because the primary function implemented here is text extraction/inspection rather than KB compilation and publication.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · scripts/run_task.py (reported line 36)May include surrounding context.

python
"pom.xml", "build.gradle", "settings.gradle", "gradle.properties",
    "cargo.toml", "go.mod", "go.work", "composer.json", "gemfile",
    "makefile", "cmakelists.txt", "dockerfile", "docker-compose.yml", "docker-compose.yaml",
    ".env", ".env.example", ".gitignore", ".dockerignore", ".npmrc", ".yarnrc",
    ".prettierrc", ".eslintrc", ".babelrc",
}

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/run_task.py (reported line 36)May include surrounding context.

python
"pom.xml", "build.gradle", "settings.gradle", "gradle.properties",
    "cargo.toml", "go.mod", "go.work", "composer.json", "gemfile",
    "makefile", "cmakelists.txt", "dockerfile", "docker-compose.yml", "docker-compose.yaml",
    ".env", ".env.example", ".gitignore", ".dockerignore", ".npmrc", ".yarnrc",
    ".prettierrc", ".eslintrc", ".babelrc",
}

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/run_task.py (reported line 293)May include surrounding context.

python
"pom.xml", "build.gradle", "settings.gradle", "gradle.properties",
    "cargo.toml", "go.mod", "go.work", "composer.json", "gemfile",
    "makefile", "cmakelists.txt", "dockerfile", "docker-compose.yml", "docker-compose.yaml",
    ".env", ".env.example", ".gitignore", ".dockerignore", ".npmrc", ".yarnrc",
    ".prettierrc", ".eslintrc", ".babelrc",
}

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill declares capabilities that imply access to environment variables, local files, repository writes, and network operations, but it does not constrain tool scope with an explicit permissions or allowed-tools policy. In a skill that reads credentials from environment variables and writes to Gitea, this materially increases the blast radius if the implementation is swapped, extended, or prompted into unintended actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is designed to persist uploaded source material and modify a remote repository, yet it provides no explicit safety warning about durable storage, publication, or repository mutation. In a knowledge-base ingestion context, this can lead to accidental disclosure of proprietary code, secrets copied from source files, or unintended commits to the wrong repository if upstream controls fail.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The operational steps mandate archiving and repository updates but omit any user-facing or operator-facing safety notice about persistent storage and content modification. Because the skill handles backend-uploaded source files, the context makes this more dangerous: source code often contains sensitive material, and silent persistence increases the chance of confidential data being stored long-term or exposed via Gitea.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The instruction to use Chinese structure for generated wiki pages imposes a specific language requirement. The file does not present this as user-selectable or justify it as a documented region-specific constraint, which makes it a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This line states that the ingestion stage should convert materials into Chinese knowledge pages, which enforces a locale choice. No opt-in, override mechanism, or policy justification is provided in the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest explicitly requires a GITEA_ADMIN_TOKEN, which grants elevated repository or instance-wide privileges, but the skill description and metadata provide no warning that the skill will access highly privileged credentials or perform sensitive operations. In the context of a file-ingestion skill that writes content to Gitea, use of an admin token materially increases blast radius: any prompt injection, logic flaw, or misuse in the skill could lead to unauthorized repository modification, data exposure, or broader administrative actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file hard-codes user-visible type labels in Chinese, and later generates user-facing markdown content from them. This enforces a specific language/locale in output without any opt-in, configuration, or documented regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The generated markdown includes fixed Chinese section headings and status text such as '当前状态' and '快速入口'. This is a natural-language locale policy issue because the skill outputs a specific language by default with no user-selectable alternative.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The api() helper performs outbound HTTP requests to the configured Gitea server using an administrative token, which can transmit repository contents and metadata. In this file there is no confirmation prompt, user-facing log/print, or explanatory comment/docstring warning that network operations using privileged credentials will occur.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

put_file() and ensure_file() create or overwrite files in repositories via the Gitea contents API, which is a file-write operation affecting user data. The code provides no user-facing warning, confirmation, or inline documentation describing that repository contents on the main branch may be modified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file contains multiple hard-coded Chinese strings for generated summaries and reports, indicating the skill forces a specific output language regardless of user preference. There is no visible language-selection mechanism or opt-in in this file, which violates the language/locale policy criterion.

Content

No source excerpt is available for this finding.