
DNS Security: ป้องกัน DNS Spoofing, Cache Poisoning และ DDoS
DNS (Domain Name System) เป็นระบบที่แปลง domain name (เช่น google.com) เป็น IP address เป็นโครงสร้างพื้นฐานที่สำคัญที่สุดของ internet แต่ DNS ถูกออกแบบมาโดยไม่มี security ในตัว ทำให้เป็นเป้าหมายของการโจมตีหลายรูปแบบ
DNS attacks อันตรายเพราะผู้ใช้ไม่รู้ตัว ถ้า attacker เปลี่ยน DNS response ได้ ผู้ใช้จะถูก redirect ไปเว็บปลอมโดยไม่รู้ตัว (phishing) หรือ DNS DDoS ทำให้ทุกคนเข้าเว็บไม่ได้ บทความนี้จะอธิบายภัยคุกคาม DNS และวิธีป้องกัน
DNS Attack Types
| Attack | วิธีการ | ผลกระทบ |
|---|---|---|
| DNS Spoofing | ปลอม DNS response ส่งกลับ IP ผิด | ผู้ใช้ถูก redirect ไป phishing site |
| DNS Cache Poisoning | ฝัง record ปลอมใน DNS resolver cache | ผู้ใช้ทุกคนที่ใช้ resolver นั้นถูก redirect |
| DNS Amplification DDoS | ใช้ DNS servers เป็น amplifier โจมตีเป้าหมาย | เป้าหมายถูก flood ด้วย traffic มหาศาล |
| DNS Tunneling | ซ่อน data ใน DNS queries เพื่อ exfiltrate ข้อมูล | ข้อมูลลับถูกขโมยผ่าน DNS (bypass firewall) |
| DNS Hijacking | เปลี่ยน DNS settings ของ router/device | ทุก traffic ถูก redirect ผ่าน attacker |
| NXDOMAIN Attack | Query domain ที่ไม่มีอยู่จำนวนมาก | DNS server overload, legitimate queries ช้า |
DNS Cache Poisoning
วิธีการโจมตี
Kaminsky Attack (2008): Attacker ส่ง DNS query สำหรับ random subdomain (เช่น abc123.example.com) DNS resolver ส่ง query ไป authoritative server Attacker ส่ง forged response กลับมาก่อน (เดา transaction ID) ถ้าสำเร็จ resolver cache ถูก poison: example.com → IP ของ attacker ผู้ใช้ทุกคนที่ใช้ resolver นั้นจะถูก redirect
วิธีป้องกัน
1. Source Port Randomization: ใช้ random source port สำหรับ DNS queries (ไม่ใช่ port 53 ตลอด) เพิ่มความยากในการเดา transaction ID + port 2. DNSSEC: ใช้ digital signatures ยืนยันว่า DNS response มาจาก authoritative server จริง 3. DNS over HTTPS (DoH) / DNS over TLS (DoT): Encrypt DNS queries ป้องกัน MitM
DNSSEC
DNS Security Extensions
DNSSEC เพิ่ม digital signatures ให้ DNS records: Authoritative server sign DNS records ด้วย private key Resolver ตรวจสอบ signature ด้วย public key (DNSKEY record) ถ้า signature ไม่ตรง → response ถูก reject ป้องกัน cache poisoning และ spoofing
| Record Type | ใช้ทำอะไร |
|---|---|
| RRSIG | Digital signature ของ DNS record set |
| DNSKEY | Public key สำหรับ verify RRSIG |
| DS | Delegation Signer (เชื่อม trust chain กับ parent zone) |
| NSEC/NSEC3 | Authenticated denial of existence (domain ไม่มีอยู่จริง) |
DNS over HTTPS (DoH) / DNS over TLS (DoT)
| คุณสมบัติ | DoH | DoT |
|---|---|---|
| Port | 443 (HTTPS) | 853 |
| Protocol | HTTPS | TLS |
| Encryption | TLS 1.3 | TLS 1.3 |
| Visibility | ซ่อนใน HTTPS traffic (ยาก block) | แยก port ชัดเจน (ง่าย block) |
| Browser Support | Chrome, Firefox, Edge | OS-level (Android, iOS) |
| Enterprise Preference | ยาก control (ซ่อนใน HTTPS) | ง่าย control (block port 853) |
DNS DDoS Protection
วิธีป้องกัน
1. Rate Limiting: จำกัด queries per second จาก source IP เดียว ป้องกัน NXDOMAIN flood และ amplification 2. Response Rate Limiting (RRL): จำกัด identical responses per second ป้องกัน amplification attack 3. Anycast DNS: Deploy DNS servers หลาย locations ด้วย anycast IP traffic กระจายไปหลาย servers อัตโนมัติ 4. DNS Firewall (RPZ): Block queries ไป malicious domains Block responses ที่ส่ง private IPs (rebinding attack)
Enterprise DNS Best Practices
| Practice | รายละเอียด |
|---|---|
| ใช้ DNS resolver ภายใน | ไม่ให้ clients query internet DNS โดยตรง |
| Enable DNSSEC validation | Validate DNSSEC signatures บน resolver |
| DNS logging | Log ทุก DNS query สำหรับ security analysis |
| Block DNS over HTTPS | บังคับใช้ internal DNS (ป้องกัน bypass) |
| DNS sinkholing | Redirect malicious domains ไป sinkhole server |
| Split DNS | แยก internal DNS กับ external DNS |
| Redundancy | มี DNS servers อย่างน้อย 2 ตัว (primary + secondary) |
DNS Monitoring Tools
| Tool | ประเภท | จุดเด่น |
|---|---|---|
| Pi-hole | Open-source DNS sinkhole | Block ads + malware domains, easy setup |
| Cisco Umbrella | Cloud DNS security | Enterprise-grade, threat intelligence |
| Cloudflare Gateway | Cloud DNS filtering | Fast, free tier available |
| DNSdist | Open-source DNS load balancer | Rate limiting, load balancing, DoH/DoT |
| Passive DNS | DNS intelligence | Track DNS changes over time |
ทิ้งท้าย: DNS Security เป็น Foundation ของ Cyber Security
DNS Security มักถูกมองข้าม แต่ DNS เป็นจุดอ่อนที่ attacker ใช้บ่อยที่สุด Enable DNSSEC validation บน resolvers ใช้ encrypted DNS (DoT สำหรับ enterprise) Log และ monitor DNS queries block malicious domains ด้วย DNS firewall/sinkhole
อ่านเพิ่มเติมเกี่ยวกับ Firewall Rules Best Practices และ DHCP Snooping ARP Inspection ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com