Cos'è un attacco di inondazione DNS?
Un'alluvione DNS è un tipo di attacco Distributed Denial of Service (DDoS) che travolge l'infrastruttura DNS inviando volumi massicci di query DNS a server DNS (server di nomi autorizzati o risolutori ricorrenti). L'obiettivo è quello di esaurire le risorse del server, rendendo il servizio DNS non disponibile e impedendo agli utenti legittimi di risolvere i nomi di dominio.
Impatto di attacchi di inondazione DNS
Quando i server DNS sono sopraffatti:
Normal operation:
User → DNS query → DNS server → Response → Website loads
During DNS flood:
User → DNS query → DNS server (overwhelmed, no response)
→ Website doesn't load (even though web server is fine)
Effects.
- I siti web diventano irraggiungibili (anche se i server web sono operativi)
- La consegna e-mail fallisce (la ricerca di record di MX fallisce)
- API e servizi basati su DNS diventano non disponibili
- Danni collaterali all'infrastruttura DNS condivisa
Tipi di attacchi di inondazione DNS
Inondazione di query DNS diretta
Attacker invia query DNS legittime ad alto volume:
Botnet → Millions of DNS queries → Target DNS server
Query examples:
example.com A
www.example.com A
random1.example.com A
random2.example.com A
...millions more...
Characteristics
- Domande DNS valide (difficile da filtrare)
- Spesso per sottodomini casuali (caching bypass)
- Utilizza botnet per attacco distribuito
Attacco di amplificazione DNS
Sfrutta i risolutori ricorrenti per amplificare il traffico di attacco:
1. Attacker sends small query to open resolver
2. Spoofs source IP as victim's IP
3. Resolver sends large response to victim
4. Attacker amplifies bandwidth 28-54x
Esemplare.
Attacker sends: 60-byte query for TXT record (ANY query)
Resolver sends: 3000-byte response to victim
Amplification: 50x
Inondazione NXDOMAIN
Domande per domini non esistenti per bypassare la cache:
Query: random-12345.example.com (doesn't exist)
Server must check authoritative zone every time
Cannot be cached (NXDOMAIN responses often have low TTL)
Consumes more server resources than cached responses
Attacco di dominio fantasma
Query domini legittimi che non rispondono:
Attacker: Queries resolver for slow/non-responsive domains
Resolver: Waits for timeout, consumes resources
Result: Resolver resource exhaustion
Attacco subdominio casuale
Query sottodomini casuali per evitare colpi di cache:
Query: abc123random.example.com
Query: xyz789random.example.com
Query: def456random.example.com
Each is unique → cache miss → authoritative query
Overwhelms authoritative nameservers
Vettori e tecniche di attacco
Botnet-Driven Attacks
Compromised devices:
- IoT devices (cameras, routers)
- Infected computers
- Hacked servers
Distributed attack:
10,000 bots × 100 queries/sec = 1 million queries/sec
#### Attacchi di riflessione
Attacker spoofs victim's IP
Sends queries to many open resolvers
Resolvers respond to victim with large answers
Victim receives amplified traffic
Application-Layer Floods
Legitimate-looking queries
Difficult to distinguish from real traffic
May target specific resource-intensive query types
Rilevamento degli attacchi di inondazione DNS
Unusual Query Volume
Normal baseline: 10,000 queries/second
During attack: 500,000+ queries/second
#Monitor #
# Check query rate (BIND)
rndc status | grep "queries resulted"
# Analyze query logs
tail -f /var/log/named/queries.log | wc -l
Tasso alto di NXDOMAIN
Normal: 5-10% NXDOMAIN responses
Attack: 50-90% NXDOMAIN responses (random subdomain flood)
Source Distribuzione IP
Legitimate: Diverse source IPs, geographic spread
Attack: Concentrated sources, unusual geographic patterns
Query Patterns
Legitimate: Repetitive queries (common domains cached)
Attack: Unique queries (random strings, no cache benefit)
Traduzione:
Normal: < 50ms response time
Under attack: > 1000ms or timeouts
Mitigando attacchi di inondazione DNS
Infrastrutture-difendizioni di viaggio
#### Anycast DNS
Distribuire il traffico attraverso più sedi geografiche:
Single IP address (e.g., 1.2.3.4) announced from multiple locations
Attack traffic automatically routed to nearest server
Load distributed across global network
Harder to overwhelm all locations simultaneously
# Benefits #
- Distribuzione automatica del carico
- resilienza geografica
- Assorbimento del traffico di attacco
#### Infrastruttura DNS oversize
Capacity: 10x normal peak traffic
Reserves: Handle sudden spikes
Auto-scaling: Add capacity during attacks
#### Rate Limiting
# BIND rate limiting (response-rate limiting)
rate-limit {
responses-per-second 10;
window 5;
slip 2;
};
Limita le risposte dalla stessa fonte per prevenire attacchi di amplificazione.
#### Filtro di query
# Block ANY queries (common in amplification)
# Block excessively long queries
# Block known-malicious patterns
BIND Esempio:
# Block ANY queries
match-query {
type ANY;
action drop;
};
DNS Provider-Level Defenses
#### DNSSEC
Mentre non prevengono direttamente le inondazioni, DNSSEC:
- Previene l'avvelenamento della cache durante gli attacchi
- Mantiene l'integrità in condizioni di attacco
#### Configurazione master nascosta
Master server (hidden): 10.0.0.1 (not publicly known)
Slave servers (public): ns1.example.com, ns2.example.com
Attackers target slaves
Master remains operational
Can quickly update slaves if needed
#### DNS Firewall / IDS
Analyze queries in real-time
Block suspicious patterns
Whitelist known-good clients
Blacklist attack sources
Protezione per applicazioni
##### Response Rate Limiting (RRL)
Limit identical responses to same client
Prevents amplification attacks
Slip mode: Occasionally allow queries through (to not break legitimate recursive resolvers)
Configurazione BIND
options {
rate-limit {
responses-per-second 5;
referrals-per-second 5;
nodata-per-second 5;
nxdomains-per-second 5;
errors-per-second 5;
window 5;
};
};
#### Cache Optimization
Increase cache size to absorb repeated queries
Longer TTLs where appropriate (trade-off with agility)
Prefetch popular records
#### Filtro di query
# Drop queries for non-existent zones
# Block queries from known-bad sources
# Rate-limit per-source queries
Difesa di rete
#### BGP Blackholing #
Route attack traffic to null0
Sacrifice availability to preserve infrastructure
Last resort when attack overwhelms capacity
####Filtro ISP a monte
Coordinate with ISP to filter attack traffic
Source IP validation (prevent spoofing)
Traffic scrubbing centers
#### DDoS Mitigation Services
Cloudflare, Akamai, AWS Shield
Absorb attack traffic before reaching your servers
Global capacity to withstand large attacks
Migliori Pratiche per la Resilienza DNS
Use Multiple DNS Provider
Primary provider: Cloudflare
Secondary provider: AWS Route 53
If one is attacked/down, other continues serving
Different infrastructure reduces single point of failure
Implement DNSSEC
Protects against DNS spoofing/cache poisoning
Maintains integrity during attacks
Build trust even under attack conditions
Monitorare le prestazioni DNS
Real-time query rates
Response times
NXDOMAIN percentages
Geographic distribution of queries
Error rates
Tools: Grafana + Prometheus, Datadog, AWS CloudWatch
Test di capacità regolari
Load testing: Can infrastructure handle 10x traffic?
Failover testing: Do secondary providers activate correctly?
Attack simulation: Test mitigation strategies
Disattiva la ricorrenza sui server autorizzativi
# BIND
recursion no;
I nameserver autorevoli non dovrebbero agire come risolutori ricorrenti.
## Restrict Zone Transfers
# BIND
allow-transfer { 10.0.0.2; 10.0.0.3; }; # Only specific slaves
Impedisci agli aggressori di scaricare l'intera zona.
Keep Software Updated
Regularly update DNS server software
Patch known vulnerabilities
Subscribe to security advisories
Rispondere all'attacco di inondazione DNS attivo
Azioni immediate
1. # Verifica l'attacco #
# Check query rate
rndc status
# Check load
top
2. Abilitare il limite di velocità
# BIND: Enable RRL if not already active
rndc addzone rate-limit
3. Contatto DDoS fornitore di mitigazione
- Attivare i servizi di lavaggio
- Reindirizzare il traffico attraverso la rete di mitigazione
4. # Analizzare i modelli di attacco #
# Top query types
grep "query" /var/log/named/queries.log | awk '{print $6}' | sort | uniq -c | sort -rn | head -20
# Top queried domains
grep "query" /var/log/named/queries.log | awk '{print $7}' | sort | uniq -c | sort -rn | head -20
5. *Bloccare fonti di attacco evidenti *
# Identify top source IPs
grep "query" /var/log/named/queries.log | awk '{print $5}' | cut -d# -f1 | sort | uniq -c | sort -rn | head -50
# Block at firewall
iptables -A INPUT -s ATTACKER_IP -j DROP
Azioni a medio termine
1. Infrastruttura dello scalo
- Aggiungere più capacità nameserver
- Distribuire tramite qualsiasicast se non già
2. Implementare filtro aggiuntivo
- Bloccare i modelli di query specifici per attaccare
- Whitelist fonti buone
3. Coordinare con i fornitori
- ISP/hosting provider
- provider DNS
- Servizio di mitigazione DDoS
4. ♪Document Attack ♪
- Acquisizioni dei pacchetti
- Logs
- Grafici del traffico
- Per analisi post-incidentali e scopi legali
Analisi post-allegato
1. Revisione dell'efficacia delle mitigazioni
2. Identificare le carenze delle infrastrutture
3. * Aggiornare le procedure di risposta agli incidenti *
4. Consider miglioramenti a lungo termine (multi-provider DNS, maggiore capacità)
Legale e Reporting
Report to Authority
- FBI IC3 (U.S.): ic3.gov
- Unità cybercrimine locali
- Servizi di abuso ISP
Collezione delle prove
# Packet captures
tcpdump -i eth0 -w dns-attack.pcap port 53
# Full query logs
tar -czf attack-logs-$(date +%Y%m%d).tar.gz /var/log/named/
# Traffic graphs/screenshots
# System resource usage
Gli attacchi di inondazione DNS sono una grave minaccia per i servizi online, ma con adeguate strategie di infrastruttura, monitoraggio e mitigazione, il loro impatto può essere ridotto al minimo.