· 8 min read

Open DNS Resolver, NTP & Memcached: Stop Reflection Abuse

An open DNS resolver, a permissive NTP server or an internet-facing memcached instance can be used by attackers as a DDoS reflector. The fix is to test from outside your network, restrict who can query each service, and watch outbound flow data for large UDP responses leaving your prefixes with source ports 53, 123 or 11211.

For hosting and ISP networks this is not just good hygiene. Reflection abuse eats your uplink capacity, gets your prefixes listed on abuse lists, and can trigger upstream rate limits or null-routes on your own address space. Customers run these services on your IPs, so you need both configuration guidance and detection.

Why these services get abused

Reflection works because the attacker spoofs the victim's source IP in a small UDP request. The server sends a much larger response to the victim. Your server never needs to be compromised. It only needs to answer strangers.

Service UDP port Typical cause of exposure
DNS 53 Recursive resolver reachable from the whole internet
NTP 123 Default restrict rules, legacy monlist on old ntpd
memcached 11211 Bound to 0.0.0.0 with UDP enabled

Memcached is the extreme case. A tiny request for a large stored value can produce a very large response, which is why it became notorious. For packet-level signatures of these attacks, see our post on UDP amplification signatures and edge filtering.

Step 1: Test your own exposure

Test from a host outside your network, such as a VPS at another provider. Testing from inside your LAN tells you nothing about internet exposure.

DNS

# Does the server answer recursive queries for a domain it is not authoritative for?
dig @192.0.2.53 www.example.com A +recurse

# Look for "ra" in flags and a NOERROR status with an answer = open resolver

If you get an answer with the ra flag set from an outside host, the resolver is open. A REFUSED status is what you want. Also test with +bufsize=4096 +dnssec and ANY-style queries against authoritative servers, because authoritative servers can be abused too, even when they are not open recursors.

NTP

# Legacy monlist query (should fail or time out)
ntpdc -n -c monlist 192.0.2.123

# Variable and peer queries should not work from the internet either
ntpq -c rv 192.0.2.123
ntpq -c peers 192.0.2.123

# nmap script
nmap -sU -p 123 --script ntp-monlist 192.0.2.123

memcached

printf '\x00\x00\x00\x00\x00\x01\x00\x00stats\r\n' | nc -u -w1 192.0.2.11 11211
nmap -sU -sT -p 11211 192.0.2.11

Any reply to the UDP probe means UDP is enabled and reachable. A TCP response from outside means the cache itself is exposed, which is a data-leak problem as well as an abuse problem.

Sweep your whole address space

Do not test one server at a time. Scan your own ranges, for example nmap -sU -p 53,123,11211 --open 192.0.2.0/24 198.51.100.0/24, from an external host, and schedule it regularly. UDP scans are slow, so tune timing and run them off-peak.

Step 2: Harden DNS

Recursive resolvers: restrict clients first

Response rate limiting (RRL) is mainly designed for authoritative servers. For a recursive resolver, the primary control is an ACL that limits who can use it.

BIND (recursive for your own customers):

acl "trusted" { 192.0.2.0/24; 198.51.100.0/24; 2001:db8::/32; localhost; };

options {
    recursion yes;
    allow-recursion    { trusted; };
    allow-query-cache  { trusted; };
    allow-query        { trusted; };
};

Unbound:

server:
    interface: 192.0.2.53
    access-control: 0.0.0.0/0 refuse
    access-control: ::/0 refuse
    access-control: 192.0.2.0/24 allow
    access-control: 2001:db8::/32 allow
    # Per-client query rate limit (queries/sec)
    ip-ratelimit: 200

Note that Unbound's ratelimit option limits queries sent upstream per zone. It is not client-facing RRL. For client-side limiting use ip-ratelimit, and rely on access-control as the main protection.

Authoritative servers: enable RRL

An authoritative server must answer the world, so you cannot use ACLs. Use RRL instead.

BIND:

options {
    recursion no;
    rate-limit {
        responses-per-second 10;
        referrals-per-second 5;
        nodata-per-second 5;
        errors-per-second 5;
        window 5;
        slip 2;
        ipv4-prefix-length 24;
        ipv6-prefix-length 56;
        exempt-clients { 127.0.0.1; };
    };
};

slip 2 means roughly every other rate-limited response is sent as a small truncated (TC) reply. A real client can retry over TCP, while a spoofed victim receives very little. NSD has a comparable feature via rrl-ratelimit and related options.

Step 3: Harden NTP

ntpd

# /etc/ntp.conf
restrict default kod nomodify notrap nopeer noquery limited
restrict -6 default kod nomodify notrap nopeer noquery limited
restrict 127.0.0.1
restrict ::1

noquery blocks ntpq/ntpdc queries from the internet, and limited plus kod rate-limit abusive clients. Upgrade old ntpd versions: monlist was removed in ntp 4.2.7p26, and old releases remain a frequent source of exposure.

