Skill Security Scanner
Protect your OpenClaw installation from malicious skills. This scanner performs static analysis on skill code to detect:
- Code Execution Threats:
eval, exec, os.system, subprocess calls
- Data Exfiltration: Hidden network requests, suspicious URLs, IP connections
- System Compromise: File deletion, permission changes, privilege escalation
- Credential Theft: Environment variable access, secret harvesting
- Cryptojacking: Mining malware, suspicious compute patterns
- Obfuscation: Hidden code, base64 encoding, minification
- Spyware: Keyloggers, screen capture, surveillance features
Quick Start
# Basic scan
python scripts/security_scanner.py /path/to/skill
# Strict mode (catches more suspicious patterns)
python scripts/security_scanner.py /path/to/skill --strict
# Save JSON report
python scripts/security_scanner.py /path/to/skill --format json -o report.json
# Generate markdown report
python scripts/security_scanner.py /path/to/skill --format markdown -o report.md
Understanding Results
Verdict Levels
| Verdict |
Emoji |
Meaning |
Action |
| PASS |
🟢 |
No critical issues found |
Safe to install |
| REVIEW |
🟡 |
Some concerns, review recommended |
Check findings before installing |
| WARNING |
🟠 |
High-risk patterns detected |
Strongly reconsider installation |
| REJECT |
🔴 |
Critical threats identified |
DO NOT INSTALL |
Security Score
- 90-100: Excellent - minimal risk
- 70-89: Good - minor issues
- 50-69: Fair - requires review
- 0-49: Poor - significant risks
Detection Rules
Critical (🔴)
| Rule |
Description |
Example |
| EXEC001 |
Code execution functions |
eval(), exec(), compile() |
| SUSPICIOUS001 |
Keylogger functionality |
pynput, keyboard modules |
| SUSPICIOUS003 |
Cryptocurrency mining |
mining, bitcoin, stratum+tcp |
High (🟠)
| Rule |
Description |
Example |
| EXEC002 |
System command execution |
os.system(), subprocess.call() |
| NET002 |
Raw socket connections |
socket.connect() |
| ENV001 |
Sensitive credential access |
os.environ['PASSWORD'] |
| OBF001 |
Code obfuscation |
Base64, hex-encoded code |
| SUSPICIOUS002 |
Screen capture |
pyautogui.screenshot() |
| NET004 |
Short URL usage |
bit.ly, tinyurl links |
Medium (🟡)
| Rule |
Description |
Example |
| NET001 |
HTTP network requests |
requests.get(), fetch() |
| ENV002 |
Environment enumeration |
os.environ.items() |
| FILE001 |
File deletion |
os.remove(), shutil.rmtree() |
| DATA001 |
Unsafe deserialization |
pickle.loads(), yaml.load() |
| NET003 |
Hardcoded IP addresses |
Direct IP in URLs |
| OBF002 |
Base64 encoded blocks |
Large base64 strings |
Low/Info (🔵/⚪)
| Rule |
Description |
| FILE002 |
File write operations |
| CRYPTO001 |
Cryptographic operations |
| DOC001 |
Insufficient documentation |
| DOC002 |
Missing security statements |
Workflow
Before Installing a New Skill
Download the skill to a temporary directory
Run the security scanner
Review the verdict:
- 🟢 PASS: Proceed with installation
- 🟡 REVIEW: Examine findings, verify legitimate use
- 🟠 WARNING: Only install from trusted sources
- 🔴 REJECT: Do not install
For 🟡/🟠 findings, manually review the flagged code
Confirm the skill's behavior matches its documentation
Before Updating an Existing Skill
- Run scanner on the new version
- Compare results with previous version's scan
- Check for new critical/high findings
- Review any new network/file operations
Automated Integration
Add to your skill installation workflow:
import subprocess
import sys
def safe_install_skill(skill_path):
# Run security scan
result = subprocess.run(
['python', 'scripts/security_scanner.py', skill_path, '--format', 'json'],
capture_output=True,
text=True
)
import json
report = json.loads(result.stdout)
if report['summary']['verdict'] == 'REJECT':
print("❌ Installation blocked: Critical security issues found")
return False
if report['summary']['verdict'] == 'WARNING':
response = input("⚠️ High-risk patterns detected. Install anyway? (y/N): ")
if response.lower() != 'y':
return False
# Proceed with installation
return True
Handling False Positives
Some legitimate skills may trigger warnings:
- Network requests: Skills that fetch data from APIs
- File operations: Skills that modify documents
- Encryption: Skills handling sensitive data
When you trust the source and understand the functionality, you can:
- Review the specific code flagged
- Verify it matches the documented purpose
- Manually approve if confident
Reporting Issues
If you find a skill with confirmed malicious intent:
- Do not install or run it
- Report to the skill repository/hosting platform
- Notify OpenClaw community channels
- Share scan report (without executing the skill)
Best Practices
- Only install skills from trusted sources
- Always scan before installing - even from trusted sources
- Review findings carefully - understand what the skill does
- Keep scanner updated - new detection rules added regularly
- Use strict mode for untrusted sources - catches more suspicious patterns
- Check skill updates - re-scan when updating existing skills
Exit Codes
The scanner returns specific exit codes:
| Code |
Meaning |
| 0 |
PASS or REVIEW - installation may proceed |
| 1 |
WARNING - high-risk patterns found |
| 2 |
REJECT - critical threats detected |
Use in scripts:
python scripts/security_scanner.py ./skill || {
echo "Security check failed"
exit 1
}
1---2name: skill-security-scanner-23description: Security scanner for OpenClaw skills. Use when installing, updating, or auditing skills to detect malicious backdoors, suspicious code patterns, data exfiltration risks, and security vulnerabilities. Automatically analyzes Python/JavaScript/Shell code for dangerous functions (eval, exec, system calls), network requests, file operations, environment variable access, obfuscation patterns, and known attack signatures. Provides security score and installation recommendations.4---56# Skill Security Scanner78Protect your OpenClaw installation from malicious skills. This scanner performs static analysis on skill code to detect:910- **Code Execution Threats**: `eval`, `exec`, `os.system`, `subprocess` calls11- **Data Exfiltration**: Hidden network requests, suspicious URLs, IP connections 12- **System Compromise**: File deletion, permission changes, privilege escalation13- **Credential Theft**: Environment variable access, secret harvesting14- **Cryptojacking**: Mining malware, suspicious compute patterns15- **Obfuscation**: Hidden code, base64 encoding, minification16- **Spyware**: Keyloggers, screen capture, surveillance features1718## Quick Start1920```bash21# Basic scan22python scripts/security_scanner.py /path/to/skill2324# Strict mode (catches more suspicious patterns)25python scripts/security_scanner.py /path/to/skill --strict2627# Save JSON report28python scripts/security_scanner.py /path/to/skill --format json -o report.json2930# Generate markdown report31python scripts/security_scanner.py /path/to/skill --format markdown -o report.md32```3334## Understanding Results3536### Verdict Levels3738| Verdict | Emoji | Meaning | Action |39|---------|-------|---------|--------|40| **PASS** | 🟢 | No critical issues found | Safe to install |41| **REVIEW** | 🟡 | Some concerns, review recommended | Check findings before installing |42| **WARNING** | 🟠 | High-risk patterns detected | Strongly reconsider installation |43| **REJECT** | 🔴 | Critical threats identified | **DO NOT INSTALL** |4445### Security Score4647- **90-100**: Excellent - minimal risk48- **70-89**: Good - minor issues49- **50-69**: Fair - requires review50- **0-49**: Poor - significant risks5152## Detection Rules5354### Critical (🔴)5556| Rule | Description | Example |57|------|-------------|---------|58| EXEC001 | Code execution functions | `eval()`, `exec()`, `compile()` |59| SUSPICIOUS001 | Keylogger functionality | `pynput`, `keyboard` modules |60| SUSPICIOUS003 | Cryptocurrency mining | `mining`, `bitcoin`, `stratum+tcp` |6162### High (🟠)6364| Rule | Description | Example |65|------|-------------|---------|66| EXEC002 | System command execution | `os.system()`, `subprocess.call()` |67| NET002 | Raw socket connections | `socket.connect()` |68| ENV001 | Sensitive credential access | `os.environ['PASSWORD']` |69| OBF001 | Code obfuscation | Base64, hex-encoded code |70| SUSPICIOUS002 | Screen capture | `pyautogui.screenshot()` |71| NET004 | Short URL usage | `bit.ly`, `tinyurl` links |7273### Medium (🟡)7475| Rule | Description | Example |76|------|-------------|---------|77| NET001 | HTTP network requests | `requests.get()`, `fetch()` |78| ENV002 | Environment enumeration | `os.environ.items()` |79| FILE001 | File deletion | `os.remove()`, `shutil.rmtree()` |80| DATA001 | Unsafe deserialization | `pickle.loads()`, `yaml.load()` |81| NET003 | Hardcoded IP addresses | Direct IP in URLs |82| OBF002 | Base64 encoded blocks | Large base64 strings |8384### Low/Info (🔵/⚪)8586| Rule | Description |87|------|-------------|88| FILE002 | File write operations |89| CRYPTO001 | Cryptographic operations |90| DOC001 | Insufficient documentation |91| DOC002 | Missing security statements |9293## Workflow9495### Before Installing a New Skill96971. Download the skill to a temporary directory982. Run the security scanner993. Review the verdict:100 - 🟢 **PASS**: Proceed with installation101 - 🟡 **REVIEW**: Examine findings, verify legitimate use102 - 🟠 **WARNING**: Only install from trusted sources103 - 🔴 **REJECT**: Do not install1041054. For 🟡/🟠 findings, manually review the flagged code1065. Confirm the skill's behavior matches its documentation107108### Before Updating an Existing Skill1091101. Run scanner on the new version1112. Compare results with previous version's scan1123. Check for new critical/high findings1134. Review any new network/file operations114115### Automated Integration116117Add to your skill installation workflow:118119```python120import subprocess121import sys122123def safe_install_skill(skill_path):124 # Run security scan125 result = subprocess.run(126 ['python', 'scripts/security_scanner.py', skill_path, '--format', 'json'],127 capture_output=True,128 text=True129 )130 131 import json132 report = json.loads(result.stdout)133 134 if report['summary']['verdict'] == 'REJECT':135 print("❌ Installation blocked: Critical security issues found")136 return False137 138 if report['summary']['verdict'] == 'WARNING':139 response = input("⚠️ High-risk patterns detected. Install anyway? (y/N): ")140 if response.lower() != 'y':141 return False142 143 # Proceed with installation144 return True145```146147## Handling False Positives148149Some legitimate skills may trigger warnings:150151- **Network requests**: Skills that fetch data from APIs152- **File operations**: Skills that modify documents153- **Encryption**: Skills handling sensitive data154155When you trust the source and understand the functionality, you can:1561571. Review the specific code flagged1582. Verify it matches the documented purpose1593. Manually approve if confident160161## Reporting Issues162163If you find a skill with confirmed malicious intent:1641651. Do not install or run it1662. Report to the skill repository/hosting platform1673. Notify OpenClaw community channels1684. Share scan report (without executing the skill)169170## Best Practices1711721. **Only install skills from trusted sources**1732. **Always scan before installing** - even from trusted sources1743. **Review findings carefully** - understand what the skill does1754. **Keep scanner updated** - new detection rules added regularly1765. **Use strict mode for untrusted sources** - catches more suspicious patterns1776. **Check skill updates** - re-scan when updating existing skills178179## Exit Codes180181The scanner returns specific exit codes:182183| Code | Meaning |184|------|---------|185| 0 | PASS or REVIEW - installation may proceed |186| 1 | WARNING - high-risk patterns found |187| 2 | REJECT - critical threats detected |188189Use in scripts:190191```bash192python scripts/security_scanner.py ./skill || {193 echo "Security check failed"194 exit 1195}196```