Back to skill

Security audit

记忆秘书

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a local memory-analysis helper, but its documented test path can execute unreviewed Python files outside the package and its install docs encourage bypassing security warnings.

Install only if you are comfortable with a local tool reading your OpenClaw memory files and writing derived reports. Do not run the packaged tests in a shared or sensitive workspace unless the test paths are fixed or the environment is isolated, and do not rely on the README's --force guidance to dismiss security warnings.

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

T09 · Insecure Skill Coding Practices

Error
Location
tests/test_core.py:20
Finding

Test Suite Executes Untrusted Code Outside the Project Boundary

Content
View full analysis

Vulnerability Details

File Location: tests/test_core.py:20-21, tests/test_core.py:52-64, tests/test_core.py:81-94, and tests/test_core.py:105-116
Vulnerability Type: Execution and import of ambient code outside the audited project
Risk Level: High

Vulnerable Code

python
self.workspace_root = Path(__file__).parent.parent.parent
self.memory_dir = self.workspace_root / 'memory'
python
self.workspace_root = Path(__file__).parent.parent.parent
self.script_path = self.workspace_root / 'scripts' / 'pilot_check_stage3.py'

import subprocess
result = subprocess.run(
    ['python3', str(self.script_path), '测试任务'],
    capture_output=True,
    text=True,
    timeout=10
)
python
self.workspace_root = Path(__file__).parent.parent.parent
self.script_path = self.workspace_root / 'scripts' / 'daily_memory_check.py'

import subprocess
result = subprocess.run(
    ['python3', str(self.script_path)],
    capture_output=True,
    text=True,
    timeout=30
)
python
self.workspace_root = Path(__file__).parent.parent.parent
self.design_path = self.workspace_root / 'scripts' / 'smart_adaptive_mem0_design.py'

sys.path.insert(0, str(self.workspace_root / 'scripts'))
from smart_adaptive_mem0_design import SmartRouter

Technical Analysis

The test suite treats the parent of the project directory as its workspace. From artifact/tests/test_core.py, evaluating Path(__file__).parent.parent.parent resolves above the artifact project root. The tests subsequently execute Python files from that external location through subprocess.run and import another external module after placing the external directory at the beginning of sys.path.

Neither operation verifies that the resolved scripts are part of the audited package, checks file ownership or permissions, validates a cryptographic digest, or constrains the imported code. Python module imports ex ...[truncated 1992 chars]

Remediation
View remediation

Remediation Suggestions

  1. Derive the project root without escaping the repository:

    python
    project_root = Path(__file__).resolve().parents[1]
    scripts_dir = project_root / "tests" / "fixtures" / "scripts"
    
  2. Keep every executable test fixture inside the repository so it is included in review and version control.

  3. Do not prepend an ambient parent directory to sys.path. Import project modules through the package's normal import path.

  4. Replace execution of real workspace scripts with temporary fixtures created under a test-controlled temporary directory.

  5. Mock subprocess.run when the test only needs to verify invocation behavior.

  6. Before executing any fixture, resolve its path and enforce containment:

    python
    candidate = (scripts_dir / script_name).resolve()
    candidate.relative_to(project_root)
    
  7. Run tests in an isolated environment with minimal filesystem access, no unnecessary secrets, restricted network access, and a non-privileged account.

  8. Add a regression test confirming that all subprocess targets and dynamically imported modules resolve beneath the project root.

Vulnerability Patterns
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (11)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire skill description is presented only in Chinese, and the document does not offer an alternative language, localization option, or state that the skill is intentionally limited to a Chinese-specific regulatory or regional context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file presents all user-facing instructions, descriptions, and support information in Chinese only. Under the policy criteria, forcing a specific language without user opt-in can be a natural-language policy violation when no alternative language option or locale justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language documentation and runtime output exclusively in Chinese, including the module description and operational messages. The skill does not offer a language/locale choice or explain that it is intentionally limited to a Chinese-speaking environment, which matches the policy-violation criterion for forced language without user opt-in.

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 · tests/test_core.py (reported line 62)May include surrounding context.

python
def test_pilot_check_execution(self):
        """测试飞行员检查可执行"""
        import subprocess
        result = subprocess.run(
            ['python3', str(self.script_path), '测试任务'],
            capture_output=True,
            text=True,

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 · tests/test_core.py (reported line 91)May include surrounding context.

python
def test_daily_check_execution(self):
        """测试每日检查可执行"""
        import subprocess
        result = subprocess.run(
            ['python3', str(self.script_path)],
            capture_output=True,
            text=True,

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file is primarily written in Chinese, including the heading and descriptive text, and links to Chinese-localized references. Under the policy rule for natural-language violations, forcing a specific language without user opt-in can be a violation when no language choice or locale justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code file contains user-facing docstrings and print messages exclusively in Chinese, which effectively forces a specific language for users interacting with the examples. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This Python file's user-facing description and docstrings are written exclusively in Chinese, with no indication that other languages are supported or that the user can choose a locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This file presents its headings and explanatory content primarily in Chinese, with only a limited English translation on one line, and does not state that the skill is region-specific or offer a language choice. Under the policy, natural-language content that effectively enforces a specific language without opt-in can be a locale-policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This file contains user-facing descriptive text entirely in Chinese, including the module docstring and description metadata. Because no opt-in, language selection, or region-specific justification is provided, it may violate language/locale policy requirements for skills expected to support broader users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file contains natural-language strings exclusively in Chinese, including the primary skill description and test labels, with no indication that language choice is configurable or intentionally limited to a Chinese-only context. The policy for this audit flags language or locale constraints when they are imposed without user opt-in or clear justification.

Content

No source excerpt is available for this finding.