К основному содержанию
скилл CX Codex

performing-security-headers-audit — скилл для Claude Code

Проверяет заголовки безопасности HTTP, включая CSP, HSTS и параметры cookie. Помогает найти уязвимые места в защите веб-приложения на уровне браузера.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-security-headers-audit -a claude-code
Открыть на GitHub

Что делает performing-security-headers-audit

Скилл выстраивает аудит заголовков ответа веб-сервера через утилиту curl. Он отправляет запросы к указанным адресам, считывает директивы Content-Security-Policy, Strict-Transport-Security, X-Frame-Options и X-Content-Type-Options, а затем отмечает потенциально опасные конфигурации. Среди них — использование 'unsafe-inline' или 'unsafe-eval' в политиках скриптов и отсутствие обязательных атрибутов у сессионных cookie.

Проверка охватывает сразу несколько типовых путей сайта и сопоставляет ответы по HTTP и HTTPS, отслеживая редиректы и риски смешанного содержимого. Для работы требуется установленная в системе утилита curl и предварительное разрешение на аудит целевого ресурса. Скрипты разбора флагов cookie опираются на атрибуты Secure, HttpOnly и SameSite.

Какие задачи решает

  • найти небезопасные директивы в Content-Security-Policy
  • проверить флаги Secure и HttpOnly для сессионных cookie
  • оценить корректность настройки HSTS и перенаправлений с HTTP
  • выявить отсутствие заголовков защиты от кликджекинга

Примеры запросов агенту

  • Проверь заголовки безопасности на сервере через performing-security-headers-audit
  • Выполни аудит CSP и HSTS для нашего веб-приложения
  • Собери заголовки ответа для страницы входа и проверь флаги cookie

Как установить performing-security-headers-audit

1Через Skills CLI (Vercel)

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-security-headers-audit -a claude-code

2Вручную: положить файлы

~/.claude/skills/performing-security-headers-audit/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/performing-security-headers-audit/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о performing-security-headers-audit

Как установить performing-security-headers-audit в Claude Code?

Выполните команду npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-security-headers-audit -a claude-code.

Что проверяет скилл performing-security-headers-audit?

Он анализирует конфигурацию HSTS, директивы CSP, защиту от внедрения во фреймы и наличие флагов безопасности в cookie.

Какие инструменты нужны для проведения аудита?

Основным инструментом выступает утилита curl. Дополнительно для углублённого анализа можно использовать Burp Suite или инструменты разработчика в браузере.

Исходный текст

SKILL.md · Apache-2.0
---
name: performing-security-headers-audit
description: Auditing HTTP security headers including CSP, HSTS, X-Frame-Options,
  and cookie attributes to identify missing or misconfigured browser-level protections.
domain: cybersecurity
subdomain: web-application-security
tags:
- penetration-testing
- security-headers
- csp
- hsts
- owasp
- web-security
- hardening
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.PS-01
- ID.RA-01
- PR.DS-10
- DE.CM-01
mitre_attack:
- T1190
- T1059.007
- T1505.003
- T1083
---

# Performing Security Headers Audit

## When to Use

- During authorized web application security assessments as a standard configuration review
- When evaluating browser-level protections against XSS, clickjacking, and data leakage
- For compliance assessments requiring security header implementation (PCI DSS, SOC 2)
- When performing initial reconnaissance to identify easy-win security improvements
- During CI/CD pipeline security gate checks for new deployments

## Prerequisites

- **Authorization**: Written scope for the target application (header review is low-risk)
- **curl**: For fetching response headers from target endpoints
- **SecurityHeaders.com**: Online scanner for quick header assessment
- **Mozilla Observatory**: Mozilla's web security testing tool
- **Burp Suite**: For comprehensive header analysis across multiple pages
- **Browser DevTools**: For examining headers and CSP violations in real-time

## Workflow

### Step 1: Collect Security Headers from Target

Retrieve and catalog all security-related response headers.

```bash
# Fetch all response headers
curl -s -I "https://target.example.com/" | grep -iE \
  "(strict-transport|content-security|x-frame|x-content-type|x-xss|referrer-policy|permissions-policy|feature-policy|x-permitted|cross-origin|set-cookie|server|x-powered-by|cache-control)"

# Check headers across multiple pages
PAGES=("/" "/login" "/api/health" "/admin" "/account/settings" "/static/app.js")

for page in "${PAGES[@]}"; do
  echo "=== $page ==="
  curl -s -I "https://target.example.com$page" 2>/dev/null | grep -iE \
    "(strict-transport|content-security|x-frame|x-content-type|x-xss|referrer-policy|permissions-policy|set-cookie|server|x-powered)"
  echo
done

# Check both HTTP and HTTPS responses
echo "=== HTTP Response ==="
curl -s -I "http://target.example.com/" | head -20
echo "=== HTTPS Response ==="
curl -s -I "https://target.example.com/" | head -20
```

