Lesson 1 of 4 Network Security Appliances

Firewalls, Proxies, WAF and CASB

Firewalls and proxies decide what traffic may pass and inspect it at different depths. This lesson explains firewall filtering methods and rule processing, forward and reverse proxies, web application firewalls and cloud access security brokers.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare firewall filtering methods.
  • Explain rule processing and rule base maintenance.
  • Distinguish forward and reverse proxies.
  • Describe WAFs and CASBs.

Firewall filtering methods

A firewall enforces a policy about which traffic may pass between networks or into a host. Firewalls differ in how much of each communication they examine, as the following table shows.

TypeHow it filtersStrengthsWeaknesses
Packet filter (stateless)Each packet on its own, by source and destination address, port and protocolFast and simpleNo context; return traffic must be allowed broadly; easily fooled by crafted packets
Stateful inspectionTracks connections in a state table; allows return traffic only for established sessionsMuch stronger than stateless; efficientDoes not understand application content
Application-level gateway (proxy firewall)Terminates the connection and inspects the application protocolDeep inspection; hides internal hostsSlower; needs support for each protocol
Next-generation firewall (NGFW)Stateful filtering plus application identification, user identity, intrusion prevention and threat intelligence; often TLS inspectionPolicies by application and userComplex and costly

Firewalls are deployed at the network edge, between internal zones, on hosts and as cloud services (firewall as a service and cloud-native firewalls).

Sort into groups

Which firewall type?

Exam skills 6.5.1

Classify each capability by the firewall type it describes.

Log in to try this activity Interactive activities are free with an account.

Rules and their maintenance

Firewall rules are typically processed top-down, and the first matching rule applies. Specific rules therefore go above general ones, and the rule base ends with a default deny (implicit or explicit deny all), so that anything not explicitly permitted is blocked. Good rules specify source, destination, port and protocol as narrowly as possible, have an owner, a business justification and a ticket reference, and log denied traffic and important allowed traffic.

Over time rule bases accumulate obsolete, overly broad ("any any") and shadowed rules (rules that can never match because an earlier rule catches their traffic). Regular rule reviews remove them, and changes go through change management. Egress rules matter as much as ingress: restricting outbound traffic hinders malware communication and data exfiltration.

1  permit  tcp  any            -> 203.0.113.10  443   (public web server)
2  permit  tcp  10.10.20.0/24  -> 10.10.50.5    5432  (app servers to database)
3  permit  tcp  10.10.99.0/24  -> any           22    (management network SSH)
4  deny    ip   any            -> any                 (default deny, logged)

Forward and reverse proxies

A proxy acts on behalf of another system. A forward proxy sits between internal users and the internet: users' web requests go to the proxy, which fetches the content. It can authenticate users, filter URLs by category, block malware, enforce acceptable use, log browsing and hide internal addresses. A cloud-delivered forward proxy is called a secure web gateway.

A reverse proxy sits in front of servers: internet clients connect to the proxy, which forwards approved requests to the internal servers. It hides the servers, terminates TLS, balances load, caches content and is a natural place for a WAF. A transparent proxy intercepts traffic without client configuration.

Sort into groups

Forward or reverse proxy?

Exam skills 6.5.1

Decide which kind of proxy each statement describes.

Log in to try this activity Interactive activities are free with an account.

Web application firewalls

A web application firewall (WAF) inspects HTTP and HTTPS traffic to and from web applications and blocks application-layer attacks such as SQL injection, cross-site scripting, path traversal and request forgery, as well as bots and application-layer DDoS. It uses rule sets (such as the OWASP Core Rule Set), signatures, positive security models that allow only expected requests, and rate limits. A WAF can provide virtual patching, blocking exploitation of a known application vulnerability until the code is fixed. Network firewalls cannot do this, because they do not understand HTTP content. WAFs need tuning to avoid blocking legitimate requests, and they complement but do not replace secure coding.

The following diagram shows where a virtual patch sits while a fix for a SQL injection flaw is developed.

Reducing risk during the three weeks before a SQL injection fix ships. A WAF in front of the application blocks injection against the vulnerable parameter (virtual patching), its logs show attempts, and the code fix is tracked to completion. A network firewall cannot help, because the attack arrives in legitimate HTTPS on port 443.
The scenario is illustrative.

Cloud access security brokers

A cloud access security broker (CASB) sits between users and cloud services to provide visibility and control over cloud use. Its main functions are discovery of the cloud services in use, including shadow IT, by analysing proxy and firewall logs; risk rating of those services; policy enforcement, such as blocking unsanctioned services or preventing uploads of sensitive data; data loss prevention for cloud data; threat protection, such as detecting compromised accounts; and compliance monitoring of sanctioned services' configurations. CASBs work through proxies (inline) and through the cloud services' APIs (out of band), and they are a component of SASE architectures.

Network firewall
ProtectsNetworks and hosts
UnderstandsAddresses, ports, protocols (applications for NGFW)
Typical threats addressedUnauthorised connections, scans
WAF
ProtectsWeb applications
UnderstandsHTTP requests and responses
Typical threats addressedSQL injection, XSS, bots
CASB
ProtectsUse of cloud services and cloud data
UnderstandsCloud service activity and data
Typical threats addressedShadow IT, data leakage, compromised cloud accounts
Worked example

Rule order

A firewall has rule 1: deny TCP from any to the web server on port 443; rule 2: permit TCP from the partner network to the web server on port 443. The partner cannot connect. Why?

Rules are processed top-down, first match wins. The partner's traffic matches the general deny in rule 1 before reaching the specific permit in rule 2, which is shadowed. The specific permit must be placed above the general deny.

Worked example

Protecting a vulnerable application

A penetration test finds a SQL injection flaw in a public web application. The developers need three weeks to fix it. What can reduce the risk meanwhile?

Deploy or tune a WAF in front of the application with rules that block SQL injection against the vulnerable parameter (virtual patching), monitor its logs for attempts, and track the code fix to completion. A network firewall cannot help, because the attack arrives in legitimate HTTPS requests on port 443.

Check yourself

What is a shadowed firewall rule?

Show answer

A rule that can never match because an earlier, broader rule catches all of its traffic first.

Exam Tips

Remember for the exam

  • Firewall rules: top-down, first match wins, end with default deny.
  • A WAF protects web applications at layer 7 and can provide virtual patching.
  • A CASB discovers shadow IT and controls cloud service use.