T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/scanner.py:142- Finding
Sensitive Persona Memory and Repository Content Are Transmitted to a Configurable External LLM Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
scripts/memory.py:192-243,scripts/scanner.py:35-42,scripts/scanner.py:142-171,scripts/llm.py:18-45, andscripts/llm.py:68-79
Vulnerability Type: Sensitive information disclosure through excessive access and external transmission
Risk Level: HighVulnerable Code
scripts/memory.py:192-243:python WORKSPACE_FILES = ("SOUL.md", "USER.md", "IDENTITY.md", "MEMORY.md", "AGENTS.md", "TOOLS.md") def __init__(self, recall_persona: str = "", memory_source: str = "auto") -> None: self.effective_persona = (recall_persona.strip().lower() or detect_persona()) if self.effective_persona == "master": self.effective_persona = "main" self.workspace = get_workspace_for_persona(self.effective_persona) self.context_persona = self.effective_persona self.source = MemorySource(memory_source) self.openclaw_mem = OpenClawMemory(self.workspace) self.hawkbridge_mem = HawkBridgeMemory(self.workspace) self._use_openclaw = self.source in (MemorySource.OPENCLAW, MemorySource.AUTO) self._use_hawkbridge = self.source in (MemorySource.HAWKBRIDGE, MemorySource.AUTO) if self.source == MemorySource.AUTO: self._use_openclaw = True self._use_hawkbridge = self.hawkbridge_mem.is_available() def load_context_files(self) -> dict[str, str]: ctx = {} for fname in self.WORKSPACE_FILES: fp = self.workspace / fname if fp.exists() and fp.is_file(): try: ctx[fname] = fp.read_text(encoding="utf-8", errors="ignore") except OSError: ctx[fname] = "" else: ctx[fname] = "" return ctx def get_context_summary(self) -> str: ctx = self.load_context_files() labels = { "SOUL.md": "价值观/风格", "USER.md": "偏好/习惯", "IDENTITY.md": "项目定位", "MEMORY.md": "长期记忆", ...[truncated 5152 chars]- Remediation
View remediation
Remediation Suggestions
- Disable persona-memory inclusion by default. Source-code analysis should operate without
MEMORY.md,TOOLS.md, message history, or unrelated workspace files. - Add explicit switches for each sensitive data class, such as
--include-user-preferencesand--include-memory, with secure defaults that keep them disabled. - Before transmission, display the endpoint hostname, files included, approximate payload size, and data categories, then require affirmative consent.
- Enforce HTTPS and maintain an explicit allowlist of approved LLM provider domains. Reject URLs containing user information, unexpected ports, local metadata addresses, or unapproved hosts.
- Add secret detection and deterministic redaction for API keys, access tokens, private keys, credentials, connection strings, email addresses, and other personal information.
- Prevent cross-persona selection unless an authorization policy explicitly permits access. Do not treat a CLI string as sufficient authorization.
- Separate source-code prompts from persona-context prompts and minimize each excerpt to the content strictly needed for the current check.
- Document exactly which local files and databases are read and which content is transmitted externally.
- Avoid silently reading API credentials from multiple providers. Require explicit provider selection and bind each credential to its expected endpoint.
- Disable persona-memory inclusion by default. Source-code analysis should operate without
