Host-Based Firewall and Application Allowlisting
Configure host-based firewalls (Windows Defender Firewall, iptables) and application allowlists that block unauthorized software from executing.
Host-Based Firewall and Application Allowlisting is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 4 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.
Host-Based vs Network Firewalls
A network firewall sits at the perimeter and filters traffic between network segments. A host-based firewall runs on the individual endpoint and filters traffic to and from that specific machine. Host-based firewalls provide defense-in-depth: even if an attacker bypasses the network firewall (via a VPN, a compromised insider, or lateral movement from another infected host), the host firewall enforces local traffic rules. They are especially important for laptops that travel outside the corporate perimeter and connect to untrusted networks.
Windows Defender Firewall
Windows Defender Firewall (WDF) is the built-in host firewall in all modern Windows versions. It supports three profiles: Domain (connected to corporate domain — typically more permissive), Private (trusted home network), and Public (untrusted networks — most restrictive). WDF rules can filter by port, protocol, application path, remote IP, and user identity. The Windows Defender Firewall with Advanced Security (WFAS) MMC snap-in and Group Policy enable centralized enterprise management of firewall rules across all domain-joined machines.
# Windows: create inbound firewall rule
netsh advfirewall firewall add rule \
name='Block Telnet' \
dir=in \
action=block \
protocol=TCP \
localport=23
# PowerShell equivalent
New-NetFirewallRule \
-DisplayName 'Block Telnet Inbound' \
-Direction Inbound \
-Protocol TCP \
-LocalPort 23 \
-Action BlockLinux iptables and nftables
Linux host firewalls use the Netfilter kernel framework, configurable through iptables (legacy, still widely used) or the modern nftables. Rules are organized into chains (INPUT, OUTPUT, FORWARD) within tables (filter, nat, mangle). The default policy should be DROP with explicit ACCEPT rules for needed traffic — the deny-by-default posture. Higher-level tools like ufw (Ubuntu) and firewalld (RHEL/CentOS) provide friendlier interfaces while still using Netfilter under the hood.
# iptables: deny-by-default with selective allow
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
# Allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow SSH from specific subnet only
iptables -A INPUT -s 10.10.0.0/24 -p tcp --dport 22 -j ACCEPT
# Allow HTTPS
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# Save rules
iptables-save > /etc/iptables/rules.v4Application-Layer Firewall Rules
Host-based firewalls can enforce rules at the application layer — filtering traffic by the application that generated it, not just the port. Windows Defender Firewall supports application-based rules: allow C:\Program Files\MyApp\app.exe to make outbound connections while blocking everything else on the same port. This prevents malware from hijacking allowed ports by pretending to be a trusted application. Application-layer rules are significantly more effective than port-only rules, which can be bypassed by binding malware to common ports like 443.
# Windows: firewall rule scoped to a specific app
New-NetFirewallRule \
-DisplayName 'Allow Chrome HTTPS' \
-Direction Outbound \
-Program 'C:\Program Files\Google\Chrome\Application\chrome.exe' \
-Protocol TCP \
-RemotePort 443 \
-Action Allow
# Blocks any OTHER process trying to use port 443
# unless that process also has an explicit ALLOW ruleWhat Is Application Allowlisting?
Application allowlisting (previously called whitelisting) is a security control that permits only explicitly approved applications to execute on an endpoint. Any executable not on the allowlist is blocked, regardless of whether it is malware or simply unapproved software. This is a powerful defense against malware because even novel, zero-day malware is blocked if it is not on the approved list. The challenge is operational: managing the allowlist in large, dynamic environments requires a mature change management process and generates significant support tickets if poorly tuned.
Windows AppLocker
AppLocker is Windows' built-in application control feature available on Enterprise and Education editions. It filters execution by: path (block executables from %TEMP% or user-writable directories), file hash (allow only known-good hashes), or publisher (allow software signed by Microsoft or Adobe). AppLocker policies are deployed via Group Policy and logged to the Windows Event Log (Event ID 8003 = blocked). Running AppLocker in Audit Mode first — logging blocks without enforcing — lets teams tune the allowlist before enforcement begins.
# AppLocker rule examples (Group Policy)
# Block executables in user-writable locations
Path Rule: C:\Users\*\AppData\*.exe -> DENY
Path Rule: C:\Windows\Temp\*.exe -> DENY
# Allow by publisher (certificate)
Publisher Rule: O=Microsoft, CN=* -> ALLOW
Publisher Rule: O=Adobe, CN=Adobe Acrobat -> ALLOW
# Hash rule for specific approved version
Hash Rule: SHA256:a1b2c3d4... -> ALLOW
# Check AppLocker events:
Get-WinEvent -LogName 'Microsoft-Windows-AppLocker/EXE and DLL'Windows Defender Application Control (WDAC)
WDAC is the more powerful successor to AppLocker, enforced at the kernel level rather than user space. Unlike AppLocker, WDAC cannot be bypassed by attackers with local administrator rights, making it the preferred control for high-security environments. WDAC policies are written in XML and converted to binary policy files deployed via MDM (Intune) or Group Policy. WDAC also enables Intelligent Security Graph (ISG) integration, which uses Microsoft's cloud reputation service to automatically allow software with a trusted reputation — reducing the operational burden of manually curating the allowlist.
Allowlisting Challenges
Allowlisting is powerful but operationally demanding. Common challenges: LOLBins (Living-Off-the-Land Binaries) — attackers use Windows system tools like PowerShell, wscript.exe, and mshta.exe that are typically on every allowlist; allowlisting must restrict how these are invoked, not just whether they run. Scripting languages (PowerShell, Python) are often allowlisted but can execute malicious code. False positives — legitimate software blocked by the allowlist — generate helpdesk tickets and pressure to weaken controls. Mature allowlisting programs address LOLBins through additional constrained language mode policies.
# Restricting PowerShell with Constrained Language Mode
# Applied via WDAC when non-WDAC code runs
$ExecutionContext.SessionState.LanguageMode
# Full Language mode -> normal PowerShell
# Constrained Language -> no .NET, no COM objects
# Blocks many attack techniques
# Via Group Policy: force PowerShell logging
# Computer Config > Admin Templates > Windows Components
# > Windows PowerShell
# Enable: Module Logging, Script Block Logging, TranscriptionAllowlisting vs Denylisting
Allowlisting permits only explicitly approved items and blocks everything else — a stronger security posture. Denylisting (blacklisting) blocks explicitly known-bad items and allows everything else — the traditional antivirus model. Denylisting fails against unknown threats; allowlisting fails against LOLBins and overly broad allow entries. Most mature security programs use allowlisting as the primary control for critical systems while using behavioral detection (EDR) to catch misuse of allowed applications. For less critical systems, a well-tuned denylist with behavioral monitoring may be acceptable.
Combining Firewall and Allowlisting
Host-based firewalls and application allowlisting are complementary, layered controls. The allowlist prevents unauthorized code from executing; the firewall prevents unauthorized network connections from authorized-but-compromised code. Together, they implement least-privilege principles at both the application and network layer on the endpoint. Adding EDR as a third layer creates a defense-in-depth stack where each control catches what the others might miss, dramatically raising the cost and complexity of successful attacks on endpoints.
# Endpoint defense-in-depth stack
Layer 1: Application Allowlisting (WDAC)
-> Blocks unauthorized executables from running
Layer 2: Host-Based Firewall (WDF)
-> Blocks unauthorized network connections
-> Even from allowlisted apps on non-standard ports
Layer 3: EDR (CrowdStrike/Defender for Endpoint)
-> Detects behavioral anomalies in allowed processes
-> Catches LOLBin misuse, process injection
-> Provides forensic telemetry for investigationFirewall Logging and Monitoring
Host-based firewalls are only as valuable as the logs they generate. Enable logging for blocked connections to capture attack attempts and policy violations. Enable logging for allowed connections on sensitive rules (such as those permitting administrative tools) to maintain an audit trail. Forward firewall logs to the SIEM for correlation — a pattern of blocked outbound connections from a single host may indicate malware attempting C2 callbacks. On Windows, firewall logs are written to %systemroot%\System32\LogFiles\Firewall\pfirewall.log by default and should be forwarded via Windows Event Forwarding (WEF) or a log agent.
# Enable Windows Firewall logging via PowerShell
Set-NetFirewallProfile -All \
-LogBlocked True \
-LogAllowed True \
-LogMaxSizeKilobytes 16384 \
-LogFileName '%systemroot%\System32\LogFiles\Firewall\pfirewall.log'
# Linux: log dropped packets with iptables
iptables -N LOGGING
iptables -A INPUT -j LOGGING
iptables -A LOGGING -m limit --limit 5/min -j LOG \
--log-prefix 'IPtables-Dropped: ' --log-level 4
iptables -A LOGGING -j DROPQuick Check
Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.
Lesson Recap
In this lesson you learned: host-based firewalls (Windows Defender Firewall, iptables) filter traffic per-endpoint with deny-by-default posture and application-scoped rules, application allowlisting (AppLocker, WDAC) blocks unauthorized executables including malware from running, and layering firewall, allowlisting, and EDR creates defense-in-depth that raises the attack cost dramatically. Next up we explore email authentication: SPF, DKIM, and DMARC.
Frequently asked questions
Is the “Host-Based Firewall and Application Allowlisting” lesson free?
Yes — the full text of “Host-Based Firewall and Application Allowlisting” 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 “Host-Based Firewall and Application Allowlisting”?
Configure host-based firewalls (Windows Defender Firewall, iptables) and application allowlists that block unauthorized software from executing. 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 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Host-Based Firewall and Application Allowlisting” 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
- Antivirus, EDR, and XDR Platforms
- OS Hardening: Patching, Baseline Config, and CIS Benchmarks
- Mobile Device Management (MDM) and BYOD Policies
- Host-Based Firewall and Application Allowlisting