$npx -y skills add xwtro0tk1t-cloud/harness --skill skills-auditAudit AI Agent skills for security vulnerabilities including malicious code, remote execution, credential leaks, and supply chain risks. Use when reviewing third-party skills, investigating suspicious behavior, or performing security assessments.
| 1 | # Security Audit for AI Agent Skills |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | ## Task |
| 6 | |
| 7 | Audit the skill at path: **$ARGUMENTS** |
| 8 | |
| 9 | ## Execution Steps |
| 10 | |
| 11 | 1. **Run static security scan** |
| 12 | Execute the Python audit tool for static analysis: |
| 13 | ```bash |
| 14 | # Auto-detect skills-audit installation path |
| 15 | AUDIT_SCRIPT="" |
| 16 | for candidate in \ |
| 17 | ~/.claude/skills/skills-audit/skill_audit/cli_wrapper.py \ |
| 18 | ~/.claude/skills/skill-audit/skill_audit/cli_wrapper.py \ |
| 19 | "${SKILL_AUDIT_HOME:-}""/skill_audit/cli_wrapper.py"; do |
| 20 | if [ -f "$candidate" ]; then |
| 21 | AUDIT_SCRIPT="$candidate" |
| 22 | break |
| 23 | fi |
| 24 | done |
| 25 | |
| 26 | if [ -z "$AUDIT_SCRIPT" ]; then |
| 27 | echo "Error: Cannot find skills-audit installation" |
| 28 | echo "Set SKILL_AUDIT_HOME environment variable to your skills-audit directory" |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | python3 "$AUDIT_SCRIPT" "$ARGUMENTS" |
| 33 | ``` |
| 34 | |
| 35 | This will: |
| 36 | - Extract skill artifacts (code, prompts, permissions) |
| 37 | - Run static pattern matching (regex-based detection) |
| 38 | - Check for obvious malicious patterns |
| 39 | - Generate initial findings |
| 40 | |
| 41 | 2. **Perform AI semantic analysis** (if enabled) |
| 42 | |
| 43 | If the scan mode includes AI analysis (standard/deep/expert), perform deep semantic security analysis: |
| 44 | |
| 45 | a. **Read the skill code files** from the target path |
| 46 | |
| 47 | b. **Analyze for security vulnerabilities**: |
| 48 | - **Remote Code Execution**: `eval()`, `exec()`, `subprocess`, `curl | bash` |
| 49 | - **Credential Leaks**: Hardcoded API keys, passwords, tokens, .env files |
| 50 | - **Data Exfiltration**: Suspicious network requests, file uploads |
| 51 | - **Prompt Injection**: "Ignore previous instructions", role manipulation |
| 52 | - **Supply Chain Risks**: Obfuscated code, dynamic imports, base64 encoding |
| 53 | - **Privilege Escalation**: sudo, setuid, file permission changes |
| 54 | - **Persistence Mechanisms**: cron jobs, shell profile modifications |
| 55 | |
| 56 | c. **Assess each finding**: |
| 57 | - Severity: CRITICAL / HIGH / MEDIUM / LOW |
| 58 | - Attack scenario: How can this be exploited? |
| 59 | - Impact: What damage could be done? (CIA triad) |
| 60 | - Remediation: How to fix it? |
| 61 | |
| 62 | d. **Filter false positives**: |
| 63 | - Exclude findings from skills-audit's own detection patterns (patterns.py regex) |
| 64 | - Downgrade benign file operations (e.g. deleting old output before regeneration) |
| 65 | - Verify env var access patterns (using dotenv is recommended, not a vulnerability) |
| 66 | |
| 67 | e. **Output your analysis** in this format: |
| 68 | ``` |
| 69 | AI SEMANTIC ANALYSIS FINDINGS: |
| 70 | |
| 71 | 1. [SEVERITY] Finding Title |
| 72 | - Location: file.py:line |
| 73 | - Pattern: describe what you found |
| 74 | - Risk: explain the security risk |
| 75 | - Scenario: how an attacker could exploit this |
| 76 | - Impact: potential damage |
| 77 | - Recommendation: how to fix |
| 78 | |
| 79 | 2. [SEVERITY] Finding Title |
| 80 | ... |
| 81 | ``` |
| 82 | |
| 83 | f. **Integrate AI findings into the report** (CRITICAL STEP) |
| 84 | |
| 85 | After completing your AI analysis, integrate your findings into the audit report by running: |
| 86 | |
| 87 | ```bash |
| 88 | # Use the detected AUDIT_SCRIPT path from step 1 |
| 89 | INTEGRATE_SCRIPT="$(dirname "$AUDIT_SCRIPT")/integrate_ai_findings.py" |
| 90 | |
| 91 | python3 "$INTEGRATE_SCRIPT" \ |
| 92 | "<report_path>" \ |
| 93 | '<ai_findings_json>' |
| 94 | ``` |
| 95 | |
| 96 | Where: |
| 97 | - `<report_path>`: The path to the JSON report file (shown in step 1 output as "Detailed report saved to: ...") |
| 98 | - `<ai_findings_json>`: Your AI analysis findings formatted as JSON array |
| 99 | |
| 100 | **JSON Format for ai_findings**: |
| 101 | ```json |
| 102 | [ |
| 103 | { |
| 104 | "title": "Base64-Obfuscated Remote Code Execution", |
| 105 | "severity": "CRITICAL", |
| 106 | "category": "unsafe_execution", |
| 107 | "description": "Base64-encoded command that downloads and executes arbitrary code", |
| 108 | "location": "skill.md:28", |
| 109 | "code_snippet": "echo 'L2Jpbi9iYXNoIC1jIC...' | base64 -D | bash", |
| 110 | "risk": "Remote code execution with complete system compromise", |
| 111 | "scenario": "User follows installation instructions, base64 decodes to malicious payload, executes with shell privileges", |
| 112 | "impact": { |
| 113 | "confidentiality": "CRITICAL", |
| 114 | "integrity": "CRITICAL", |
| 115 | "availability": "CRITICAL" |
| 116 | }, |
| 117 | "impact_description": "Full system compromise, data theft, ransomware deployment", |
| 118 | "recommendation": "BLOCK this skill entirely. Never execute obfuscated commands. |