Back to skill

Security audit

Local Memory

Security checks for vulnerabilities and agentic risk

Overview

This local memory skill mostly does what it says, but it handles persistent private data while under-disclosing network and supply-chain behavior.

Review before installing. Use it only if you are comfortable with persistent local storage of memory text and first-run dependency/model downloads. Avoid storing secrets or credentials, consider running it in an isolated environment, and prefer pinned dependencies plus a verified local model cache before relying on the offline claim.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Warning
Location
scripts/setup.py:21
Finding

Unpinned Dependencies and Mutable Model Downloads from a Non-Official Mirror

Content
View full analysis

Vulnerability Details

File Location: scripts/setup.py:21-37; scripts/memory_store.py:4-8, 35; scripts/memory_recall.py:4-8, 30; scripts/memory_forget.py:4-8, 50
Vulnerability Type: Supply-chain exposure through unpinned dependencies and unverified model artifacts
Risk Level: Medium

Vulnerable Code

scripts/setup.py:21-37:

python
# 1. torch CPU
run(
    [py, "-m", "pip", "install", "torch", "--index-url", "https://download.pytorch.org/whl/cpu"],
    "安装 torch (CPU)",
)

# 2. chromadb + sentence-transformers + certifi
run(
    [py, "-m", "pip", "install", "chromadb", "sentence-transformers", "certifi"],
    "安装 chromadb、sentence-transformers 和 certifi",
)

# 3. 预下载模型
print(json.dumps({"step": "预下载 BGE-small-zh-v1.5 模型", "status": "running"}, ensure_ascii=False))
try:
    from sentence_transformers import SentenceTransformer
    SentenceTransformer("BAAI/bge-small-zh-v1.5")

scripts/memory_store.py:4-8, 35:

python
import os
import certifi
os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
os.environ.setdefault("REQUESTS_CA_BUNDLE", certifi.where())
os.environ.setdefault("SSL_CERT_FILE", certifi.where())

model = SentenceTransformer(MODEL_NAME)

scripts/memory_recall.py:4-8, 30:

python
import os
import certifi
os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
os.environ.setdefault("REQUESTS_CA_BUNDLE", certifi.where())
os.environ.setdefault("SSL_CERT_FILE", certifi.where())

model = SentenceTransformer(MODEL_NAME)

scripts/memory_forget.py:4-8, 50:

python
import os
import certifi
os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com")
os.environ.setdefault("REQUESTS_CA_BUNDLE", certifi.where())
os.environ.setdefault("SSL_CERT_FILE", certifi.where())

model = SentenceTransformer(MODEL_NAME)

Technical Analysis

