Back to skill

Security audit

Huimemory Integration

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent HuiMemory integration guide, but it handles persistent conversation memory and remote LLM integration with under-scoped privacy, prompt-injection, and supply-chain guidance.

Review carefully before installing. Use a disposable virtual environment or container, pin the HuiMemory repo and dependencies to audited versions, verify model artifacts, and do not index sensitive conversations unless users have opted in. If connecting to a remote LLM, assume retrieved memory may be transmitted to that provider; filter, summarize, or redact results, and never place raw retrieved conversations into privileged system instructions.

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

T08 · Insecure Dependencies

Error
Location
SKILL.md:64
Finding

Unpinned Third-Party Code and Model Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:64-84; additional occurrences in references/api-reference.md:462 and scripts/quickstart.py:106
Vulnerability Type: Supply-chain exposure through mutable third-party repositories and unverified dependency manifests
Risk Level: High

Vulnerable Code

bash
git clone https://gitee.com/HuiMengAI/hui-memory.git
cd hui-memory

pip install -r requirements.txt

pip install -r requirements-embedding.txt
bash
git clone https://gitcode.com/hf_mirrors/BAAI/bge-base-zh-v1.5.git models/bge-base-zh-v1.5

# Alternative model sources documented by the Skill:
# git clone https://gitcode.com/hf_mirrors/BAAI/bge-small-zh-v1.5.git models/bge-small-zh-v1.5
# git clone https://gitcode.com/hf_mirrors/BAAI/bge-m3.git models/bge-m3

Technical Analysis

The installation procedure clones the mutable default branch of an external source repository and subsequently installs its dependency manifests. No audited commit hash, immutable release reference, dependency lockfile, package hash, artifact checksum, or cryptographic signature is required.

The referenced requirements.txt and requirements-embedding.txt files are not included in the audited Skill package. Consequently, the packages and build behavior that users are instructed to install could not be reviewed. Python package installation may execute build backends, setup hooks, or native compilation steps under the privileges of the user running pip.

The embedding models are also downloaded from a third-party mirror without integrity verification. Depending on the model-loading framework and artifact format, tampered model repositories can cause model poisoning and may create code-execution risk if unsafe serialized objects or repository-provided custom code are loaded.

Attack Path

  1. An attacker compromises the upstream source repository, model mirror, maintainer account, or dependency resolutio ...[truncated 1297 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin the HuiMemory source to an audited full commit hash rather than cloning the mutable default branch.
  2. Publish and use a dependency lockfile containing exact package versions and cryptographic hashes.
  3. Install dependencies with hash verification, such as pip install --require-hashes.
  4. Prefer official package and model distribution channels over unauthenticated third-party mirrors.
  5. Publish SHA-256 checksums or signed manifests for every downloaded model artifact and verify them before loading.
  6. Disable remote custom model code unless it has been separately reviewed and pinned.
  7. Load only model formats designed to avoid arbitrary object deserialization, such as verified safetensors artifacts where supported.
  8. Perform installation in an isolated, non-privileged virtual environment or container without access to production secrets.
  9. Add automated dependency scanning, software-bill-of-materials generation, and periodic review of the pinned commit and transitive dependencies.

T09 · Insecure Skill Coding Practices

Error
Location
references/llm-integration.md:134
Finding

Stored Prompt Injection Through Privileged Memory Context

Content
View full analysis

Vulnerability Details

File Location: references/llm-integration.md:134-146
Vulnerability Type: Unsafe insertion of potentially attacker-controlled historical conversation content into an LLM system message
Risk Level: High

Vulnerable Code

python
# Build context
context = retriever.format_search_results(results)

# Invoke the LLM
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {
            "role": "system",
            "content": f"You are an AI assistant with long-term memory.\n\nHistorical conversations:\n{context}"
        },
        {"role": "user", "content": user_input}
    ]
)

The source example directly interpolates the formatted retrieval results into the system role. The English text above preserves the behavior of the original non-English prompt while making the security-relevant data flow explicit.

Technical Analysis

Historical conversation data can contain text originally supplied by users or external systems. The example treats the complete retrieval result as privileged system-level context without identifying it as untrusted data or separating it from application instructions.

An attacker can store instruction-like content in a conversation, such as directions to ignore existing rules, disclose other memories, invoke tools, or send data to an external destination. Semantic retrieval can surface that content in a later session. Because the content is interpolated into the system message, it may be interpreted with greater authority than ordinary user input.

