T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/security_audit.py:1275
- Finding
- Broad Host Reconnaissance Runs by Default<![CDATA[ ## Vulnerability Details **File Location**: `scripts/security_audit.py:182-186, 645-658, 694-699, 774-789, 804-850, 909-950, 1275-1285` **Vulnerability Type**: Excessive host-level access and reconnaissance **Risk Level**: Medium ### Relevant Code ```python sensitive_files = [ (Path.home() / ".ssh", 0o700), (Path.home() / ".ssh" / "id_rsa", 0o600), (Path.home() / ".ssh" / "id_ed25519", 0o600), (Path.home() / ".aws" / "credentials", 0o600), ] ``` ```python for env_name, env_value in os.environ.items(): for pattern, desc in sensitive_env_patterns: if pattern.search(env_name): if env_value and env_value not in ('', 'your-key-here', 'changeme', 'xxx'): exposed.append((env_name, desc)) break if env_value: for pattern_name, pattern in SECRET_PATTERNS.items(): if pattern.search(env_value): exposed.append((env_name, f"value matches {pattern_name} pattern")) break ``` ```python result = subprocess.run( ['git', 'log', '--oneline', '-10', '--diff-filter=A', '-p', '--'], cwd=repo, capture_output=True, text=True, timeout=15, ) ``` ```python result = subprocess.run( ['lsof', '-i', '-P', '-n', '-sTCP:LISTEN'], capture_output=True, text=True, timeout=10, ) ``` ```python if args.check: selected = [] for name in args.check: if name not in checks: print_error(f"Unknown check module: {name}") print_info(f"Available modules: {', '.join(checks.keys())}") sys.exit(1) selected.append(name) else: selected = list(checks.keys()) ``` ### Technical Analysis When no explicit `--check` selection is supplied, the program executes every registered audit module. Those modules inspect host-level resources beyond the current project, including: - Environment-variable names and values for pattern matching - OpenClaw configuration files - SSH, AWS, and GPG path metadata - Shell s ...[truncated 2040 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Default to workspace-only checks rather than all registered checks. 2. Require explicit opt-in for `env`, `network`, `shell`, `config`, and home-directory permission modules. 3. Display an access plan before execution, listing every directory, file class, command, and environment source that will be inspected. 4. Add a strict `--scope` option and reject resolved paths outside that scope. 5. Separate host audits from source-code audits into different commands. 6. Avoid retaining process IDs, usernames, or absolute home paths unless necessary. 7. Document clearly that `npm audit` may contact an external package registry. 8. Preserve the existing read-only behavior for SSH/AWS metadata and never automatically apply suggested `chmod` operations without separate, explicit confirmation. ]]>
