3.6 DNS Filtering & Botnet C&C Protection

Key Takeaways

  • DNS Filtering inspects domain resolution queries (UDP/TCP port 53, DoH, DoT) at the network layer before an IP connection is established.
  • FortiGuard DNS Category Filtering blocks access to malicious domains at the resolution stage, saving bandwidth and preventing TCP session creation.
  • Dynamic Botnet C&C protection utilizes live FortiGuard threat feeds to block outbound connections to known malware command-and-control servers.
  • DNS Sinkhole IP redirects malicious domain resolution requests to a controlled IP address, blocking external malware access and generating logs that identify infected internal host IPs.
  • External Resource Threat Feeds allow FortiGate to dynamically import third-party domain and IP blocklists over HTTP/HTTPS.
Last updated: July 2026

3.6 DNS Filtering & Botnet C&C Protection

DNS Filtering provides early-stage security enforcement by inspecting and filtering Domain Name System (DNS) lookups before an IP connection is established. Combined with Botnet Command & Control (C&C) protection and DNS Sinkhole capabilities, FortiOS 7.6 prevents infected internal endpoints from communicating with malicious infrastructure.


DNS Filtering Architecture

DNS Filtering operates on DNS traffic passing through the FortiGate (UDP/TCP port 53, as well as DNS-over-HTTPS [DoH] and DNS-over-TLS [DoT] when decrypted).

Early-Stage Protection Advantage

When a client attempts to visit a website or initiate malware communication, it first issues a DNS query to resolve the destination domain name (e.g., malicious-domain.com) to an IP address.

  • Traditional Web Filtering: Inspects the HTTP/HTTPS request after TCP connection establishment and SSL handshakes complete.
  • DNS Filtering: Inspects the initial DNS query. If the domain is rated as malicious, FortiGate blocks or redirects the DNS response. The client never receives the real malicious IP address, preventing the establishment of the underlying TCP/IP connection entirely.

Domain Filtering & External Threat Feeds

DNS Filter profiles (config dnsfilter profile) enforce domain security using three lookup mechanisms:

  1. FortiGuard DNS Category Filtering: Categorizes domains into standard risk groups (Security Risks, Phishing, Malicious, Adult, etc.).
  2. Local Domain Filters: User-defined domain block/allow lists utilizing Simple, Wildcard, or Regex domain matching.
  3. External Resource Threat Feeds: Dynamically imports external domain blocklists (plain text lists or STIX/TAXII threat feeds) hosted on external HTTP/HTTPS servers. FortiGate automatically refreshes these feeds at configured intervals.

Botnet Command & Control (C&C) Protection

Malware botnets rely on Command & Control (C&C) servers to receive operational instructions, exfiltrate stolen data, or download secondary payloads. Fortinet guards against botnet activity using two dynamic databases:

  • Botnet Domain Database: Contains domain names associated with active botnet C&C servers.
  • Botnet IP Database: Contains known IP addresses of active botnet infrastructure.

When a host inside the network attempts to resolve or connect to a botnet C&C destination, FortiGate intercepts and blocks the traffic.


DNS Sinkhole IP Mechanism

The DNS Sinkhole feature is one of the most powerful diagnostic and mitigation tools in FortiOS security administration.

Operational Steps of DNS Sinkhole

  1. Infected host sends DNS Query: c2-server.evil.com
  2. FortiGate DNS Filter matches domain to Botnet / Malicious Category.
  3. FortiGate intercepts DNS response and replaces real malicious IP with configured Sinkhole IP (e.g., 192.0.2.1).
  4. Infected host receives Sinkhole IP and attempts connection to 192.0.2.1.
  5. FortiGate blocks connection attempt and generates security log event.

Operational Advantages of DNS Sinkhole

  1. Prevents Malicious Communication: The infected endpoint receives the fake sinkhole IP address (e.g., 192.0.2.1 or loopback 127.0.0.1) instead of the real C&C server IP, rendering malware communication inert.
  2. Pinpoints Infected Hosts: When the infected host attempts to establish a connection to the sinkhole IP, FortiGate logs the connection attempt. Security Operations Center (SOC) teams can filter logs for destination 192.0.2.1 to immediately identify the exact internal IP address of the compromised host.

Overview Comparison

Security LayerOperating StageMain AdvantagePrimary Log Output
DNS FilteringPre-Connection (DNS Resolution)Zero TCP state overhead; stops connection earlyDomain query log
Web FilteringConnection Established (HTTP/S)Full URL path and body content inspectionHTTP URL access log
Botnet C&C DefenseNetwork Layer (IP / Domain)Dynamic real-time threat feed protectionBotnet block log
DNS SinkholePost-DNS Resolution AttemptIdentifies exact internal infected IP addressSinkhole access log

CLI Configuration Examples

Configuring a DNS Filter Profile with Category Blocking and Sinkhole

config dnsfilter profile
    edit "Corporate_DNS_Filter"
        set comment "Block malicious categories and enable botnet sinkhole"
        config ftgd-dns
            config filters
                edit 1
                    set category 26
                    set action block
                next
                edit 2
                    set category 61
                    set action block
                next
            end
        end
        set block-action redirect
        set redirect-portal 192.0.2.1
        set log-all-domain enable
    next
end

Configuring External Resource Threat Feed for Custom Domain Blocklist

config system external-resource
    edit "Threat_Feed_Domains"
        set type domain
        set resource "https://security-server.example.com/threats/domains.txt"
        set refresh-rate 60
    next
end

Enabling Botnet C&C Database Connections on FortiGate Interface

config system fortiguard
    set botnet-ip-update enable
end

config ips global
    set database extended
end
Loading diagram...
DNS Sinkhole Operation & Infected Endpoint Identification
Test Your Knowledge

Why is configuring a DNS Sinkhole IP considered a critical best practice for botnet defense in an enterprise network?

A
B
C
D
Test Your Knowledge

At what layer of network communication does DNS Filtering operate to block access to malicious web resources?

A
B
C
D
Test Your Knowledge

What type of dynamic resource can be integrated into a FortiGate DNS Filter profile to block newly discovered malicious domains from third-party threat intelligence platforms?

A
B
C
D