Back to skill

Security audit

sx-security-audit

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed security-audit tool, but it can copy shell credential values into saved reports that may later be shared externally.

Review this skill before installing. It appears to be a genuine security-audit utility, not malware, but run it only where saved reports and terminal output are protected. Do not send reports to Feishu or webhooks unless you have checked them for secrets, and avoid following the unpinned global install examples without pinning versions and using an isolated environment.

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)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/security_audit.py:947
Finding
Shell Credentials Are Copied into Persistent Audit Reports<![CDATA[ ## Vulnerability Details **File Location**: `scripts/security_audit.py:947-961` **Vulnerability Type**: Plaintext sensitive-data exposure **Risk Level**: High ### Vulnerable Code ```python with open(rc_file, 'r', encoding='utf-8', errors='ignore') as f: content = f.read() matches = export_secret_pattern.findall(content) if matches: sanitized = [m[:50] + "..." if len(m) > 50 else m for m in matches[:3]] results.append(AuditResult( category="密钥与凭据安全", name=f"Shell 配置明文密钥: {rc_file.name}", status="fail", severity="high", description=f"发现 {len(matches)} 处明文导出密钥: {'; '.join(sanitized)}", impact=str(rc_file), fix="将密钥移至 .env 文件或密钥管理服务,不在 shell 配置中硬编码", )) ``` ### Technical Analysis The shell-security check reads files such as `.bashrc`, `.zshrc`, `.bash_profile`, and `.profile`, then searches for exported variables whose names suggest that they contain keys, tokens, secrets, or passwords. The code treats truncation to 50 characters as sanitization. This is not effective redaction: - Values shorter than or equal to 50 characters are included in full. - The first 50 characters of longer credentials are disclosed. - Many API keys, passwords, and access tokens are short enough to be exposed completely. - Even a credential prefix can disclose sensitive operational information or be sufficient for abuse in formats where the meaningful secret appears near the beginning. The resulting description is passed to both Markdown and JSON report generators. Reports are saved to disk, and the Markdown report is also printed to standard output unless quiet mode is enabled. The separate Feishu sender can subsequently process and transmit report-derived content, increasing the number of locations through which the data may be exposed. ### Attack Path 1. A legitimate user or attacker-controlled setup places a credential in a shell initialization file, for example as an exported token. 2. The user ...[truncated 1323 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never include a matched assignment or any substring of its value in an audit result. 2. Parse and report only non-secret metadata: - Variable name - Source file - Line number - Credential classification 3. Replace values with a fixed marker such as `[REDACTED]`; do not use prefix-preserving truncation. 4. Avoid retaining the full file content longer than necessary and ensure it is not included in exception messages. 5. Create report files atomically with mode `0600`, rather than relying on the process `umask`. 6. Keep detailed security reports out of terminal and CI output by default; require an explicit option to print them. 7. Apply a final centralized redaction pass to all report fields before serialization or network transmission. 8. Add tests using short and long synthetic credentials to verify that no part of a credential value appears in Markdown, JSON, console output, or Feishu-formatted content. A safer result would resemble: ```python results.append(AuditResult( category="Credential Security", name=f"Plaintext shell credential: {rc_file.name}", status="fail", severity="high", description=( f"Found a plaintext exported credential variable " f"named {variable_name}; value=[REDACTED]" ), impact=f"{rc_file}:{line_number}", fix="Move the credential to an approved secret-management service.", )) ``` ]]>

T08 · Insecure Dependencies

Warning
Location
references/dependency-audit.md:66
Finding
Security Documentation Recommends Unpinned Third-Party Tool Installation<![CDATA[ ## Vulnerability Details **File Locations**: - `references/dependency-audit.md:66` - `references/dependency-audit.md:81` - `references/dependency-audit.md:93` - `references/code-security.md:208` - `references/code-security.md:225` - `references/code-security.md:234` - `references/code-security.md:314` **Vulnerability Type**: Unpinned third-party dependency and global tool installation **Risk Level**: Medium ### Vulnerable Code From `references/dependency-audit.md`: ```bash # Install pip install safety ``` ```bash # Install pip install pip-audit ``` ```bash # Install pip install bandit ``` From `references/code-security.md`: ```bash # Install npm install eslint-plugin-security ``` ```bash # Install pip install semgrep ``` ```bash # Install npm install -g snyk ``` ```bash # Use API Fuzzer npm install -g api-fuzzer api-fuzzer https://api.example.com ``` ### Technical Analysis The documentation recommends installing multiple third-party security tools without pinning versions, verifying package hashes, using lockfiles, or explicitly restricting resolution to trusted registries. Package names without version constraints resolve to whatever release and dependency graph the configured registry currently provides. Consequently, the effective installed code can change after this Skill has been reviewed. The global npm commands further increase impact by installing packages into the user's global package environment and potentially executing package lifecycle scripts. This is guidance rather than automatic behavior: the Skill does not itself execute these installation commands. Exploitation therefore requires a user or automated agent to follow the documented setup instructions. ### Attack Path 1. A user follows the installation guidance while configuring the recommended audit tools. 2. The package manager queries the currently configured npm or Python package registry. 3. An unsafe registry configuration, compromised maintainer account, maliciou ...[truncated 1070 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every recommended tool to a reviewed version. 2. For Python tools: - Use an isolated virtual environment or `pipx`. - Pin exact versions. - Use a constraints or lock file. - Require hashes with `pip install --require-hashes`. 3. For npm tools: - Pin exact package versions. - Prefer project-local installation over `npm install -g`. - Commit and verify a lockfile. - Use `npm ci` for reproducible installation. - Disable lifecycle scripts where compatible with the package. 4. Explicitly require official registries and document how to verify that no untrusted registry override is active. 5. Review package provenance, publisher identity, signatures or attestations, and transitive dependencies before updating versions. 6. Run third-party scanners in a container or otherwise isolated environment with: - No production credentials - Read-only source mounts where practical - Restricted network access - No administrative privileges 7. Treat version updates as security-sensitive changes requiring review. Example hardened guidance: ```bash python3 -m venv .audit-tools . .audit-tools/bin/activate python -m pip install --require-hashes -r audit-tools.lock ``` For Node.js tools, document a pinned local development dependency and use a committed lockfile instead of a mutable global installation. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (82)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The documented purpose is local security auditing, but the behavior described by the findings includes external report delivery to Feishu/Webhook/OpenClaw APIs and access to user-home configuration and environment variables. That mismatch can mislead users into exposing secrets, audit results, or system details to external services under the guise of a local scan, which materially increases exfiltration risk.

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/security_audit.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- [代码安全最佳实践](references/code-security.md)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Tool Parameter Abuse

High
Category
Tool Misuse
Content
### 1. 子进程执行检查
```python
# ❌ 不推荐 - 直接执行用户输入
subprocess.run(user_command, shell=True)

# ✅ 推荐 - 使用参数列表
subprocess.run(['ls', '-la', path], shell=False)
Confidence
80% confidence
Finding
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).

Credential Access

High
Category
Privilege Escalation
Content
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| 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 密钥 |
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| 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 密钥 |
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
### 敏感文件最小权限
| 文件类型 | 推荐权限 | 命令 | 说明 |
|-----------|-----------|-------|------|
| 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 密钥 |
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
|-----------|-----------|-------|------|
| 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` | 控制日志访问 |
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```
.gitignore
---------
.env
.env.local
config/secrets.json
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```
.gitignore
---------
.env
.env.local
config/secrets.json
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
.gitignore
---------
.env
.env.local
config/secrets.json
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
---------
.env
.env.local
config/secrets.json
```

4. **使用掩码显示**
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
---------
.env
.env.local
config/secrets.json
```

4. **使用掩码显示**
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
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),
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
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),
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
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),
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
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(
Confidence
90% confidence
Finding
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).

Env Variable Harvesting

High
Category
Data Exfiltration
Content
exposed = []

    for env_name, env_value in os.environ.items():
        for pattern, desc in sensitive_env_patterns:
            if pattern.search(env_name):
                # 检查值是否是真实密钥(非占位符)
Confidence
88% confidence
Finding
The script iterates over the entire process environment and classifies potentially sensitive variables, which is legitimate for an audit tool but still collects credential-bearing data. In this skill context, that behavior is more dangerous because results are later reported and may be written to disk, increasing the chance of exposing secret names and security-sensitive metadata.

Credential Access

High
Category
Privilege Escalation
Content
return results

    sensitive_gitignore_entries = [
        '.env', '.env.local', '.env.production',
        '*.pem', '*.key', '*.p12',
        'credentials.json', 'secrets.json', 'service-account.json',
        '.secret', '*.secret',
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

Detected: suspicious.dynamic_code_execution, suspicious.exposed_secret_literal

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/security_audit.py:408

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/code-security.md:92