Back to skill

Security audit

Z1 Memory Palace v3.0

Security checks for vulnerabilities and agentic risk

Overview

The skill broadly indexes local memory files and mostly matches its purpose, but its file scoping and dependency integrity controls are too loose for automatic installation.

Review before installing. Use it only in a dedicated, low-privilege workspace; pin Python dependencies and the model revision; validate manifest paths against a specific memory directory; and do not enable recurring maintenance until the file scope is constrained and understood.

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

Warning
Location
SKILL.md:24
Finding

Unpinned Third-Party Package and Model Artifacts

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/build_index_bge.py:22
Finding

Manifest Paths Permit Reads Outside the Intended Memory Directory

Content
View full analysis
str: p = ROOT / rel_path if not p.exists(): return '' return p.read_text(encoding='utf-8', errors='ignore')[:12000] ``` ```python # scripts/build_index_bge.py for line in MANIFEST.read_text(encoding='utf-8').splitlines(): if not line.strip(): continue item = json.loads(line) if is_cold_zone_path(item['path']): continue fp = ROOT / item['path'] current_mtime = round(fp.stat().st_mtime, 2) if fp.exists() else 0 new_tracker[item['path']] = current_mtime if current_mtime != tracker.get(item['path'], 0): changed_files.append(item['path']) ``` ```python # scripts/build_index_bge.py for line in MANIFEST.read_text(encoding='utf-8').splitlines(): if not line.strip(): continue item = json.loads(line) if is_cold_zone_path(item['path']): print(f"[COLD_ZONE_SKIP] 跳过冷区文件: {item['path']}") continue text = read_text(item['path']) if not text: continue batch.append(text) metas.append(item) ``` ```python # scripts/graph_router.py def read_text(rel_path: str) -> str: p = ROOT / rel_path if not p.exists(): return '' return p.read_text(encoding='utf-8', errors='ignore') ``` ```python # scripts/graph_router.py def main(): rows = [json.loads(line) for line in INDEX.read_text(encoding='utf-8').splitlines() if line.strip()] alias = build_alias_map(rows) graph = {} for r in rows: # Cold-zone filtering if is_cold_zone_path(r['path']): continue text = read_text(r['path ...[truncated 3396 chars]
Remediation
View remediation
Path: supplied = Path(value) if supplied.is_absolute(): raise ValueError("Absolute paths are not allowed") candidate = (ROOT / supplied).resolve(strict=True) if not candidate.is_relative_to(ALLOWED_ROOT): raise ValueError("Path escapes the allowed memory directory") if not candidate.is_file(): raise ValueError("Path is not a regular file") return candidate ``` 4. Apply the same validation in the index builder, mtime tracker, graph router, cold-zone filter, and every future manifest consumer. 5. Reject symbolic-link escapes. If symbolic links are unnecessary, reject symlinked source files entirely. 6. Restrict indexing to approved file extensions, such as `.md` and `.txt`, and enforce reasonable file-size limits before reading. 7. Validate the manifest schema, requiring a non-empty string path and recognized metadata values. 8. Generate the manifest from a controlled directory walk where possible instead of accepting arbitrary paths. 9. Store normalized, root-relative paths in index artifacts and reject index records that cannot be mapped back to approved manifest entries. 10. Run scheduled maintenance with a minimally privileged account that cannot read unrelated sensitive files. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (9)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description says to trigger on phrases like "long-term memory," "agent memory," and "memory management" without defining clear boundaries, exclusions, or a constrained invocation context. These phrases are broad enough to match ordinary discussion about AI memory or knowledge bases, which could cause unintended activation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document uses Chinese headings and instructions throughout, which imposes a specific language choice without indicating user opt-in or that the skill is intentionally region-specific. Under the policy rule, a forced language/locale is a natural-language policy concern unless the file offers a choice or documents a justified locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file's operative instructions and field labels are presented exclusively in Chinese, with no indication that users may choose another language or locale. This can violate language/locale policy when a skill implicitly requires one language without documenting opt-in or regional scope.

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

python
def has_palace_changes_since_last_commit() -> bool:
    """方案 A: git diff 门。检查 palace/ 是否有未提交变更。"""
    result = subprocess.run(
        ["git", "diff", "--name-only", "HEAD", "--", "memory/palace/"],
        capture_output=True, text=True, cwd=ROOT
    )

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This file contains natural-language descriptions and runtime messages that force a specific language/locale for operators. The policy allows fixed locale only when user opt-in or a justified region-specific constraint is documented, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing natural-language instructions exclusively in Chinese in the module docstring and command examples. Under the policy, forcing a specific language without offering a choice or documenting a justified locale constraint is 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
83% confidence
Finding

The headings on these lines use Chinese-only labels for date and status, which imposes a specific language in the skill file without any user opt-in or justification that the skill is intended for a Chinese-language environment. This matches the policy category for language or locale constraints expressed in natural language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This Python file executes a git subprocess via subprocess.run, which is one of the safety-relevant operations covered by the warning rule for code files. Although the script logs the diff results afterward, there is no prior disclosure, prompt, or explicit explanatory warning near the execution site that the skill will invoke an external command.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script’s human-facing comments and console messages are entirely in Chinese, including status output and usage guidance. This imposes a specific language on operators without offering a language choice or documenting that the skill is intentionally region-specific, which matches the locale-policy concern for natural-language content.

Content

No source excerpt is available for this finding.