This is a stored indirect prompt-injection path:

  • The injection is stored in the memory archive.
  • Retrieval activates it in a later interaction.
  • The vulnerable integration promotes it into a privileged prompt channel.
  • No sanitization, provenance enforcement, instruction/data delimiter policy, or deterministic tool authorization is shown.

Content ...[truncated 1676 chars]

Remediation
View remediation

Remediation Suggestions

  1. Never concatenate retrieved conversation text into the application’s system instructions.
  2. Return memory through a dedicated tool-result message or another clearly separated untrusted-data channel.
  3. Add a fixed system policy stating that retrieved memory is evidence only and that instructions contained within it must never be executed.
  4. Wrap each result in a structured representation containing provenance, record ID, timestamp, and an explicit untrusted-data marker.
  5. Enforce authorization for every tool call outside the LLM. Do not rely on the model to decide whether a requested operation is permitted.
  6. Apply least privilege to memory retrieval, including user or tenant isolation, access-control checks, narrow time ranges, and strict result limits.
  7. Require confirmation for sensitive or state-changing actions triggered after memory retrieval.
  8. Detect or quarantine stored content containing prompt-override patterns, tool instructions, credential requests, or data-exfiltration directions.
  9. Avoid returning unrelated neighboring turns when they are not required, reducing the amount of attacker-controlled context.
  10. Add regression tests in which archived conversations contain adversarial instructions and verify that the model ignores them and cannot exceed its authorization boundary.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (11)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill includes guidance that creates or writes configuration and data files (for example configs/config.yaml, local database paths, cache directories, and session archives), but it does not declare any explicit tool scope or permissions boundary. In an agent environment, undeclared file-write behavior weakens least-privilege guarantees and can lead to unintended local file modification if the skill is auto-invoked or adapted into executable workflows.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The activation guidance is broad and tells the agent to proactively use the skill whenever users mention generic concepts like memory systems, semantic search, or context expansion. Over-broad triggering increases the chance the skill is invoked in contexts where the user did not intend persistent memory or retrieval of historical conversations, which can cause privacy leakage or unexpected data handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill is centered on storing, indexing, and retrieving historical conversations, including timestamps, topics, session files, and semantic recall, but it does not include a user-facing warning or consent model for persistence and retrieval. In this context, the absence of privacy disclosure is especially dangerous because users may reveal sensitive personal or business data without realizing it will be retained locally and surfaced later through search.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This JSON file contains natural-language prompt and output content entirely in Chinese, which effectively constrains the skill's evaluation interface to a single language. There is no indication that users may opt into another language or that the language restriction is intentionally region-specific and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file describes APIs that search, retrieve, and format historical chat content, including full user/assistant turns and metadata such as timestamps and session file paths. The documentation does not include any warning that these operations may expose sensitive personal or conversation data, which is a missing user-facing disclosure for privacy-impacting behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The documentation describes archiving, extracting, and cleaning up cached data, which can create, overwrite, or delete files, but it provides no warning about these filesystem effects. For markdown files, omission of warnings about behaviors affecting user data or system integrity qualifies as a missing-warning issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The tool-calling pattern lets the LLM request historical conversations and then return those results back to the model, effectively exposing memory contents to the external provider. Because the documentation presents this as the recommended integration path without privacy notice, access controls, or disclosure of transmission risk, it can lead to unsafe deployment of a sensitive memory system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The RAG example explicitly injects retrieved historical conversation content into the prompt sent to an external LLM via client.chat.completions.create, but the guide does not warn that private memory data may leave the local system. In a memory-retrieval skill, this omission is security-relevant because developers may unintentionally transmit sensitive chat history, personal data, or proprietary information to a third-party model provider.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file contains its docstring, status messages, usage guidance, and example output entirely in Chinese, which imposes a specific language on users. The policy for this category flags language or locale constraints unless the skill offers user choice or clearly documents that the skill is intentionally region- or language-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The entire API reference is presented only in Chinese, with no indication that users may choose another language or that the locale restriction is intentionally limited to a region-specific audience. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

All instructional content, prompt templates, and example interactions are Chinese-only, which can effectively force a specific language/locale in skill usage. The file does not indicate that this is an optional localization or that the skill is intentionally limited to a Chinese-language context.

Content

No source excerpt is available for this finding.