chrony

Chrony does not serve NTP to clients unless you add an allow directive. Keep it narrow:

# /etc/chrony/chrony.conf
allow 192.0.2.0/24
allow 2001:db8::/32
# Management channel only on loopback
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
cmdallow 127.0.0.1
# Rate limiting for NTP responses
ratelimit interval 3 burst 8 leak 2

If a host only needs to sync its own clock, delete every allow line and the service stays silent to the outside.

Step 4: Harden memcached

Fix it at the service first, then add a firewall rule as a second layer.

# /etc/memcached.conf
-l 127.0.0.1
-U 0

-l binds to loopback, and -U 0 disables UDP. UDP has been disabled by default since memcached 1.5.6, but older installs and custom configs remain. If a remote application needs memcached, bind to a private address, require SASL where possible, and filter at the host:

# nftables
table inet filter {
  chain input {
    type filter hook input priority 0; policy accept;
    udp dport 11211 drop
    tcp dport 11211 ip saddr != 10.0.0.0/8 drop
  }
}

Step 5: Reduce spoofing at your edge

Reflection requires a spoofed source address from somewhere. Your network can be the origin of spoofed requests, not just the reflector. Apply uRPF or ingress ACLs on customer-facing ports (BCP 38).

# Juniper
set interfaces ge-0/0/1 unit 0 family inet rpf-check

# Cisco IOS-XE
interface GigabitEthernet0/0/1
 ip verify unicast source reachable-via rx

# MikroTik RouterOS (strict RPF on a customer-facing interface)
/ip settings set rp-filter=strict

Use strict mode only where routing is symmetric; use loose or ACL-based filtering on multihomed customer ports. A common mistake is enabling strict uRPF on a multihomed customer link and breaking legitimate traffic.

Step 6: Spot outbound reflection abuse from flow data

Configuration audits catch what you know about. Flow data catches the rest. With NetFlow v5/v9, IPFIX or sFlow exported from your border, look at traffic leaving your network where the source port is a reflector service.

Indicators:

With nfdump, a quick check looks like this:

nfdump -R /var/flows/2025/ -o long \
  -s srcip/bytes/packets -n 20 \
  'proto udp and (src port 53 or src port 123 or src port 11211) and src net 192.0.2.0/24'

Then drill into the top IP and count unique destinations:

nfdump -R /var/flows/2025/ -A dstip -s dstip/flows \
  'src ip 192.0.2.53 and src port 53'

Keep sampling in mind. With 1:1000 sampling, small responders will not appear, but high-volume reflectors will show up clearly. Our posts on NetFlow thresholds, baselines and sampling cover how to tune this.

Automate it

Manual nfdump queries do not scale across thousands of IPs. A collector should alert per IP on outbound pps/bps from UDP source ports 53, 123 and 11211. NixMon analyzes NetFlow, IPFIX and sFlow, applies per-IP and per-prefix bps/pps thresholds, and sends attack alerts to a hosted panel and its mobile apps. You can run it on your own border flow export with the 15-day free trial, no credit card required.

What to do when you find an abusive IP

  1. Confirm in flow data: source port, destination fan-out, byte ratio.
  2. Contact the customer, or restrict the service with an ACL on the host or upstream router.
  3. If the outbound flood is saturating your link, use a short-term BGP action such as a FlowSpec rule dropping udp src-port 11211 from that host, rather than blackholing the whole IP.
  4. Re-test externally after the fix and keep monitoring for a few days. Misconfigured services often come back after a reinstall or a configuration management run.

Common mistakes

If you want to go further and protect against inbound floods too, an architecture with detection, RTBH, FlowSpec and BGP-tunnel scrubbing can complement the cleanup work above.

Frequently asked questions

How do I check if my DNS server is an open resolver?

From a host outside your network, run dig @your-server-ip www.example.com A. If you get a NOERROR answer with the ra flag set for a domain the server is not authoritative for, it is an open resolver. A REFUSED status means recursion is restricted.

Does response rate limiting protect a recursive resolver?

Not primarily. RRL is mainly designed for authoritative servers that must answer everyone. For recursive resolvers, restrict clients with ACLs (allow-recursion in BIND, access-control in Unbound) and add per-client query limits as a secondary control.

Is it enough to disable UDP in memcached?

Disabling UDP with -U 0 removes the amplification vector, but you should also bind memcached to localhost or a private address with -l and firewall port 11211. An exposed TCP memcached can leak data even when UDP is off.

How can I detect reflection abuse from my own servers using flow data?

Look at outbound UDP flows with source ports 53, 123 or 11211 from your IPs. Large average packet size, a high outbound-to-inbound byte ratio and many unique destination IPs indicate that a server is being used as a reflector.

Start a 15-day free trial and catch outbound reflection abuse early.Learn more