### Step 2: Assess Transport Security (HSTS)

Evaluate HTTP Strict Transport Security configuration.

```bash
# Check HSTS header
curl -s -I "https://target.example.com/" | grep -i "strict-transport-security"

# Expected: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

# Verify HSTS attributes:
# max-age: Should be >= 31536000 (1 year) for preload eligibility
# includeSubDomains: Protects all subdomains
# preload: Eligible for browser HSTS preload list

# Check if HTTP redirects to HTTPS
curl -s -I "http://target.example.com/" | head -5
# Should be 301/302 redirect to https://

# Check if HSTS is on the preload list
# Visit: https://hstspreload.org/?domain=target.example.com

# Test for HTTPS-only cookies
curl -s -I "https://target.example.com/login" | grep -i "set-cookie"
# All session cookies should have Secure flag

# Check for mixed content
curl -s "https://target.example.com/" | grep -oP "http://[^\"']+" | head -20
# HTTP resources loaded on HTTPS pages create mixed content vulnerabilities
```

### Step 3: Audit Content Security Policy (CSP)

Analyze CSP headers for effectiveness and potential bypasses.

```bash
# Extract CSP header
CSP=$(curl -s -I "https://target.example.com/" | grep -i "content-security-policy" | cut -d: -f2-)
echo "$CSP"

# Check for dangerous directives:
# 'unsafe-inline' in script-src: Allows inline scripts (XSS risk)
# 'unsafe-eval' in script-src: Allows eval() (XSS risk)
# * in any directive: Allows loading from any origin
# data: in script-src: Allows data: URI scripts
# Missing default-src: No fallback policy

echo "$CSP" | tr ';' '\n' | while read directive; do
  echo "  $directive"
  if echo "$directive" | grep -q "unsafe-inline"; then
    echo "    WARNING: unsafe-inline allows inline script execution"
  fi
  if echo "$directive" | grep -q "unsafe-eval"; then
    echo "    WARNING: unsafe-eval allows eval() calls"
  fi
  if echo "$directive" | grep -q " \* "; then
    echo "    WARNING: wildcard allows loading from any origin"
  fi
done

# Check for CSP report-only (not enforcing)
curl -s -I "https://target.example.com/" | grep -i "content-security-policy-report-only"
# Report-only does NOT block violations, only logs them

# Test CSP with Google's evaluator
# https://csp-evaluator.withgoogle.com/
# Paste the CSP header for automated analysis

# Check for CSP bypass via whitelisted domains
# If CDN domains are whitelisted, check for JSONP endpoints or angular libraries
```

### Step 4: Check Frame Protection and Click Defense Headers

Verify anti-clickjacking and iframe embedding controls.

```bash
# X-Frame-Options
curl -s -I "https://target.example.com/" | grep -i "x-frame-options"
# Expected: DENY or SAMEORIGIN
# ALLOW-FROM is deprecated and not supported in modern browsers

# CSP frame-ancestors (supersedes X-Frame-Options)
curl -s -I "https://target.example.com/" | grep -i "content-security-policy" | grep -o "frame-ancestors[^;]*"
# Expected: frame-ancestors 'none' or frame-ancestors 'self'

# X-Content-Type-Options
curl -s -I "https://target.example.com/" | grep -i "x-content-type-options"
# Expected: nosniff (prevents MIME type sniffing)

# X-XSS-Protection (legacy, but still useful for older browsers)
curl -s -I "https://target.example.com/" | grep -i "x-xss-protection"
# Expected: 1; mode=block (or 0 if CSP is comprehensive)
# Note: Modern recommendation is 0 (disable) when CSP is present

# Referrer-Policy
curl -s -I "https://target.example.com/" | grep -i "referrer-policy"
# Expected: strict-origin-when-cross-origin or no-referrer
# Prevents sensitive URL data from leaking via Referer header
```

### Step 5: Audit Cookie Security Attributes

Examine session and authentication cookies for security flags.

```bash
# Fetch all Set-Cookie headers
curl -s -I -L "https://target.example.com/login" | grep -i "set-cookie"

# Check each cookie for required attributes:
# Secure: Only sent over HTTPS
# HttpOnly: Not accessible via JavaScript (prevents XSS cookie theft)
# SameSite: Controls cross-site cookie sending (Strict, Lax, None)
# Path: Restricts cookie scope
# Domain: Controls which domains receive the cookie
# Max-Age/Expires: Cookie lifetime

# Automated cookie check
curl -s -I "https://target.example.com/login" | grep -i "set-cookie" | while read line; do
  echo "Cookie: $(echo "$line" | grep -oP '[^:]+=[^;]+')"
  missing=""
  echo "$line" | grep -qi "secure" || missing="$missing Secure"
  echo "$line" | grep -qi "httponly" || missing="$missing HttpOnly"
  echo "$line" | grep -qi "samesite" || missing="$missing SameSite"
  if [ -n "$missing" ]; then
    echo "  MISSING:$missing"
  else
    echo "  All flags present"
  fi
done

# Check for __Host- and __Secure- cookie prefixes
# __Host- cookies must have Secure, Path=/, no Domain
# __Secure- cookies must have Secure flag
```