The setup script installs torch, chromadb, `sentence- ...[truncated 2663 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin every Python dependency to an exact reviewed version, including transitive dependencies through a generated lockfile.
  2. Require package hashes, for example by using a hash-locked requirements file with pip install --require-hashes.
  3. Retain trusted package indexes explicitly and prevent unintended fallback to additional indexes.
  4. Pin the Hugging Face model to an immutable commit revision rather than loading only by repository name.
  5. Verify model files against approved cryptographic hashes before loading them.
  6. Prefer the official Hugging Face endpoint. If a mirror is operationally required, document its trust model, restrict it to an approved mirror, and independently verify downloaded artifacts.
  7. Download and validate dependencies and model artifacts during a controlled build process, then deploy from an internal immutable artifact repository.
  8. Install the dependencies in an isolated virtual environment or container under a non-privileged account.
  9. Add automated dependency and artifact provenance checks to CI, and periodically review pinned versions for known vulnerabilities.
  10. Update the documentation to clarify that the Skill operates offline only after verified dependencies and model artifacts have been installed and cached.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (17)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises shell-based scripts and likely environment access, but does not declare any explicit tool scope such as allowed-tools or permissions. This creates ambiguity about what execution capabilities the skill needs and increases the risk of overbroad tool access, especially for a memory-related skill that persists user data locally.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger phrases include very broad terms like “记住”, “记忆”, “memory”, and “forget”, which can easily appear in normal conversation and unintentionally activate persistent storage or deletion behavior. In a memory skill, accidental invocation is more dangerous because it can cause silent retention of sensitive user data or unintended deletion of stored records.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description explains how to store, search, and delete memory, but does not clearly warn users that data is persisted locally in a long-term vector store and may contain sensitive personal information. For a memory-management skill, lack of transparency about persistence and deletion semantics can lead users to disclose confidential data without informed consent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest explicitly describes the skill as fully offline local vector memory. However, this file sets HF_ENDPOINT to an external mirror URL and configures CA bundle environment variables, which indicates the implementation may rely on remote model access or network-mediated setup rather than being purely offline.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The semantic-delete path irreversibly deletes the top semantic match without confirmation, preview approval, or a safety threshold. In a memory tool, approximate matching can delete the wrong record, causing unintended data loss or adversarially induced deletion through crafted queries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The natural-language strings in the module docstring and CLI help are exclusively in Chinese, indicating the skill is designed to operate in a single language without offering any user opt-in or alternative locale. Under the stated policy, forcing a specific language without user choice is a natural-language policy concern unless the constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill advertises itself as 'completely offline', but it sets Hugging Face endpoint variables to a remote mirror and then instantiates a SentenceTransformer model by name. If the model is not already cached locally, this can trigger outbound network access, violating privacy and trust assumptions for a memory tool that may process sensitive user data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill advertises fully offline local memory, but it explicitly sets a Hugging Face mirror endpoint and then later initializes a SentenceTransformer model that may download artifacts from that remote service. This creates a privacy and supply-chain risk because memory-related tooling may unexpectedly contact external infrastructure and fetch model files despite the offline claim.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Initializing SentenceTransformer with a model name rather than a vetted local path can trigger automatic network downloads, which is risky in a tool handling user memory. This may leak operational metadata, violate user expectations about local processing, and expose the environment to unpinned remote model artifacts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script stores raw user-provided memory text and metadata in persistent local storage without any notice, consent flow, retention control, or sensitivity filtering in the file itself. In a memory skill, users may submit secrets, personal data, or credentials, so silent long-term storage raises meaningful privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file claims the skill is 'fully offline', but the setup script explicitly installs packages from remote indexes and downloads a model from an external repository. This mismatch can mislead users and operators into granting trust or running the skill in environments where network access or supply-chain retrieval is not expected.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and all user-facing status/messages are written only in Chinese, which imposes a specific language on users without any opt-in or alternative locale handling. Under the policy, language constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/setup.py (reported line 11)May include surrounding context.

python
def run(cmd, desc):
    print(json.dumps({"step": desc, "status": "running"}, ensure_ascii=False))
    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        print(json.dumps({"step": desc, "status": "error", "message": result.stderr.strip()}, ensure_ascii=False))
        sys.exit(1)

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The description specifies use of the BGE-small-zh / BGE-small-zh-v1.5 model, indicating a Chinese-language-oriented setup, but does not tell users that the skill is intended for Chinese input or offer any language choice or opt-in. This can be a locale/language policy concern when a skill implicitly constrains language behavior without explicit user consent or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file’s natural-language description is entirely in Chinese and specifies the skill behavior only in that language. There is no indication that users may choose another language or locale, which can conflict with a policy requiring language choice or opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file's user-facing description and CLI/help strings are written only in Chinese, and the selected model is also Chinese-specific, with no indication that users can choose another language. This creates a locale/language constraint without opt-in or documented justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

该文件不仅做本地记忆相关准备,还直接从外部索引和模型仓库拉取代码与模型资源。这种联网安装能力并非“存储、检索、删除本地记忆”这一技能目的本身所直接要求的运行能力,尤其在清单强调本地/离线时更显得不相称。

Content

No source excerpt is available for this finding.