Páginas

sexta-feira, 10 de abril de 2026

Stop DNS Attacks Before They Stop You: The dnsdist DoS Survival Guide

 


DNS DoS attack? Stop it now. Check, patch, or mitigate dnsdist CVEs with actual commands for Ubuntu, Rocky, SUSE. Includes automation script + free lab.

You don’t run a DNS resolver because it’s fun. You run it because your apps, users, and infrastructure depend on it. When a use-after-free or a crafted QUIC packet can take your entire load balancer offline, you have a problem.

In April 2026, the dnsdist team patched seven CVEs (CVE-2026-0396 through CVE-6-27854). But here is the truth: this won’t be the last time. This guide is your reusable playbook to check, fix, and survive DNS DoS vulnerabilities on any major Linux distro—today and next year.

How to check if you are vulnerable (actual commands)

Run these commands on your dnsdist server. You are looking for versions below 1.9.12.

Ubuntu / Debian

bash
# Check installed version
dpkg -l | grep dnsdist
# If version < 1.9.12, you are vulnerable
# Check for running service
systemctl status dnsdist


bash
# Check installed version
rpm -qa | grep dnsdist
# Query specific package info
rpm -qi dnsdist | grep Version



bash
# Check version
zypper info dnsdist
# Or use rpm
rpm -qa | grep dnsdist


The quick red flag: If your dnsdist --version shows 1.9.11 or older, stop reading and start fixing.

Automation script to apply the fix (bash for major distros)

Save this as fix-dnsdist.sh, make it executable (chmod +x fix-dnsdist.sh), and run it as root.

bash
#!/bin/bash
# dnsdist DoS vulnerability fix script (CVE-2026 family)
# Works on Ubuntu 22.04+, Rocky 9+, SUSE 15+

set -e

# Detect OS
if [ -f /etc/os-release ]; then
    . /etc/os-release
    OS=$ID
    VER=$VERSION_ID
else
    echo "Cannot detect OS. Exiting."
    exit 1
fi

echo "Detected: $OS $VER"

case $OS in
    ubuntu|debian)
        apt-get update
        apt-get install --only-upgrade dnsdist -y
        ;;
    rocky|almalinux|rhel|centos)
        dnf update dnsdist -y
        ;;
    suse|opensuse-leap|opensuse-tumbleweed)
        zypper refresh
        zypper update -y dnsdist
        ;;
    *)
        echo "Unsupported OS. Update dnsdist manually from https://dnsdist.org"
        exit 1
        ;;
esac

# Restart service
systemctl restart dnsdist
systemctl status dnsdist --no-pager

echo "Fix applied. Verify with: dnsdist --version"


Alternative mitigation if you can’t update now

You can’t always restart a DNS load balancer. Sometimes change management says “no.” Here are three live mitigations:

1. iptables rate-limit for new connections

Drop excessive queries before they hit dnsdist:

bash
# Limit to 100 new connections per second per source IP
iptables -A INPUT -p udp --dport 53 -m state --state NEW -m recent --set
iptables -A INPUT -p udp --dport 53 -m state --state NEW -m recent --update --seconds 1 --hitcount 100 -j DROP


2. Block DNS over QUIC/HTTP3 (CVE-2026-24030)

If you don’t need DoQ or DoH3, disable them in dnsdist.conf:

text
setLocal("0.0.0.0:53")  -- standard DNS
-- setLocal("0.0.0.0:443", "udp")   -- QUIC – COMMENT OUT
setLocal("0.0.0.0:443", "tcp")      -- Keep DoH over TCP only if needed

3. Use a reverse proxy with AppArmor

Isolate dnsdist to limit damage from a use-after-free (CVE-2026-27854):

bash
# Create a minimal profile
aa-genprof dnsdist
# Then enforce it
aa-enforce /usr/sbin/dnsdist


Suggested reading :



This isn’t just a patch-and-forget book. It teaches you how to architect DNS layers, write Lua rules for dnsdist, and simulate DoS attacks in a lab. The 2026 CVEs exploited weak Lua sandboxing and ACL logic—exactly what this book covers in chapters 6 and 9. One hour with this book saves you 10 hours of debugging a poisoned cache or a crashed balancer.


Hands-on Lab: Reproduce & test the fix safely

You need a test environment. No production risk. Here is a Docker Compose lab.

Prerequisites: Docker and docker-compose installed.

Step 1: Create docker-compose.yml

yaml
version: '3.8'
services:
  vulnerable-dnsdist:
    image: powerdns/dnsdist-18:1.9.11  # Vulnerable version
    ports:
      - "5300:53/udp"
      - "5300:53/tcp"
    command: --uid gid --local 0.0.0.0:53 --client 0.0.0.0/0
  fixed-dnsdist:
    image: powerdns/dnsdist-18:1.9.12  # Patched version
    ports:
      - "5400:53/udp"
      - "5400:53/tcp"
    command: --uid gid --local 0.0.0.0:53 --client 0.0.0.0/0
  attacker:
    image: alpine:latest
    command: tail -f /dev/null
    depends_on:
      - vulnerable-dnsdist
      - fixed-dnsdist

Step 2: Simulate a DoS attack

Enter the attacker container:

bash
docker exec -it lab_attacker_1 sh
# Install DNS tools
apk add bind-tools drill
# Send flood of random queries
while true; do drill @vulnerable-dnsdist -p 5300 random$RANDOM.local; done


Watch the vulnerable container crash. The fixed container (port 5400) stays up.

Step 3: Test the iptables mitigation

On the host, apply the rate-limit rule and see that the attacker container’s queries get dropped after 100 pps.


Conclusion: Your DNS is under attack. Own it.

You can’t patch every CVE the day it drops. But you can build a repeatable process: check, automate, mitigate, test.

Next step: Download my DNS Hardening Checklist (PDF) – includes 12 iptables rules, 5 Lua ACL snippets, and a monthly audit script.

👉 Click here to get the checklist for free (replace with your actual link)

Want to go deeper ? Join the Linux Security Weekly newsletter. Every Tuesday: one real attack, one fix, one lab. No hype.

Subscribe now – it’s free



























Nenhum comentário:

Postar um comentário