### Step 6: Check Permissions Policy and Information Disclosure

Review browser feature controls and information leakage headers.

```bash
# Permissions-Policy (formerly Feature-Policy)
curl -s -I "https://target.example.com/" | grep -i "permissions-policy"
# Controls browser features: camera, microphone, geolocation, etc.
# Expected: Restrict unused features
# Example: permissions-policy: camera=(), microphone=(), geolocation=()

# Cross-Origin headers
curl -s -I "https://target.example.com/" | grep -iE "(cross-origin-embedder|cross-origin-opener|cross-origin-resource)"
# COEP: Cross-Origin-Embedder-Policy: require-corp
# COOP: Cross-Origin-Opener-Policy: same-origin
# CORP: Cross-Origin-Resource-Policy: same-origin

# Information disclosure headers to flag
curl -s -I "https://target.example.com/" | grep -iE "(server|x-powered-by|x-aspnet|x-generator)"
# Server: Apache/2.4.52 (should be removed or generic)
# X-Powered-By: PHP/8.1.2 (should be removed)
# These headers reveal technology stack to attackers

# Cache-Control for sensitive pages
curl -s -I "https://target.example.com/account/settings" | grep -i "cache-control"
# Sensitive pages should have: Cache-Control: no-store, no-cache, must-revalidate
# Prevents browser caching of sensitive data

# Generate comprehensive report using online tools
echo "Scan with SecurityHeaders.com: https://securityheaders.com/?q=target.example.com"
echo "Scan with Mozilla Observatory: https://observatory.mozilla.org/analyze/target.example.com"
```

## Key Concepts

| Concept | Description |
|---------|-------------|
| **HSTS** | Forces browsers to only use HTTPS for the domain, preventing protocol downgrade attacks |
| **CSP** | Restricts which resources (scripts, styles, images) can load on the page |
| **X-Frame-Options** | Controls whether the page can be embedded in iframes (clickjacking defense) |
| **X-Content-Type-Options** | Prevents MIME type sniffing; forces browser to respect declared Content-Type |
| **Referrer-Policy** | Controls how much referrer information is sent with cross-origin requests |
| **Permissions-Policy** | Restricts browser features (camera, microphone, geolocation) available to the page |
| **SameSite Cookie** | Controls when cookies are sent in cross-site contexts (Strict, Lax, None) |
| **HSTS Preloading** | Hardcoding HSTS policy in browser source code for first-visit protection |

## Tools & Systems

| Tool | Purpose |
|------|---------|
| **SecurityHeaders.com** | Online scanner providing letter-grade security header assessment |
| **Mozilla Observatory** | Comprehensive web security scanner with scoring and recommendations |
| **CSP Evaluator (Google)** | Analyzes Content Security Policy for weaknesses and bypasses |
| **Burp Suite Professional** | Inspecting response headers across all application pages |
| **securityheaders (CLI)** | Command-line security header scanner |
| **Hardenize** | TLS and security header monitoring service |

## Common Scenarios

### Scenario 1: Complete Header Absence
A legacy application returns no security headers at all. No HSTS, CSP, X-Frame-Options, or cookie security flags. Every page is vulnerable to clickjacking, XSS has no browser-level mitigation, and cookies are sent over HTTP.

### Scenario 2: Weak CSP with unsafe-inline
The CSP header includes `script-src 'self' 'unsafe-inline'`. While it restricts external script loading, the `unsafe-inline` directive allows any inline script to execute, rendering the CSP ineffective against XSS.

### Scenario 3: Session Cookie Without Secure Flag
The session cookie is set without the `Secure` flag. On mixed HTTP/HTTPS sites, the session token can be intercepted by a network attacker via a plain HTTP request.

### Scenario 4: Missing HSTS Enabling SSL Stripping
No HSTS header is present. An attacker on the network can perform an SSL stripping attack, downgrading the victim's HTTPS connection to HTTP and intercepting all traffic.

## Output Format

