Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tools-only/X-Skills --skill scan-api-security명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
SOC 직업 분류 기준
SKILL.md 표시 중
| name | scan-api-security |
| description | Scan API for security vulnerabilities |
| shortcut | apis |
Perform comprehensive automated security scanning to identify OWASP API Security Top 10 vulnerabilities, misconfigurations, and potential attack vectors with detailed remediation guidance.
Use /scan-api-security when you need to:
DON'T use this when:
This command implements OWASP ZAP + Custom Scanners as the primary approach because:
Alternative considered: Burp Suite
Alternative considered: Manual testing only
Before running this command:
Set up OWASP ZAP or similar tools with API-specific rules and authentication.
Run comprehensive automated scans for known vulnerability patterns.
Verify critical findings and test business logic vulnerabilities.
Review findings, eliminate false positives, and prioritize by severity.
Create detailed report with findings, evidence, and remediation steps.
The command generates:
security-report.html - Executive summary with chartsvulnerabilities.json - Machine-readable findingsevidence/ - Screenshots and request/response logsremediation-guide.md - Fix recommendations by prioritysecurity-tests.py - Regression tests for found issuescompliance-checklist.md - Standards compliance status// security-scanner.js
const ZAPClient = require('zaproxy');
const axios = require('axios');
const jwt = require('jsonwebtoken');
const { createHash } = require('crypto');
class APISecurityScanner {
constructor(apiUrl, options = {}) {
this.apiUrl = apiUrl;
this.zapOptions = {
proxy: options.zapProxy || 'http://localhost:8080',
apiKey: options.zapApiKey || 'your-zap-api-key'
};
this.zap = new ZAPClient(this.zapOptions);
this.findings = [];
this.credentials = options.credentials || {};
}
async runComprehensiveScan() {
console.log('Starting comprehensive API security scan...');
try {
// Phase 1: Authentication Testing
await this.();
.();
.();
.();
.();
.();
.();
.();
} (error) {
.(, error);
error;
}
}
() {
.();
tests = [
{
: ,
: () => {
token = jwt.({ : }, , { : });
modifiedToken = token.(, );
{
response = axios.(, {
: { : }
});
(response. === ) {
.({
: ,
: ,
: ,
: ,
: { : modifiedToken, : response. },
:
});
}
} (error) {
}
}
},
{
: ,
: () => {
weakPasswords = [, , ];
( password weakPasswords) {
{
response = axios.(, {
: ,
: password
});
(response. === ) {
.({
: ,
: ,
: ,
: ,
: { password, : response. },
:
});
}
} (error) {
}
}
}
},
{
: ,
: () => {
fixedSession = ;
{
response = axios.(,
{ : , : },
{ : { : } }
);
setCookie = response.[];
(setCookie && setCookie.(fixedSession)) {
.({
: ,
: ,
: ,
: ,
: { : fixedSession, setCookie },
:
});
}
} (error) {
}
}
}
];
( test tests) {
{
test.();
} (error) {
.(, error.);
}
}
}
() {
.();
userTokens = {
: .(, ),
: .(, )
};
{
response = axios.(, {
: { : }
});
(response. === ) {
.({
: ,
: ,
: ,
: ,
: {
: ,
: ,
: response.
},
:
});
}
} (error) {
}
{
response = axios.(,
{ : },
{ : { : } }
);
(response. === ) {
.({
: ,
: ,
: ,
: ,
: { : , : response. },
:
});
}
} (error) {
}
}
() {
.();
injectionPayloads = {
: [, , ],
: [, , ],
: [, , ],
: [],
: [, , ]
};
( [type, payloads] .(injectionPayloads)) {
( payload payloads) {
{
response = axios.(, {
: payload
});
(response. && .(response.).(payload)) {
.({
: ,
: ,
: ,
: ,
: { payload, : response. },
:
});
}
} (error) {
}
}
}
}
() {
.();
{
response = axios.();
(response. && .(response.)) {
sensitiveFields = [, , , , ];
exposedFields = [];
response..( {
sensitiveFields.( {
(user[field] !== ) {
exposedFields.(field);
}
});
});
(exposedFields. > ) {
.({
: ,
: ,
: ,
: ,
: { : [... (exposedFields)] },
:
});
}
}
} (error) {
.(, error.);
}
}
() {
.();
endpoint = ;
requests = [];
requestCount = ;
( i = ; i < requestCount; i++) {
requests.(
axios.(endpoint, {
: ,
:
}).( ({ : err.?. }))
);
}
responses = .(requests);
successfulRequests = responses.( r. !== ).;
(successfulRequests === requestCount) {
.({
: ,
: ,
: ,
: ,
: {
endpoint,
: requestCount,
successfulRequests
},
:
});
}
}
() {
.();
{
response = axios.(.);
headers = response.;
requiredHeaders = {
: ,
: ,
: ,
: ,
:
};
missingHeaders = [];
( [header, expectedValue] .(requiredHeaders)) {
(!headers[header]) {
missingHeaders.(header);
} (expectedValue && headers[header] !== expectedValue) {
missingHeaders.();
}
}
(missingHeaders. > ) {
.({
: ,
: ,
: ,
: ,
: { missingHeaders },
:
});
}
} (error) {
.(, error.);
}
}
() {
.();
...(, );
...();
contextId = ...();
...(contextId, );
scanId = ...(., , );
progress = ;
(progress < ) {
progress = ...(scanId);
.();
.();
}
alerts = ...(.);
alerts.( {
.({
: .(alert.),
: ,
: alert.,
: alert.,
: {
: alert.,
: alert.,
: alert.,
: alert.
},
: alert.
});
});
}
() {
..({
...finding,
: ().(),
: ().(.(finding)).()
});
}
() {
mapping = {
: ,
: ,
: ,
:
};
mapping[risk] || ;
}
() {
{
response = axios.(, {
username,
password
});
response..;
} (error) {
.();
;
}
}
() {
( (resolve, ms));
}
() {
report = {
: ().(),
: .,
: {
: ..,
: ..( f. === ).,
: ..( f. === ).,
: ..( f. === ).,
: ..( f. === ).
},
: .,
: .()
};
().(
,
.(report, , )
);
.();
.();
.();
.();
report;
}
() {
recommendations = [];
(..( f. === )) {
recommendations.({
: ,
: ,
: [
,
,
]
});
}
(..( f. === )) {
recommendations.({
: ,
: ,
: [
,
,
]
});
}
recommendations;
}
}
scanner = (, {
: {
: { : , : },
: { : , : }
},
: ,
:
});
scanner.()
.( {
.();
})
.( {
.(, error);
process.();
});
# api_security_scanner.py
import requests
import json
import hashlib
import time
from typing import Dict, List, Any
from dataclasses import dataclass, asdict
from enum import Enum
import jwt
import base64
from urllib.parse import urlparse
class Severity(Enum):
CRITICAL = "CRITICAL"
HIGH = "HIGH"
MEDIUM = "MEDIUM"
LOW = "LOW"
INFO = "INFO"
@dataclass
class SecurityFinding:
severity: Severity
category: str
title: str
description: str
evidence: Dict[str, Any]
remediation: str
cwe_id: str = None
owasp_category: str = None
class APISecurityTester:
def __init__(self, base_url: str, auth_token: str = None):
self.base_url = base_url
self.session = requests.Session()
auth_token:
.session.headers[] =
.findings: [SecurityFinding] = []
():
()
test_suites = [
.test_broken_authentication,
.test_broken_authorization,
.test_excessive_data_exposure,
.test_lack_of_resources_rate_limiting,
.test_security_misconfiguration,
.test_injection_vulnerabilities,
.test_improper_assets_management,
.test_insufficient_logging
]
test_suite test_suites:
:
test_suite()
Exception e:
()
.generate_report()
():
()
sql_payloads = [
,
,
,
]
endpoints = [, , ]
endpoint endpoints:
payload sql_payloads:
:
response = .session.get(
,
params={: payload}
)
error_indicators = [
,
,
,
,
]
response_text = response.text.lower()
indicator error_indicators:
indicator.lower() response_text:
.add_finding(
severity=Severity.CRITICAL,
category=,
title=,
description=,
evidence={
: endpoint,
: payload,
: indicator
},
remediation=,
cwe_id=
)
Exception e:
():
()
test_token =
header = base64.urlsafe_b64encode(
json.dumps({: , : }).encode()
).decode().rstrip()
payload = test_token.split()[]
none_token =
response = .session.get(
,
headers={: }
)
response.status_code == :
.add_finding(
severity=Severity.CRITICAL,
category=,
title=,
description=,
evidence={: none_token[:] + },
remediation=,
cwe_id=
)
():
finding = SecurityFinding(**kwargs)
.findings.append(finding)
()
() -> [, ]:
report = {
: time.strftime(),
: .base_url,
: (.findings),
: {
: ([f f .findings f.severity == Severity.CRITICAL]),
: ([f f .findings f.severity == Severity.HIGH]),
: ([f f .findings f.severity == Severity.MEDIUM]),
: ([f f .findings f.severity == Severity.LOW])
},
: [asdict(f) f .findings]
}
(, ) f:
json.dump(report, f, indent=)
()
report
__name__ == :
scanner = APISecurityTester()
report = scanner.run_security_tests()
()
| Error | Cause | Solution |
|---|---|---|
| "Connection refused to ZAP" | ZAP proxy not running | Start ZAP daemon on configured port |
| "Permission denied" | No authorization for security testing | Obtain written permission before scanning |
| "Rate limited during scan" | Too many requests | Reduce scan speed, add delays |
| "False positive findings" | Overly aggressive rules | Manually verify and tune scanner rules |
| "Incomplete scan results" | Scan timeout | Increase timeout, scan in phases |
Scan Modes
passive: Non-intrusive scanning onlyactive: Full vulnerability testingtargeted: Focus on specific vulnerabilitiescompliance: Check against standardsAuthentication Types
bearer: JWT/OAuth tokensbasic: Username/passwordapikey: API key authenticationcertificate: Client certificatesDO:
DON'T:
OWASP API Security Top 10 (2023)
/api-authentication-builder - Implement secure authentication/api-rate-limiter - Add rate limiting protection/api-monitoring-dashboard - Monitor security events/api-response-validator - Validate API responses