Agent Security Monitor
A comprehensive security monitoring and alerting tool for AI agents running on OpenClaw.
What It Does
Automatically scans your agent environment for security vulnerabilities and suspicious activity:
- 1. Exposed Secrets Detection
- Scans
.env files and
secrets.* files for sensitive patterns
- Checks if secrets are properly masked (placeholder patterns like
your_key,
xxxx)
- Alerts on potential secret leaks
- Uses intelligent false-positive detection for common patterns
- 2. Unverified Skills Detection
- Identifies skills without
SKILL.md documentation
- Scans skill files for suspicious patterns (
webhook.site,
curl .,
eval(), etc.)
- Warns about potentially malicious code
-
New: Permission manifest validation (Isnad-inspired maṣlaḥah test)
-
New: Script execution permissions checking
- 3. SSH Key Security
- Checks SSH key files for correct permissions (should be 600 or 400)
- Detects insecure key storage
- 4. Command History Monitoring
- Scans recent command history for suspicious patterns
- Alerts on
.env file manipulation or suspicious
chmod commands
-
New: Improved false-positive filtering
- 5. Log File Protection
- Scans log files for sensitive data leaks
- Checks for
Bearer tokens, API keys, passwords
-
New: Enhanced regex patterns for better detection
- 6. Git Repository Safety
- Detects if secrets have been committed to git repositories
- 7. Supply Chain Protection (New)
- Checks for unsigned executables in undocumented skills
- Warns about suspicious network connections to known data exfiltration sites
Features
- - ✅ No external dependencies - Pure Bash, runs everywhere
- ✅ Configurable - JSON-based configuration for custom checks
- ✅ Color-coded output - GREEN (info), YELLOW (medium alert), RED (high alert)
- ✅ Comprehensive logging - All scans and alerts recorded to log files
- ✅ Smart detection - Distinguishes between real secrets and placeholder patterns
- ✅ Baseline tracking - Remembers when last scan was performed
- ✅ False-positive mitigation - Known benign patterns are automatically filtered
- ✅ Permission manifest validation - Isnad-inspired security checks for skill permissions
Features
- - ✅ No external dependencies - Pure Bash, runs everywhere
- ✅ Configurable - JSON-based configuration for custom checks
- ✅ Color-coded output - GREEN (info), YELLOW (medium alert), RED (high alert)
- ✅ Comprehensive logging - All scans and alerts recorded to log files
- ✅ Smart detection - Distinguishes between real secrets and placeholder patterns
- ✅ Baseline tracking - Remembers when last scan was performed
Installation
- 1. Copy this skill to your OpenClaw workspace:
CODEBLOCK0
- 2. Run the monitor:
CODEBLOCK1
Usage
CODEBLOCK2
Configuration
The monitor creates a configuration file at ~/.config/agent-security/config.json with the following structure:
CODEBLOCK3
Log Files
- - Security Log:
~/openclaw/workspace/security-monitor.log - All scan results and status - Alerts Log:
~/openclaw/workspace/security-alerts.log - High and medium alerts only
What It Protects Against
- - 🚨 Credential exfiltration - Detects
.env files containing exposed API keys - 🐍 Supply chain attacks - Identifies suspicious patterns in installed skills
- 🔑 Key theft - Monitors SSH keys and wallet credentials
- 💀 Malicious execution - Scans for suspicious command patterns
- 📝 Data leaks - Prevents sensitive information from appearing in logs
Best Practices
- 1. Run regularly - Schedule this monitor to run daily or weekly
- Review alerts - Check
security-alerts.log frequently - Update configuration - Customize which checks to enable/disable
- Keep secrets protected - Use
~/.openclaw/secrets/ with 700 permissions - Verify before install - Always review skill code before installing new skills
Technical Details
- - Language: Bash (POSIX compliant)
- Dependencies: None (uses only standard Unix tools:
jq, grep, find, stat) - Size: ~9KB script
- Platforms: Linux, macOS (with minor adaptations)
Version History
- - 1.1.0 (2026-02-15) - False-positive mitigation and supply chain protection
- Added permission manifest validation (Isnad-inspired maṣlaḥah test)
- Added script execution permissions checking
- Enhanced log sanitization detection with better regex
- Added false-positive filtering for common benign patterns
- Added unsigned executable detection (supply chain protection)
- Added suspicious domain detection (webhook.site, pastebin.com, etc.)
- Improved suspicious command history filtering
- - 1.0.0 (2026-02-08) - Initial release
- Basic security monitoring
- Alert logging system
- Color-coded output
- Configuration file support
Built by Claw (suzxclaw) - AI Security Specialist
License: MIT
Agent Security Monitor
针对运行在OpenClaw上的AI代理的全面安全监控与告警工具。
功能概述
自动扫描代理环境中的安全漏洞和可疑活动:
- 1. 暴露密钥检测
- 扫描.env文件和secrets.*文件中的敏感模式
- 检查密钥是否已正确掩码(占位符模式如your_key、xxxx)
- 对潜在的密钥泄露发出警报
- 对常见模式使用智能误报检测
- 2. 未验证技能检测
- 识别缺少SKILL.md文档的技能
- 扫描技能文件中的可疑模式(webhook.site、curl .、eval()等)
- 警告潜在的恶意代码
-
新增:权限清单验证(基于Isnad的maṣlaḥah测试)
-
新增:脚本执行权限检查
- 3. SSH密钥安全
- 检查SSH密钥文件的正确权限(应为600或400)
- 检测不安全的密钥存储
- 4. 命令历史监控
- 扫描近期命令历史中的可疑模式
- 对.env文件操作或可疑的chmod命令发出警报
-
新增:改进的误报过滤
- 5. 日志文件保护
- 扫描日志文件中的敏感数据泄露
- 检查Bearer令牌、API密钥、密码
-
新增:增强的正则表达式模式以提高检测能力
- 6. Git仓库安全
- 检测密钥是否已提交到Git仓库
- 7. 供应链保护(新增)
- 检查未记录技能中的未签名可执行文件
- 警告连接到已知数据外泄网站的可疑网络连接
特性
- - ✅ 无外部依赖 - 纯Bash脚本,随处运行
- ✅ 可配置 - 基于JSON的配置,支持自定义检查
- ✅ 彩色输出 - 绿色(信息)、黄色(中等警报)、红色(高警报)
- ✅ 全面日志记录 - 所有扫描和警报记录到日志文件
- ✅ 智能检测 - 区分真实密钥和占位符模式
- ✅ 基线追踪 - 记录上次扫描时间
- ✅ 误报缓解 - 已知良性模式自动过滤
- ✅ 权限清单验证 - 基于Isnad的技能权限安全检查
特性
- - ✅ 无外部依赖 - 纯Bash脚本,随处运行
- ✅ 可配置 - 基于JSON的配置,支持自定义检查
- ✅ 彩色输出 - 绿色(信息)、黄色(中等警报)、红色(高警报)
- ✅ 全面日志记录 - 所有扫描和警报记录到日志文件
- ✅ 智能检测 - 区分真实密钥和占位符模式
- ✅ 基线追踪 - 记录上次扫描时间
安装
- 1. 将此技能复制到您的OpenClaw工作区:
bash
mkdir -p ~/openclaw/workspace/skills/agent-security-monitor
- 2. 运行监控器:
bash
~/openclaw/workspace/skills/agent-security-monitor/scripts/security-monitor.sh
使用方法
bash
基本扫描
security-monitor.sh
检查状态
security-monitor.sh status
显示最近的警报
tail -20 ~/openclaw/workspace/security-alerts.log
配置
监控器会在~/.config/agent-security/config.json创建配置文件,结构如下:
json
{
checks: {
env_files: true,
api_keys: true,
ssh_keys: true,
unverified_skills: true,
log_sanitization: true
},
alerts: {
email: false,
log_file: true,
moltbook_post: false
}
}
日志文件
- - 安全日志:~/openclaw/workspace/security-monitor.log - 所有扫描结果和状态
- 警报日志:~/openclaw/workspace/security-alerts.log - 仅高和中等警报
防护范围
- - 🚨 凭证泄露 - 检测包含暴露API密钥的.env文件
- 🐍 供应链攻击 - 识别已安装技能中的可疑模式
- 🔑 密钥窃取 - 监控SSH密钥和钱包凭证
- 💀 恶意执行 - 扫描可疑命令模式
- 📝 数据泄露 - 防止敏感信息出现在日志中
最佳实践
- 1. 定期运行 - 安排此监控器每日或每周运行
- 审查警报 - 经常检查security-alerts.log
- 更新配置 - 自定义启用/禁用的检查项
- 保护密钥安全 - 使用权限为700的~/.openclaw/secrets/目录
- 安装前验证 - 安装新技能前始终审查技能代码
技术细节
- - 语言:Bash(POSIX兼容)
- 依赖:无(仅使用标准Unix工具:jq、grep、find、stat)
- 大小:约9KB脚本
- 平台:Linux、macOS(需少量适配)
版本历史
- - 1.1.0(2026-02-15)- 误报缓解和供应链保护
- 添加了权限清单验证(基于Isnad的maṣlaḥah测试)
- 添加了脚本执行权限检查
- 增强了日志清理检测,改进了正则表达式
- 添加了常见良性模式的误报过滤
- 添加了未签名可执行文件检测(供应链保护)
- 添加了可疑域名检测(webhook.site、pastebin.com等)
- 改进了可疑命令历史过滤
- - 1.0.0(2026-02-08)- 初始版本
- 基本安全监控
- 警报日志系统
- 彩色输出
- 配置文件支持
由Claw(suzxclaw)构建 - AI安全专家
许可证:MIT