T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/security_audit.py:1275- Finding
Broad Host Reconnaissance Runs by Default
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This security-audit skill is mostly coherent, but it can scan sensitive host data and create or send reports that may expose secrets.
Review before installing or running. Prefer explicit --check selections, inspect generated reports before sharing, avoid Feishu sending unless the webhook or plugin endpoint is trusted, and treat any previously generated reports as sensitive because they may contain credential values or prefixes.
scripts/security_audit.py:1275Broad Host Reconnaissance Runs by Default
scripts/security_audit.py:938Shell Credential Material Can Be Copied into Persistent Audit Reports
scripts/send_report_to_feishu.py:231Report Sender Accepts Unrestricted Network Destinations
The declared purpose is security auditing, but the skill also documents exfiltration-adjacent behavior: reading local OpenClaw configuration, formatting reports, writing message copies to disk, and sending results to Feishu via plugin API or webhook. A security audit skill scans highly sensitive data, so undocumented or underemphasized outbound reporting materially increases the risk of leaking secrets, system details, or findings to external services.
The skill states it performs broad security auditing but does not prominently warn users that it may inspect sensitive environment variables and may send reports to external services such as Feishu. Because audit output can contain credentials, host details, ports, paths, and policy findings, insufficient disclosure undermines informed consent and increases accidental data exposure risk.
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
python3 scripts/security_audit.py
Referenced artifact was not completely inspected
- [代码安全最佳实践](references/code-security.md)
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
# ❌ 不推荐 - 直接执行用户输入
subprocess.run(user_command, shell=True)
# ✅ 推荐 - 使用参数列表
subprocess.run(['ls', '-la', path], shell=False)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| SSH 私钥 | 600 | `chmod 600 ~/.ssh/id_rsa` | 仅所有者可读写 |
| SSH 目录 | 700 | `chmod 700 ~/.ssh` | 仅所有者可访问 |
| AWS 凭据 | 600 | `chmod 600 ~/.aws/credentials` | 保护 AWS 密钥 |
| GPG 目录 | 700 | `chmod 700 ~/.gnupg` | 保护 GPG 密钥 |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| SSH 私钥 | 600 | `chmod 600 ~/.ssh/id_rsa` | 仅所有者可读写 |
| SSH 目录 | 700 | `chmod 700 ~/.ssh` | 仅所有者可访问 |
| AWS 凭据 | 600 | `chmod 600 ~/.aws/credentials` | 保护 AWS 密钥 |
| GPG 目录 | 700 | `chmod 700 ~/.gnupg` | 保护 GPG 密钥 |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| SSH 私钥 | 600 | `chmod 600 ~/.ssh/id_rsa` | 仅所有者可读写 |
| SSH 目录 | 700 | `chmod 700 ~/.ssh` | 仅所有者可访问 |
| AWS 凭据 | 600 | `chmod 600 ~/.aws/credentials` | 保护 AWS 密钥 |
| GPG 目录 | 700 | `chmod 700 ~/.gnupg` | 保护 GPG 密钥 |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|-----------|-----------|-------|------|
| SSH 私钥 | 600 | `chmod 600 ~/.ssh/id_rsa` | 仅所有者可读写 |
| SSH 目录 | 700 | `chmod 700 ~/.ssh` | 仅所有者可访问 |
| AWS 凭据 | 600 | `chmod 600 ~/.aws/credentials` | 保护 AWS 密钥 |
| GPG 目录 | 700 | `chmod 700 ~/.gnupg` | 保护 GPG 密钥 |
| OpenClaw 配置 | 600/700 | `chmod 700 ~/.openclaw` | 保护配置 |
| 日志文件 | 600/644 | `chmod 600 logs/*.log` | 控制日志访问 |
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
.gitignore
---------
.env
.env.local
config/secrets.json
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
```
.gitignore
---------
.env
.env.local
config/secrets.json
```
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
.env .env.local config/secrets.json
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
.env .env.local config/secrets.json
4. **使用掩码显示**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
---------
.env
.env.local
config/secrets.json
```
4. **使用掩码显示**
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
print_header("🔒 检查敏感文件权限")
sensitive_files = [
(Path.home() / ".ssh", 0o700),
(Path.home() / ".ssh" / "id_rsa", 0o600),
(Path.home() / ".ssh" / "id_ed25519", 0o600),
(Path.home() / ".aws" / "credentials", 0o600),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
print_header("🔒 检查敏感文件权限")
sensitive_files = [
(Path.home() / ".ssh", 0o700),
(Path.home() / ".ssh" / "id_rsa", 0o600),
(Path.home() / ".ssh" / "id_ed25519", 0o600),
(Path.home() / ".aws" / "credentials", 0o600),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
print_header("🔒 检查敏感文件权限")
sensitive_files = [
(Path.home() / ".ssh", 0o700),
(Path.home() / ".ssh" / "id_rsa", 0o600),
(Path.home() / ".ssh" / "id_ed25519", 0o600),
(Path.home() / ".aws" / "credentials", 0o600),
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
severity="high",
description=f"文件权限过于宽松: {oct(actual_mode)}, 期望: {oct(expected_mode)}",
impact=str(path),
fix=f"chmod {oct(expected_mode)[2:]} {path}",
))
else:
results.append(AuditResult(
The script enumerates all environment variables and inspects their values for secrets, which grants broad access to sensitive credentials present in the process environment. In a security-audit skill this is contextually expected, but it is still dangerous because the collected variable names and classifications are later reported and could expose sensitive operational metadata or leak secrets if logging/report handling changes.
exposed = []
for env_name, env_value in os.environ.items():
for pattern, desc in sensitive_env_patterns:
if pattern.search(env_name):
# 检查值是否是真实密钥(非占位符)
Detected: suspicious.dynamic_code_execution, suspicious.exposed_secret_literal