Web Content Filtering and DNS Sinkholes
Block malicious domains and categories of content through URL filtering proxies and DNS-based sinkholes that stop malware callbacks at the network layer.
Web Content Filtering and DNS Sinkholes is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Web Content Filtering?
Web browsing is one of the most common infection vectors — malicious downloads, drive-by exploits, and phishing pages all rely on users visiting harmful URLs. Web content filtering controls which websites users and devices can access, blocking categories of malicious or policy-violating content before the connection is made. Filtering can be applied at the network proxy layer, DNS layer, or on the endpoint itself. When properly configured, filtering stops malware downloads, command-and-control (C2) callbacks, and data exfiltration even when other defenses fail.
URL Filtering Proxies
A web proxy sits between clients and the internet. When a user browses to a URL, the request goes to the proxy, which checks the URL against a categorized URL database (maintained by vendors like Webroot, Zscaler, Palo Alto). If the category is blocked (malware, gambling, adult content), the proxy returns a block page. If allowed, the proxy fetches the content and returns it to the user. Explicit proxies require browser configuration; transparent proxies intercept traffic without client configuration. Cloud-based Secure Web Gateways (SWGs) extend filtering to remote users without hairpinning traffic through the corporate network.
# squid proxy basic configuration snippet
http_port 3128
# Block malware and phishing categories
acl blocklist dstdomain '/etc/squid/blocklist.txt'
http_access deny blocklist
# Allow trusted corporate subnet
acl trusted src 10.10.0.0/24
http_access allow trusted
http_access deny all
# Block file types (executable downloads)
acl badfiles url_regex -i \.exe$ \.bat$ \.ps1$
http_access deny badfilesDNS-Based Filtering
DNS-based filtering blocks malicious domains at the DNS resolution layer, before any TCP connection is made. When a device queries for a known malicious domain, the DNS resolver returns a sinkhole IP (or NXDOMAIN) instead of the real address, preventing the connection entirely. Services like Cisco Umbrella, Cloudflare Gateway, and Quad9 operate as cloud DNS resolvers that apply threat intelligence in real time to billions of queries. DNS filtering is particularly effective for blocking C2 callback domains and malware distribution domains.
# Redirect corporate DNS to filtering resolver
# Replace ISP DNS with filtering service
# Option 1: Enterprise - Cisco Umbrella
# Point internal DNS forwarder to 208.67.222.222
# Option 2: On-prem sinkhole (BIND config)
# zone 'malware-c2-domain.evil' IN {
# type master;
# file '/etc/bind/sinkhole.zone';
# };
# sinkhole.zone: A 0.0.0.0 (or sinkhole server IP)
# Option 3: pi-hole style local block
local-zone: 'malware-domain.com.' refuseWhat Is a DNS Sinkhole?
A DNS sinkhole is a server that returns a fake, controlled IP address for blocked domains. When malware on an endpoint attempts to resolve its C2 domain, the sinkhole returns the sinkhole server's IP. The malware's connection attempt hits the sinkhole server, which logs the connection. This reveals: which internal hosts are infected (they are making C2 queries), how frequently they attempt callbacks, and which malware family is active (based on the C2 domain). Sinkholes turn blocked malicious traffic into threat intelligence — they do not just block, they identify infected hosts for remediation.
# DNS sinkhole detection workflow
# 1. Malware on host A queries botnet-c2.evil
# 2. DNS sinkhole returns 10.0.0.99 (sinkhole IP)
# 3. Malware connects to 10.0.0.99:8080
# 4. Sinkhole server logs: connection from 192.168.1.45
# 5. Security team alerts:
# 'Host 192.168.1.45 attempted C2 to botnet-c2.evil'
# -> Isolate host, begin forensic investigationCategory-Based URL Filtering
URL filtering databases categorize billions of URLs into categories: Malware, Phishing, Botnet C2, Anonymizers/VPN, Adult Content, Gambling, Social Media, Cloud Storage, Streaming Media, News, and hundreds more. Administrators configure block policies (always deny), allow policies (always permit), and warn policies (user sees a warning and must click through). URL categorization is maintained in real time by vendors; new malicious domains are typically added within minutes of detection. The categorization database quality directly determines filtering effectiveness.
# Web filtering policy example
Category Action Reason
-------------------- -------- ----------------------
Malware sites BLOCK Security
Phishing BLOCK Security
C2 / Botnet BLOCK Security
Anonymizers / VPN BLOCK Policy bypass risk
Gambling BLOCK AUP violation
Adult Content BLOCK AUP violation
Social Media WARN Productivity
Cloud Storage ALLOW Business need
News / Media ALLOW Informational
Microsoft 365 ALLOW Critical SaaSSSL/TLS Inspection at the Proxy
Since most web traffic is HTTPS, content filtering proxies must perform SSL/TLS inspection (also called SSL bumping or man-in-the-middle inspection) to see inside encrypted sessions. The proxy terminates the TLS session from the client, inspects the content, and re-encrypts it to the server. A corporate CA certificate is pushed to all managed endpoints via MDM, allowing clients to trust the proxy's re-signed certificates without browser warnings. Exempt categories that should not be inspected: banking, healthcare portals, legal research sites — due to privacy concerns and regulatory constraints.
DNS over HTTPS (DoH) Bypass Issue
A major challenge for DNS-based filtering is DNS over HTTPS (DoH). Browsers like Chrome and Firefox support DoH, sending DNS queries encrypted to resolvers like 1.1.1.1 or 8.8.8.8 rather than the local recursive resolver. This bypasses DNS sinkhole and filtering controls because queries never reach the corporate DNS server. Enterprise mitigations: disable DoH via Group Policy, block DoH resolver IPs at the firewall, or redirect all port 443/853 traffic to the corporate DoH-aware resolver using a transparent proxy.
# Block DoH bypass at the firewall
# Block common DoH providers
iptables -I FORWARD -d 1.1.1.1 -p tcp --dport 443 -j DROP
iptables -I FORWARD -d 8.8.8.8 -p tcp --dport 443 -j DROP
iptables -I FORWARD -d 9.9.9.9 -p tcp --dport 443 -j DROP
# Windows Group Policy: disable browser DoH
# Computer Config > Admin Templates > Google Chrome
# 'DNS over HTTPS mode': set to 'Off'
# Or force all DNS through corporate resolver
# Redirect UDP/TCP 53 and DoH (443) to corporate DNSThreat Intelligence Feeds for Filtering
Content filtering systems are only as good as their threat intelligence. Modern filtering platforms consume multiple intelligence feeds: commercial feeds (FireEye, Recorded Future, ThreatConnect) with curated malicious IOCs; open-source feeds (AlienVault OTX, abuse.ch, Emerging Threats); and custom organizational feeds from past incidents. IOCs from intelligence feeds — malicious domains, IPs, URLs, file hashes — are automatically pushed into filtering policies within minutes of detection, providing near-real-time protection against newly discovered threats without waiting for vendor database updates.
Safe Search and Social Media Controls
Web filtering extends beyond blocking entire sites. Safe search enforcement for search engines (Google, Bing) appends safe search parameters to all queries, filtering explicit results without blocking the search engine entirely. YouTube restricted mode can be enforced via DNS CNAME remapping. Social media can be allowed for business use while blocking specific social media applications (upload/download) through application-layer filtering at the proxy. These granular controls allow organizations to balance business use against policy enforcement without binary block/allow decisions.
Reporting and Alerting
Web filtering generates rich telemetry that feeds security operations. Reports to monitor: malware category hits per user and device (indicates potential compromise), C2 callback attempts (requires immediate investigation), policy bypass attempts (anonymizer/VPN usage patterns), and data exfiltration risk (large uploads to personal cloud storage). Alerts on high-confidence malicious category hits should integrate with SIEM and ticketing systems to trigger automated investigation workflows. Regular reporting to management demonstrates the volume of threats blocked at the web layer.
Endpoint vs Network-Based Filtering
Web filtering can be applied at the network layer (proxy, DNS resolver) or at the endpoint layer (agent installed on the device). Network-based filtering protects all devices without per-device installation but fails when users are off VPN. Endpoint agents extend filtering to remote users by running the filter locally on the device and sending telemetry to the cloud for policy updates. Hybrid models combine both: network filtering for on-premises traffic and endpoint agents for remote workers. DNS-based cloud filtering (Cisco Umbrella) achieves near-universal coverage by making the corporate resolver follow the device wherever it goes.
Quick Check
Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.
Lesson Recap
In this lesson you learned: URL filtering proxies check web requests against categorized databases and block malicious or policy-violating sites, DNS sinkholes return fake IPs for known-malicious domains and identify infected hosts through logged callback attempts, and DoH bypass is a significant threat to DNS-based filtering that requires Group Policy, firewall rules, or transparent proxy to mitigate. Next up we explore SSL/TLS inspection and man-in-the-browser attacks.
Frequently asked questions
Is the “Web Content Filtering and DNS Sinkholes” lesson free?
Yes — the full text of “Web Content Filtering and DNS Sinkholes” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.
What will I learn in “Web Content Filtering and DNS Sinkholes”?
Block malicious domains and categories of content through URL filtering proxies and DNS-based sinkholes that stop malware callbacks at the network layer. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cloud & IT Cert Prep?
No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Web Content Filtering and DNS Sinkholes” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cloud & IT Cert Prep lesson?
Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Email Authentication: SPF, DKIM, and DMARC
- Secure Email Gateways and Anti-Spam Controls
- Web Content Filtering and DNS Sinkholes
- SSL/TLS Inspection and Man-in-the-Browser Attacks