Back to skill

Security audit

Rag Knowledge Assistant

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent local RAG skill, but it exposes indexed document snippets through an unauthenticated web API and has unsafe local file-handling paths.

Install only if you are comfortable running a local document search service. Bind it to 127.0.0.1, add authentication before any network exposure, index only non-sensitive trusted documents, do not load vector stores from untrusted sources, and avoid using --rebuild with any path you have not verified.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/rag_api.py:242
Finding

Unauthenticated RAG API exposes indexed document content on all network interfaces

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/hybrid_retriever.py:377
Finding

Unsafe pickle deserialization permits arbitrary code execution from a crafted BM25 index

Content
View full analysis
bool: index_path = Path(index_dir) bm25_path = index_path / "bm25_index.pkl" if bm25_path.exists(): with open(bm25_path, 'rb') as f: data = pickle.load(f) self.bm25_index = data['bm25_index'] self.documents = data['documents'] self.doc_ids = data['doc_ids'] self.stats = data['stats'] config_path = index_path / "hybrid_config.json" if config_path.exists(): with open(config_path, 'r', encoding='utf-8') as f: config = json.load(f) self.bm25_weight = config.get('bm25_weight', 0.4) self.vector_weight = config.get('vector_weight', 0.6) self.rrf_k = config.get('rrf_k', 60) self.top_k = config.get('top_k', 10) self.use_jieba = config.get('use_jieba', True) return self.bm25_index is not None ``` This method is invoked during API startup in `scripts/rag_api.py:158-159`: ```python if retriever.load_index(str(vectorstore_path)): hybrid_retriever = retriever ``` It is also invoked by the CLI in `scripts/rag_query.py:151`: ```python if retriever.load_index(vectorstore_dir): return retriever ``` ### Technical Analysis Python pickle is an executable object serialization format. During `pickle.load()`, a serialized object can define reduction behavior that imports and invokes arbitrary Python callables. Consequently, parsing a malicious pickle can execute code before the loaded dictionary fields are validated. The index directory is selected through a CLI argument or the `VECTORSTORE_DIR` environment variable. The code does not verify file ownership, restrictive permissions, a cryptographic signa ...[truncated 1685 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/index_knowledge.py:330
Finding

Unrestricted rebuild option recursively deletes an arbitrary user-selected directory

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
scripts/requirements.txt:4
Finding

Open-ended dependency constraints make installations non-reproducible and increase supply-chain exposure

Content
View full analysis
=0.1.0 langchain-community>=0.0.10 langchain-text-splitters>=0.0.1 chromadb>=0.4.0 sentence-transformers>=2.2.0 transformers>=4.40.0 torch>=2.0.0 pypdf>=3.0.0 unstructured>=0.10.0 python-docx>=0.8.11 openpyxl>=3.1.0 pdfplumber>=0.9.0 pdf2image>=1.17.0 fastapi>=0.110.0 uvicorn>=0.27.0 pydantic>=2.0.0 requests>=2.31.0 numpy>=1.24.0 rank-bm25>=0.2.2 jieba>=0.42.1 ``` The installation instructions execute: ```bash pip install -r requirements.txt ``` `SKILL.md:145` also recommends installing packages without version constraints: ```bash pip install rank-bm25 jieba fastapi uvicorn ``` ### Technical Analysis Lower-bound-only constraints permit pip to install any future version satisfying the minimum. The resulting direct and transitive dependency graph can therefore differ significantly between installations and may include versions never tested or reviewed with this Skill. No lock file, package hashes, integrity policy, or restricted package index is provided. Some dependencies have extensive transitive dependency trees and may execute build backend or installation logic during installation. No malicious or typosquatted package was identified in the reviewed declarations. The issue is the lack of reproducibility and integrity controls rather than evidence that a listed package is currently malicious. ### Attack Path 1. A user follows the documented dependency installation instructions. 2. pip queries its configured package index and resolves the newest versions satisfying the lower bounds. 3. The resolver selects direct or transitive package versions that were not reviewed with this project. 4. If a future release or transitive dependency is compromised, malicious installation or runtime cod ...[truncated 643 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (90)

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 · PUSH_GUIDE.md (reported line 59)May include surrounding context.

gh auth status

text

不建议把 Personal Access Token 写进 remote URL 或 shell history。优先使用 SSH、GitHub CLI 或系统 credential manager。

## ClawHub 发布

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Undisclosed reliance on a local Ollama HTTP API and incomplete implementation of the promised hybrid retrieval/FastAPI/auto-query features is a real security concern because it hides an external communication path and runtime dependency from users. Hidden or misstated dependencies make consent, threat modeling, and containment harder, particularly in an agent setting with automatic requests.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

Undisclosed reliance on a local Ollama HTTP API and incomplete implementation of the promised hybrid retrieval/FastAPI/auto-query features is a real security concern because it hides an external communication path and runtime dependency from users. Hidden or misstated dependencies make consent, threat modeling, and containment harder, particularly in an agent setting with automatic requests.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

Undisclosed reliance on a local Ollama HTTP API and incomplete implementation of the promised hybrid retrieval/FastAPI/auto-query features is a real security concern because it hides an external communication path and runtime dependency from users. Hidden or misstated dependencies make consent, threat modeling, and containment harder, particularly in an agent setting with automatic requests.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding

Undisclosed reliance on a local Ollama HTTP API and incomplete implementation of the promised hybrid retrieval/FastAPI/auto-query features is a real security concern because it hides an external communication path and runtime dependency from users. Hidden or misstated dependencies make consent, threat modeling, and containment harder, particularly in an agent setting with automatic requests.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

uvicorn rag_api:app --host 0.0.0.0 --port 8000

查询

curl -X POST http://localhost:8000/query
-H "Content-Type: application/json"
-d '{"query": "问题", "top_k": 5}'

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

uvicorn rag_api:app --host 0.0.0.0 --port 8000

查询

curl -X POST http://localhost:8000/query
-H "Content-Type: application/json"
-d '{"query": "问题", "top_k": 5}'

text

Possible Typosquatting: 'uvicorn' resembles popular package 'gunicorn'

High
Category
Supply Chain
Confidence
70% confidence
Finding

Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README describes building a local document index and exposing a FastAPI query endpoint that returns answer snippets with sources, but it does not warn that indexed confidential files may be surfaced through API responses. Users may deploy the service or enable auto-query features without understanding that sensitive local content can be retrieved and disclosed through localhost services, logs, screenshots, or downstream agent responses.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 114)May include surrounding context.

查询 API:

bash
curl -X POST http://localhost:8000/query \
  -H "Content-Type: application/json" \
  -d '{
    "query": "香港专才计划的签证有效期是多久?",

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example trigger phrases are broad natural-language requests like '从知识库查一下公司年假规定' and '香港专才计划的签证有效期是多久?', which are indistinguishable from ordinary user questions. In an auto-query integration context, this can cause the skill to activate unexpectedly and send user prompts to the local RAG system without explicit intent, increasing the chance of unintended retrieval of sensitive local document content.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill clearly instructs use of shell commands, file operations, environment activation, and local HTTP networking, yet it declares no explicit tool scope or permissions boundaries. That omission weakens reviewability and can allow an agent runtime to invoke broader capabilities than users expect, especially because the skill also describes automatic query behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill description and all documented triggers are presented exclusively in Chinese, indicating a fixed language experience rather than an opt-in language preference. Under the policy, locale or language constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger condition 'any query about indexed documents' is too broad for an agent skill that can perform automatic retrieval and network requests. Overbroad triggering can cause unintended activation on sensitive prompts, leading to unnecessary data exposure to the local RAG service or surprising tool use without clear user intent.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

The skill explicitly performs HTTP POST requests carrying user queries to a localhost API. Localhost transmission is less severe than remote exfiltration, but it still crosses a trust boundary into another process that may log requests, use different access controls, or forward content to additional components.

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

uvicorn rag_api:app --host 0.0.0.0 --port 8000

查询

curl -X POST http://localhost:8000/query
-H "Content-Type: application/json"
-d '{"query": "问题", "top_k": 5}'

text

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation says users can ask directly in conversation and the system will automatically call the RAG API, but it does not define decision boundaries, opt-in, or suppression conditions. In an agent context, ambiguous auto-invocation materially increases the chance of accidental tool use and silent transmission of user content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes automatically sending conversational queries to a local HTTP service but does not warn users that their prompt text will leave the chat context and be transmitted elsewhere. Even when the destination is localhost, this is still a separate service boundary with logging, retention, or downstream model-processing implications.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
72% confidence
Finding

Running the API with nohup/background persistence is not inherently malicious, but it can leave a long-lived local service running beyond the user's awareness. Persistent background services increase the window for unintended access, stale configuration, exposed logs, or continued processing of later requests.

Content

Scanner excerpt · SKILL.md (reported line 107)May include surrounding context.

uvicorn rag_api:app --host 0.0.0.0 --port 8000

或后台运行

nohup uvicorn rag_api:app --host 0.0.0.0 --port 8000 > rag_api.log 2>&1 &

text

### 阶段 3:查询使用

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document title, warning, and description are entirely in Chinese, which constitutes a language constraint in the skill’s natural-language interface. There is no indication that the skill is region-specific or that users may choose another language, so this appears to violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The guide explicitly instructs operators to start Uvicorn with --host 0.0.0.0, which exposes the API on all network interfaces. In the context of a local RAG knowledge service with no mention of authentication, TLS, firewalling, or reverse-proxy restrictions, this can unintentionally make query and metadata endpoints reachable by other hosts on the network.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fastapi_service.md (reported line 29)May include surrounding context.

1. 健康检查

bash
curl http://localhost:8000/health

响应:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fastapi_service.md (reported line 95)May include surrounding context.

python
import requests

response = requests.post(
    "http://localhost:8000/query",
    json={
        "query": "香港专才计划的签证有效期是多久",

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fastapi_service.md (reported line 95)May include surrounding context.

python
import requests

response = requests.post(
    "http://localhost:8000/query",
    json={
        "query": "香港专才计划的签证有效期是多久",

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

Scanner excerpt · references/fastapi_service.md (reported line 95)May include surrounding context.

python
import requests

response = requests.post(
    "http://localhost:8000/query",
    json={
        "query": "香港专才计划的签证有效期是多久",

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/fastapi_service.md (reported line 112)May include surrounding context.

JavaScript

javascript
fetch('http://localhost:8000/query', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({