```
## Security Headers Audit Report

**Target**: target.example.com
**Grade**: D (SecurityHeaders.com)
**Assessment Date**: 2024-01-15

### Headers Assessment
| Header | Status | Current Value | Recommended |
|--------|--------|---------------|-------------|
| Strict-Transport-Security | MISSING | - | max-age=31536000; includeSubDomains; preload |
| Content-Security-Policy | WEAK | script-src 'self' 'unsafe-inline' | script-src 'self' 'nonce-{random}' |
| X-Frame-Options | MISSING | - | DENY |
| X-Content-Type-Options | PRESENT | nosniff | nosniff (OK) |
| Referrer-Policy | MISSING | - | strict-origin-when-cross-origin |
| Permissions-Policy | MISSING | - | camera=(), microphone=(), geolocation=() |
| X-XSS-Protection | MISSING | - | 0 (with strong CSP) |

### Cookie Security
| Cookie | Secure | HttpOnly | SameSite | Path |
|--------|--------|----------|----------|------|
| session | NO | YES | Not set | / |
| user_pref | NO | NO | Not set | / |
| csrf_token | YES | NO | Strict | / |

### Information Disclosure
| Header | Value | Risk |
|--------|-------|------|
| Server | Apache/2.4.52 | Technology fingerprinting |
| X-Powered-By | PHP/8.1.2 | Version-specific exploit targeting |

### Recommendation Priority
1. **Critical**: Add Secure and SameSite flags to session cookie
2. **High**: Implement HSTS with min 1-year max-age
3. **High**: Replace 'unsafe-inline' in CSP with nonce-based policy
4. **Medium**: Add X-Frame-Options: DENY
5. **Medium**: Add Referrer-Policy: strict-origin-when-cross-origin
6. **Low**: Remove Server and X-Powered-By version information
7. **Low**: Add Permissions-Policy to restrict unused browser features
```

© mahipal · Apache-2.0 · mukul975/Anthropic-Cybersecurity-Skills

Похожие скиллы

Всё по теме «Безопасность» →
security-headers-configuration secondsky Настраивает HTTP-заголовки безопасности против XSS, кликджекинга и MIME-сниффинга. Пригодится при аудите или внедрении CSP. CX Codex +1 438установок web-security-review OWASP Проверяет веб-приложения по рискам OWASP Top 10 (2021) и формирует отчёт с матрицей рисков. Пригодится при аудите серверного кода, веб-фреймворков и конфигураций. CX Codex +1 613установок security-auditor sickn33 Скилл превращает ИИ-кодер в эксперта по безопасности: проводит аудиты, анализирует уязвимости, проверяет SDLC и соответствие стандартам вроде OWASP, GDPR и PCI-DSS. CX Codex +1 1 400установок security-audit decebals Чек-лист по OWASP Top 10 для Java-кода: проверяет валидацию ввода, SQL-инъекции, XSS и настройки безопасности. Пригодится перед релизом и при ревью авторизации. CX Codex +1 309установок xss-cross-site-scripting yaklang Скилл для ИИ-агента, который подсказывает неочевидные XSS-векторы: выбор пейлоада под контекст, обход WAF и CSP. CX Codex +1 3 900установок csp-bypass-advanced yaklang Скилл для разбора слабых мест Content Security Policy: где политика не закрывает директиву, где можно увести данные без JavaScript. CX Codex +1 3 600установок

Из того же набора89

analyzing-malware-sandbox-evasion-techniques Разбирает отчёты Cuckoo и AnyRun и находит в них признаки того, что образец распознал песочницу и притворился безвредным. CX Codex +1 363установок exploiting-idor-vulnerabilities Помогает находить и проверять IDOR-уязвимости в API через манипуляцию идентификаторами в Burp Suite и curl при авторизованном пентесте. CX Codex +1 365установок analyzing-malware-behavior-with-cuckoo-sandbox Скилл гоняет образцы в Cuckoo Sandbox и разбирает, что они делают при запуске: процессы, файлы, реестр, сеть. CX Codex +1 361установок testing-for-sensitive-data-exposure Скилл для проверки веб-приложений и API на утечку секретов, PII и незашифрованную передачу данных. Пригодится на авторизованном пентесте и при аудите под GDPR, PCI DSS или HIPAA. CX Codex +1 356установок analyzing-malware-persistence-with-autoruns Скилл ведёт агента по разбору точек автозапуска Windows через Sysinternals Autoruns: реестр, службы, задачи, драйверы. Пригодится при реагировании на инцидент. CX Codex +1 356установок analyzing-memory-dumps-with-volatility Скилл помогает расследовать дампы оперативной памяти через Volatility 3: выявляет скрытые процессы, инъекции кода, открытые сокеты и извлекает пароли из RAM. CX Codex +1 354установок testing-oauth2-implementation-flaws Скилл для проверки OAuth 2.0 и OpenID Connect на перехват кода, подмену redirect URI, CSRF, утечку токенов и обход PKCE. CX Codex +1 350установок implementing-api-rate-limiting-and-throttling Скилл внедряет алгоритмы sliding window и token bucket через Redis, защищая эндпоинты API от перебора паролей и исчерпания ресурсов. CX Codex +1 348установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой