Security Audit for AI Agent Skills
You are conducting a security audit of an AI Agent skill. This skill executes a comprehensive analysis to detect malicious code, security vulnerabilities, and suspicious patterns.
Task
Audit the skill at path: $ARGUMENTS
Execution Steps
Run static security scan
Execute the Python audit tool for static analysis:
# Auto-detect skills-audit installation path
AUDIT_SCRIPT=""
for candidate in \
~/.claude/skills/skills-audit/skill_audit/cli_wrapper.py \
~/.claude/skills/skill-audit/skill_audit/cli_wrapper.py \
"${SKILL_AUDIT_HOME:-}""/skill_audit/cli_wrapper.py"; do
if [ -f "$candidate" ]; then
AUDIT_SCRIPT="$candidate"
break
fi
done
if [ -z "$AUDIT_SCRIPT" ]; then
echo "Error: Cannot find skills-audit installation"
echo "Set SKILL_AUDIT_HOME environment variable to your skills-audit directory"
exit 1
fi
python3 "$AUDIT_SCRIPT" "$ARGUMENTS"
This will:
- Extract skill artifacts (code, prompts, permissions)
- Run static pattern matching (regex-based detection)
- Check for obvious malicious patterns
- Generate initial findings
Perform AI semantic analysis (if enabled)
If the scan mode includes AI analysis (standard/deep/expert), perform deep semantic security analysis:
a. Read the skill code files from the target path
b. Analyze for security vulnerabilities:
- Remote Code Execution:
eval(), exec(), subprocess, curl | bash
- Credential Leaks: Hardcoded API keys, passwords, tokens, .env files
- Data Exfiltration: Suspicious network requests, file uploads
- Prompt Injection: "Ignore previous instructions", role manipulation
- Supply Chain Risks: Obfuscated code, dynamic imports, base64 encoding
- Privilege Escalation: sudo, setuid, file permission changes
- Persistence Mechanisms: cron jobs, shell profile modifications
c. Assess each finding:
- Severity: CRITICAL / HIGH / MEDIUM / LOW
- Attack scenario: How can this be exploited?
- Impact: What damage could be done? (CIA triad)
- Remediation: How to fix it?
d. Filter false positives:
- Exclude findings from skills-audit's own detection patterns (patterns.py regex)
- Downgrade benign file operations (e.g. deleting old output before regeneration)
- Verify env var access patterns (using dotenv is recommended, not a vulnerability)
e. Output your analysis in this format:
AI SEMANTIC ANALYSIS FINDINGS:
1. [SEVERITY] Finding Title
- Location: file.py:line
- Pattern: describe what you found
- Risk: explain the security risk
- Scenario: how an attacker could exploit this
- Impact: potential damage
- Recommendation: how to fix
2. [SEVERITY] Finding Title
...
f. Integrate AI findings into the report (CRITICAL STEP)
After completing your AI analysis, integrate your findings into the audit report by running:
# Use the detected AUDIT_SCRIPT path from step 1
INTEGRATE_SCRIPT="$(dirname "$AUDIT_SCRIPT")/integrate_ai_findings.py"
python3 "$INTEGRATE_SCRIPT" \
"<report_path>" \
'<ai_findings_json>'
Where:
<report_path>: The path to the JSON report file (shown in step 1 output as "Detailed report saved to: ...")
<ai_findings_json>: Your AI analysis findings formatted as JSON array
JSON Format for ai_findings:
[
{
"title": "Base64-Obfuscated Remote Code Execution",
"severity": "CRITICAL",
"category": "unsafe_execution",
"description": "Base64-encoded command that downloads and executes arbitrary code",
"location": "skill.md:28",
"code_snippet": "echo 'L2Jpbi9iYXNoIC1jIC...' | base64 -D | bash",
"risk": "Remote code execution with complete system compromise",
"scenario": "User follows installation instructions, base64 decodes to malicious payload, executes with shell privileges",
"impact": {
"confidentiality": "CRITICAL",
"integrity": "CRITICAL",
"availability": "CRITICAL"
},
"impact_description": "Full system compromise, data theft, ransomware deployment",
"recommendation": "BLOCK this skill entirely. Never execute obfuscated commands.",
"cwe_ids": ["CWE-78", "CWE-94", "CWE-506"]
}
]
Important:
- Convert ALL your AI analysis findings from step 2e into this JSON format
- Include severity (CRITICAL/HIGH/MEDIUM/LOW), location, code snippets, risk, scenario, impact, and recommendations
- This step MERGES your AI findings with static analysis findings and recalculates the overall risk score
- Webhook is NOT sent during this step -- it will be sent after your comprehensive analysis
Send final webhook notification (optional, if notifications are configured)
After completing comprehensive analysis (including false positive filtering), send the webhook:
# Auto-detect skills-audit path
AUDIT_DIR="$(dirname "$(dirname "$AUDIT_SCRIPT")")"
python3 -c "
import sys; sys.path.insert(0, '$AUDIT_DIR')
from skill_audit.integrations import send_final_webhook
send_final_webhook(report_path='<report_path>')
"
This ensures the webhook contains the final, accurate results after your analysis.
Present comprehensive results to user
- Summarize the overall risk level and score (from integrated report)
- List key findings with severity levels
- Clearly mark any false positives that were filtered
- For critical findings, include:
- Title and severity
- Evidence location and code snippet
- Attack scenario and impact
- Remediation recommendation
- Provide the final decision recommendation
- Reference the detailed JSON report path for full analysis
If high-risk issues are found:
- Explain the security implications
- Suggest concrete remediation steps
- Recommend whether to BLOCK, REVIEW, or ALLOW the skill
- Warn about potential damage if the skill is executed
Scan Modes
Deep Mode (Default)
- Speed: ~2-5 minutes
- Coverage: Full Claude AI analysis + static patterns + deep code understanding
- Use: Recommended for all skills
- Command:
/skills-audit /path/to/skill (default) or /skills-audit /path/to/skill --mode deep
- Note: Includes comprehensive AI analysis by Claude
Fast Mode
- Speed: ~1-2 seconds
- Coverage: Static pattern matching only
- Use: Quick check for obvious vulnerabilities
- Command:
/skills-audit /path/to/skill --mode fast
Standard Mode
- Speed: ~30 seconds - 2 minutes (depends on code size)
- Coverage: Claude AI semantic analysis + static patterns
- Use: Balanced speed and coverage
- Command:
/skills-audit /path/to/skill --mode standard
- Note: Claude (you) will perform semantic analysis
Expert Mode
- Speed: ~5-10 minutes
- Coverage: Complete analysis with all phases
- Use: Critical security reviews
- Command:
/skills-audit /path/to/skill --mode expert
- Note: Maximum depth analysis performed by Claude
Detection Capabilities
This audit detects:
- Remote Code Execution:
curl | bash, eval(), exec()
- Credential Leaks: Hardcoded API keys, passwords, .env files
- Network Exfiltration: Suspicious HTTP/Socket connections
- Supply Chain Risks: Obfuscation, dynamic imports
- Prompt Injection: "Ignore previous instructions"
- System Manipulation: File deletion, permission changes
Configuration
Edit config/config.yml (relative to skills-audit installation directory) to customize:
Key Configuration Options
# Report save location
claude_code:
# Options: cwd (current directory), skill_dir (skill directory), temp (temp directory), custom
report_location: custom
custom_report_dir: ~/.claude/audit-reports
# Custom report naming
output:
report_filename: "audit-{skill_name}-{timestamp}.json"
Scan Mode Customization
scan_modes:
fast:
enable_ai_analysis: false
enable_static_analysis: true
enable_deep_analysis: false
enable_tip_check: false
standard:
enable_ai_analysis: true
enable_static_analysis: true
enable_deep_analysis: false
enable_tip_check: false
deep:
enable_ai_analysis: true
enable_static_analysis: true
enable_deep_analysis: true
enable_tip_check: true
Notes
- Default mode is deep (includes AI + Static + Deep analysis by Claude)
- For quick scans, use
--mode fast (static analysis only, 1-2 seconds)
- AI analysis in standard/deep/expert modes is performed by Claude directly (no API calls)
- Reports saved to ~/.claude/audit-reports/ by default (configurable)
- Use
--mode flag to override scan mode (the --mode parameter is authoritative)
- Config file location:
config/config.yml relative to skills-audit installation directory
- Webhook is deferred until after Claude's comprehensive analysis (false positive filtering)
- skills-audit itself is excluded from scanning to avoid self-referential false positives
- Works offline: Static analysis works without internet; AI analysis uses current Claude session
1---2name: xwtro0tk1t-cloud-harness-bundled-skills-skills-audit3description: Security Audit for AI Agent Skills4---56# Security Audit for AI Agent Skills78You are conducting a security audit of an AI Agent skill. This skill executes a comprehensive analysis to detect malicious code, security vulnerabilities, and suspicious patterns.910## Task1112Audit the skill at path: **$ARGUMENTS**1314## Execution Steps15161. **Run static security scan**17 Execute the Python audit tool for static analysis:18 ```bash19 # Auto-detect skills-audit installation path20 AUDIT_SCRIPT=""21 for candidate in \22 ~/.claude/skills/skills-audit/skill_audit/cli_wrapper.py \23 ~/.claude/skills/skill-audit/skill_audit/cli_wrapper.py \24 "${SKILL_AUDIT_HOME:-}""/skill_audit/cli_wrapper.py"; do25 if [ -f "$candidate" ]; then26 AUDIT_SCRIPT="$candidate"27 break28 fi29 done3031 if [ -z "$AUDIT_SCRIPT" ]; then32 echo "Error: Cannot find skills-audit installation"33 echo "Set SKILL_AUDIT_HOME environment variable to your skills-audit directory"34 exit 135 fi3637 python3 "$AUDIT_SCRIPT" "$ARGUMENTS"38 ```3940 This will:41 - Extract skill artifacts (code, prompts, permissions)42 - Run static pattern matching (regex-based detection)43 - Check for obvious malicious patterns44 - Generate initial findings45462. **Perform AI semantic analysis** (if enabled)4748 If the scan mode includes AI analysis (standard/deep/expert), perform deep semantic security analysis:4950 a. **Read the skill code files** from the target path5152 b. **Analyze for security vulnerabilities**:53 - **Remote Code Execution**: `eval()`, `exec()`, `subprocess`, `curl | bash`54 - **Credential Leaks**: Hardcoded API keys, passwords, tokens, .env files55 - **Data Exfiltration**: Suspicious network requests, file uploads56 - **Prompt Injection**: "Ignore previous instructions", role manipulation57 - **Supply Chain Risks**: Obfuscated code, dynamic imports, base64 encoding58 - **Privilege Escalation**: sudo, setuid, file permission changes59 - **Persistence Mechanisms**: cron jobs, shell profile modifications6061 c. **Assess each finding**:62 - Severity: CRITICAL / HIGH / MEDIUM / LOW63 - Attack scenario: How can this be exploited?64 - Impact: What damage could be done? (CIA triad)65 - Remediation: How to fix it?6667 d. **Filter false positives**:68 - Exclude findings from skills-audit's own detection patterns (patterns.py regex)69 - Downgrade benign file operations (e.g. deleting old output before regeneration)70 - Verify env var access patterns (using dotenv is recommended, not a vulnerability)7172 e. **Output your analysis** in this format:73 ```74 AI SEMANTIC ANALYSIS FINDINGS:7576 1. [SEVERITY] Finding Title77 - Location: file.py:line78 - Pattern: describe what you found79 - Risk: explain the security risk80 - Scenario: how an attacker could exploit this81 - Impact: potential damage82 - Recommendation: how to fix8384 2. [SEVERITY] Finding Title85 ...86 ```8788 f. **Integrate AI findings into the report** (CRITICAL STEP)8990 After completing your AI analysis, integrate your findings into the audit report by running:9192 ```bash93 # Use the detected AUDIT_SCRIPT path from step 194 INTEGRATE_SCRIPT="$(dirname "$AUDIT_SCRIPT")/integrate_ai_findings.py"9596 python3 "$INTEGRATE_SCRIPT" \97 "<report_path>" \98 '<ai_findings_json>'99 ```100101 Where:102 - `<report_path>`: The path to the JSON report file (shown in step 1 output as "Detailed report saved to: ...")103 - `<ai_findings_json>`: Your AI analysis findings formatted as JSON array104105 **JSON Format for ai_findings**:106 ```json107 [108 {109 "title": "Base64-Obfuscated Remote Code Execution",110 "severity": "CRITICAL",111 "category": "unsafe_execution",112 "description": "Base64-encoded command that downloads and executes arbitrary code",113 "location": "skill.md:28",114 "code_snippet": "echo 'L2Jpbi9iYXNoIC1jIC...' | base64 -D | bash",115 "risk": "Remote code execution with complete system compromise",116 "scenario": "User follows installation instructions, base64 decodes to malicious payload, executes with shell privileges",117 "impact": {118 "confidentiality": "CRITICAL",119 "integrity": "CRITICAL",120 "availability": "CRITICAL"121 },122 "impact_description": "Full system compromise, data theft, ransomware deployment",123 "recommendation": "BLOCK this skill entirely. Never execute obfuscated commands.",124 "cwe_ids": ["CWE-78", "CWE-94", "CWE-506"]125 }126 ]127 ```128129 **Important**:130 - Convert ALL your AI analysis findings from step 2e into this JSON format131 - Include severity (CRITICAL/HIGH/MEDIUM/LOW), location, code snippets, risk, scenario, impact, and recommendations132 - This step MERGES your AI findings with static analysis findings and recalculates the overall risk score133 - **Webhook is NOT sent during this step** -- it will be sent after your comprehensive analysis1341353. **Send final webhook notification** (optional, if notifications are configured)136 After completing comprehensive analysis (including false positive filtering), send the webhook:137 ```bash138 # Auto-detect skills-audit path139 AUDIT_DIR="$(dirname "$(dirname "$AUDIT_SCRIPT")")"140 python3 -c "141 import sys; sys.path.insert(0, '$AUDIT_DIR')142 from skill_audit.integrations import send_final_webhook143 send_final_webhook(report_path='<report_path>')144 "145 ```146 This ensures the webhook contains the final, accurate results after your analysis.1471484. **Present comprehensive results to user**149 - Summarize the overall risk level and score (from integrated report)150 - List key findings with severity levels151 - Clearly mark any false positives that were filtered152 - For critical findings, include:153 - Title and severity154 - Evidence location and code snippet155 - Attack scenario and impact156 - Remediation recommendation157 - Provide the final decision recommendation158 - Reference the detailed JSON report path for full analysis1591605. **If high-risk issues are found**:161 - Explain the security implications162 - Suggest concrete remediation steps163 - Recommend whether to BLOCK, REVIEW, or ALLOW the skill164 - Warn about potential damage if the skill is executed165166## Scan Modes167168### Deep Mode (Default)169- **Speed**: ~2-5 minutes170- **Coverage**: Full Claude AI analysis + static patterns + deep code understanding171- **Use**: Recommended for all skills172- **Command**: `/skills-audit /path/to/skill` (default) or `/skills-audit /path/to/skill --mode deep`173- **Note**: Includes comprehensive AI analysis by Claude174175### Fast Mode176- **Speed**: ~1-2 seconds177- **Coverage**: Static pattern matching only178- **Use**: Quick check for obvious vulnerabilities179- **Command**: `/skills-audit /path/to/skill --mode fast`180181### Standard Mode182- **Speed**: ~30 seconds - 2 minutes (depends on code size)183- **Coverage**: Claude AI semantic analysis + static patterns184- **Use**: Balanced speed and coverage185- **Command**: `/skills-audit /path/to/skill --mode standard`186- **Note**: Claude (you) will perform semantic analysis187188### Expert Mode189- **Speed**: ~5-10 minutes190- **Coverage**: Complete analysis with all phases191- **Use**: Critical security reviews192- **Command**: `/skills-audit /path/to/skill --mode expert`193- **Note**: Maximum depth analysis performed by Claude194195## Detection Capabilities196197This audit detects:198199- **Remote Code Execution**: `curl | bash`, `eval()`, `exec()`200- **Credential Leaks**: Hardcoded API keys, passwords, .env files201- **Network Exfiltration**: Suspicious HTTP/Socket connections202- **Supply Chain Risks**: Obfuscation, dynamic imports203- **Prompt Injection**: "Ignore previous instructions"204- **System Manipulation**: File deletion, permission changes205206## Configuration207208Edit `config/config.yml` (relative to skills-audit installation directory) to customize:209210### Key Configuration Options211212```yaml213# Report save location214claude_code:215 # Options: cwd (current directory), skill_dir (skill directory), temp (temp directory), custom216 report_location: custom217 custom_report_dir: ~/.claude/audit-reports218219# Custom report naming220output:221 report_filename: "audit-{skill_name}-{timestamp}.json"222```223224### Scan Mode Customization225226```yaml227scan_modes:228 fast:229 enable_ai_analysis: false230 enable_static_analysis: true231 enable_deep_analysis: false232 enable_tip_check: false233 standard:234 enable_ai_analysis: true235 enable_static_analysis: true236 enable_deep_analysis: false237 enable_tip_check: false238 deep:239 enable_ai_analysis: true240 enable_static_analysis: true241 enable_deep_analysis: true242 enable_tip_check: true243```244245## Notes246247- **Default mode is deep** (includes AI + Static + Deep analysis by Claude)248- **For quick scans**, use `--mode fast` (static analysis only, 1-2 seconds)249- **AI analysis** in standard/deep/expert modes is performed by Claude directly (no API calls)250- **Reports saved to ~/.claude/audit-reports/** by default (configurable)251- **Use `--mode` flag** to override scan mode (the `--mode` parameter is authoritative)252- **Config file location**: `config/config.yml` relative to skills-audit installation directory253- **Webhook is deferred** until after Claude's comprehensive analysis (false positive filtering)254- **skills-audit itself is excluded** from scanning to avoid self-referential false positives255- **Works offline**: Static analysis works without internet; AI analysis uses current Claude session