Network & Internet Security

Chapter 7
Firewalls, Proxies, and Network Defense Technologies

Certificate in Cybersecurity
Network & Internet Security   •   Certificate

Firewalls, Proxies, and Network Defense Technologies

Introduction and Context

A network firewall is a security control that permits, denies, or inspects traffic according to defined rules. Firewalls sit at important boundaries: between an internal network and the internet, between user and server segments, between cloud networks, and sometimes directly on endpoints. They are not complete security solutions. A firewall can reduce attack exposure, but it cannot correct vulnerable applications, prevent misuse by authorized users, or guarantee that allowed traffic is safe.

Modern network defense combines several technologies. Packet filters examine addressing and transport information. Stateful firewalls track connections and use that context when making decisions. Application gateways and proxies mediate application requests. Secure web gateways apply policy to web traffic. Intrusion detection and prevention systems identify or block suspicious activity. Endpoint controls provide host-level visibility and can cooperate with network controls.

The central design principle is controlled communication: allow necessary business flows, deny unnecessary flows, inspect high-risk traffic, record security-relevant events, and regularly validate that controls still reflect organizational requirements.

Learning Objectives

By the end of this chapter, a learner should be able to:

  • Explain the purpose and limitations of firewalls, proxies, and network defense technologies.
  • Distinguish packet filtering, stateful filtering, application gateways, and proxy services.
  • Interpret and construct basic firewall rules using least privilege.
  • Describe how secure web gateways, IDS, and IPS operate.
  • Explain how endpoint and network security controls complement one another.
  • Apply a structured method to a small network-defense scenario.
  • Identify operational, ethical, privacy, and governance issues in traffic inspection.

1. Firewall Foundations

A firewall enforces a traffic-control policy between security zones. A zone is a group of systems with similar trust requirements, such as the public internet, a demilitarized zone (DMZ), an employee network, a guest network, or a database segment.

A basic firewall decision is based on attributes such as:

  • Source and destination IP address
  • Source and destination port
  • Transport protocol, such as TCP, UDP, or ICMP
  • Interface or security zone
  • Connection state
  • Application identity or protocol content
  • User, device, time, or risk context

A rule normally contains a match condition and an action. Common actions are allow, deny, reject, log, redirect, or inspect. A deny silently discards traffic; a reject discards it while returning an error indication. Silent denial can reveal less information, but excessive use may make troubleshooting difficult.

The default-deny principle

A secure baseline is to deny traffic that has no explicit business justification. This is often called default deny or implicit deny. The principle does not mean that every organization must block everything initially; rather, it means that permitted communication should be explicitly identified and justified.

A rule should answer five questions:

  1. Who or what is communicating?
  2. Where is the traffic going?
  3. Which protocol and service are required?
  4. Under what conditions is it allowed?
  5. What evidence will be recorded?

Rules should be ordered carefully. Many firewalls evaluate rules from top to bottom and apply the first matching rule. A broad allow rule placed before a narrow deny rule can make the deny ineffective. Some platforms use different processing models, so administrators must understand the product’s behavior.

Basic rule example

Suppose a public web server is located in a DMZ. A suitable simplified policy might be:

PrioritySourceDestinationServiceActionLogging
10InternetWeb serverTCP 443Allow and inspectYes
20InternetWeb serverTCP 22DenyYes
30DMZInternal databaseDatabase port from web server onlyAllowYes
40AnyAnyAnyDenySelected events

The database rule must identify the specific web-server address rather than allowing every DMZ host. Management access should normally originate from an administrative network or approved remote-access service, not from the entire internet.

2. Packet Filtering and Stateful Inspection

Stateless packet filtering

A stateless packet filter examines each packet independently. It can match source and destination addresses, protocol, ports, interfaces, and sometimes flags. It is fast and conceptually simple, but it does not know whether a packet belongs to a legitimate established conversation.

For example, a stateless rule could allow TCP traffic from a client subnet to a web server on destination port 443. It may need additional rules to handle return traffic, depending on the direction and platform. This increases rule complexity and creates opportunities for mistakes.

Stateless filtering is useful for simple boundary controls, infrastructure access lists, and high-speed traffic classification. Its limitations include weak context, difficulty handling dynamic protocols, and limited ability to distinguish a valid response from an unsolicited packet.

Stateful inspection

A stateful firewall maintains a connection table. When an internal client initiates a permitted TCP session, the firewall records relevant information, such as source and destination addresses, ports, protocol, and connection state. Return traffic matching the recorded session can then be permitted without a separate broad inbound rule.

For TCP, a stateful device can observe the handshake and later termination. For UDP, which is connectionless, the firewall generally creates a temporary state entry based on observed traffic and timeout rules. Stateful inspection improves security and administration, but it is not equivalent to full application understanding. A permitted connection can still carry malicious content.

A simplified connection tuple is:

(source\fIP, source\fport, destination\fIP, destination\fport, protocol)

The tuple identifies a flow in many conventional designs. Network address translation, load balancing, asymmetric routing, and protocols that open secondary connections can complicate state tracking.

Stateful example

A policy permits internal clients to access approved external HTTPS services. The client sends an outbound TCP connection request to destination port 443. The firewall creates state. Replies from the identified external address and port are permitted only while the state entry is valid. An unsolicited inbound packet claiming to be a reply is discarded if it does not match an existing state entry.

Stateful controls should still use explicit egress policy. Allowing every internal system to reach every external service can facilitate malware command-and-control, data exfiltration, or unauthorized software installation.

3. Application Gateways and Proxies

A proxy is an intermediary that receives a request from one party and makes a separate request to another party. The client may be configured to use the proxy directly, or traffic may be transparently redirected.

An application gateway understands a particular protocol sufficiently to mediate it. A web proxy, for example, can authenticate users, enforce URL policy, inspect headers, apply malware scanning, and record web activity. Unlike a simple packet filter, it can make decisions based on application-level information.

Forward and reverse proxies

A forward proxy represents clients accessing external services. It can provide centralized web policy, caching, identity integration, and inspection.

A reverse proxy represents servers to external clients. It can terminate TLS, route requests to backend services, apply rate limits, hide internal addresses, and provide web application firewall functions. A reverse proxy is not automatically a web application firewall; the latter requires rules and inspection designed to identify application attacks.

Application-layer benefits and limitations

Application gateways can enforce detailed controls, but they introduce complexity and may affect performance. They must be updated as protocols evolve. Encryption also creates a policy question: inspection may require TLS decryption and re-encryption, which introduces certificate management, privacy concerns, and additional failure points.

Some applications use certificate pinning, mutual TLS, proprietary protocols, or end-to-end encryption that prevents ordinary interception. Organizations should not assume that a proxy can inspect all traffic.

4. Secure Web Gateways

A secure web gateway (SWG) controls and monitors web access, commonly including HTTP and HTTPS. Typical functions include:

  • URL and category filtering
  • Malware and phishing detection
  • File-type and download controls
  • Data-loss prevention checks
  • User and device-based policy
  • Cloud application control
  • Remote-browser isolation
  • Logging and reporting

A mature SWG uses multiple signals rather than relying solely on a domain category. Useful signals include reputation, certificate characteristics, destination risk, user identity, device posture, downloaded content, and behavioral indicators.

HTTPS inspection can improve visibility but must be governed carefully. The organization should define categories that must not be decrypted, such as personal health, banking, legal, or other sensitive services where applicable. It should notify users, protect inspection logs, limit administrator access, and comply with employment, privacy, and data-protection laws.

A secure web gateway is most effective when combined with endpoint protection and identity controls. A user on an unmanaged device, for example, may require a different policy from a managed device with current security updates.

5. Intrusion Detection and Prevention

An intrusion detection system (IDS) identifies suspicious activity and generates alerts. An intrusion prevention system (IPS) is positioned to block or modify traffic when a detection rule is triggered.

Detection approaches

Signature detection compares traffic or events with known patterns. It is effective for recognized attacks but can miss new variants and can produce false positives when patterns appear in legitimate content.

Anomaly detection compares activity with a model of expected behavior. It can identify unusual events but requires a reliable baseline and may be sensitive to legitimate changes.

Behavioral and analytics-based detection combines multiple indicators, such as unusual login times, rare destinations, scanning behavior, or a sequence of events across hosts.

IDS and IPS sensors may be network-based, host-based, wireless, cloud-based, or integrated into a firewall. A network sensor placed at a single location cannot see traffic that never crosses that location, including some east-west traffic within a switched or cloud environment.

False positives and false negatives

A false positive is a benign event classified as malicious. A false negative is malicious activity that is missed. High false-positive rates cause alert fatigue and can lead analysts to ignore genuine incidents. High false-negative rates create a false sense of security. Tuning should prioritize business context, asset criticality, exploitability, and confidence of evidence.

IPS blocking should be introduced cautiously. A poorly tuned rule can interrupt essential services. Organizations commonly begin in detection mode, validate alerts, and then enable prevention for well-understood high-confidence threats.

6. Endpoint–Network Integration

Network controls and endpoint controls provide different perspectives. A network firewall sees flows and zones; an endpoint agent can see processes, files, user context, local connections, and host changes. Effective defense correlates these views.

Examples of integration include:

  • An endpoint detection and response (EDR) platform identifies a suspicious process and requests network isolation.
  • Network access control checks whether a device is managed, patched, and protected before granting access.
  • Identity-aware firewalls use user or device identity rather than IP address alone.
  • Security information and event management (SIEM) platforms correlate firewall, proxy, DNS, authentication, endpoint, and cloud events.
  • Automated response systems add a malicious domain to a blocking policy after analyst approval.

Automation must be controlled. A temporary quarantine action may be appropriate for a high-confidence compromise, while an automatic block based on a low-confidence classification may disrupt operations. Every automated action should have an owner, an audit trail, an expiration or review process, and a way to recover from error.

7. A Practical Method for Designing Basic Firewall Rules

A small organization can use the following workflow.

Step 1: Identify assets and zones

List public services, employee systems, administrative devices, servers, guest devices, and sensitive systems. Place them into zones according to risk and required communication, not merely physical location.

Step 2: Document required flows

For every business flow, record source, destination, protocol, port, direction, user or device condition, business owner, and justification. Network diagrams, application documentation, DNS records, and flow logs can support this work.

Step 3: Define the baseline

Use a default-deny posture where practical. Permit only necessary services. Separate management traffic from ordinary user traffic. Restrict outbound traffic when the risk and operational capacity justify it.

Step 4: Order and simplify rules

Place specific exceptions before general rules. Remove duplicates and shadowed rules. Use groups for approved sources and services, but avoid groups so broad that their meaning becomes unclear.

Step 5: Log strategically

Log denied attempts relevant to investigation, successful access to sensitive services, administrative changes, and significant inspection decisions. Logging every packet may be costly and may create privacy and storage problems. Ensure that timestamps are synchronized.

Step 6: Test safely

Use a test environment or controlled maintenance window. Test permitted traffic, prohibited traffic, return traffic, logging, failover, and performance. Confirm that a rule does not unintentionally permit access through another path.

Step 7: Review continuously

Rules should have an owner, purpose, creation date, review date, and expiration where possible. Remove temporary access promptly. Review changes after mergers, cloud migrations, application replacement, or major incidents.

Vendor-neutral pseudocode

rule 10:
  from = internet
  to = dmz_web
  service = HTTPS
  action = allow
  inspect = web_security
  log = enabled

rule 20:
  from = admin_network
  to = dmz_web
  service = approved_management_service
  action = allow
  log = enabled

rule 30:
  from = dmz_web
  to = internal_database
  service = database_service
  action = allow
  condition = source_is_exact_web_server
  log = enabled

rule 1000:
  from = any
  to = any
  service = any
  action = deny
  log = selected

This is conceptual pseudocode, not a product-specific configuration. Actual syntax, rule order, object definitions, and inspection behavior vary by platform.

8. Applied Case: Protecting a Small Online Retailer

Background

This illustrative case concerns a retailer with a public online store, an internal office network, a payment-processing integration, and remote administrators. The store uses a web application and a separate database. Employees also browse the internet and receive email.

Problem

The retailer initially places the web server and database on the same network. A single firewall rule permits broad inbound and outbound traffic. Logs are incomplete, and administrators connect directly from the internet using a shared account.

Analysis

The design creates several risks. A compromise of the web server could provide direct access to the database. Broad outbound access could permit malware communication or data theft. Shared administration prevents reliable accountability. Lack of centralized logs makes investigation difficult.

Approach and solution

The retailer creates separate internet, DMZ, application, database, office, guest, and management zones. Only HTTPS is exposed publicly. The reverse proxy terminates external TLS and forwards approved requests to the web application. The web application can contact the database only on the required database service and only from its designated address. Database access from office and guest networks is denied.

Administrative access is restricted to a management network using individual accounts and multi-factor authentication. Outbound connections from servers are limited to documented update, logging, DNS, and application-integration requirements. A secure web gateway filters employee browsing, while endpoint protection reports suspicious processes and can request isolation.

The firewall, proxy, endpoint, and authentication logs are forwarded to a SIEM. Alerts are created for repeated blocked database attempts, unusual administrative access, and a server contacting newly observed high-risk destinations.

Outcome

The revised design reduces the number of exposed services, limits lateral movement, improves accountability, and gives defenders more useful evidence. It does not eliminate risk: application vulnerabilities, stolen credentials, supply-chain compromise, and malicious insiders remain possible. Regular patching, secure development, backups, incident response, and access reviews remain necessary.

Learning points

  • Segmentation is more valuable than a perimeter rule alone.
  • Rules should reflect application flows and business ownership.
  • Identity and endpoint context strengthen IP-based controls.
  • Visibility and response processes are as important as prevention.
  • Security controls must be tested for both protection and availability.

9. Limitations, Governance, and Ethical Issues

Firewalls cannot reliably determine whether every permitted message is legitimate. Application-layer attacks may use valid HTTPS. Attackers may exploit allowed cloud services, stolen credentials, encrypted channels, or compromised legitimate devices. Network address translation can hide internal identities, and an overreliance on perimeter defenses is dangerous in cloud and remote-work environments.

Traffic inspection can expose personal communications, credentials, health information, or confidential business data. Organizations should define a legitimate purpose, collect only necessary data, protect logs, restrict access, establish retention limits, and communicate monitoring practices. Legal requirements differ by jurisdiction and may include data-protection, employment, telecommunications, payment-card, and sector-specific rules.

Security administrators have significant power. They should use documented authorization, avoid inspecting unrelated personal content, preserve evidence appropriately, and follow change-control procedures. Emergency access should be recorded and reviewed afterward.

10. Contemporary Developments and Best Practices

Current environments increasingly use zero-trust principles, software-defined segmentation, secure access service edge (SASE) architectures, cloud-native firewalls, and identity-aware policy. These approaches do not make traditional firewalls obsolete; they distribute policy across users, workloads, applications, endpoints, and services.

Artificial intelligence and machine learning can assist with anomaly detection, alert grouping, and policy analysis. However, generated recommendations can be wrong, biased by incomplete data, or difficult to explain. Human review, testing, and rollback remain essential. AI should support, not replace, governance and skilled analysis.

Recommended practices include:

  1. Use least privilege and default deny where operationally feasible.
  2. Segment sensitive systems and restrict east-west traffic.
  3. Prefer individual identities and strong authentication for administration.
  4. Keep firewall, proxy, IPS, and endpoint software updated.
  5. Protect management interfaces and separate them from user networks.
  6. Log meaningful events and synchronize system clocks.
  7. Review rules for ownership, necessity, shadowing, and expiration.
  8. Test failover, logging, inspection, and recovery—not only connectivity.
  9. Combine preventive, detective, and responsive controls.
  10. Measure outcomes such as exposure reduction, investigation time, and service availability rather than counting rules alone.

Chapter Summary

Firewalls control communication between network zones through rules that may use addresses, ports, protocols, state, identity, and application context. Stateless packet filters inspect individual packets, while stateful firewalls track flows and use connection context. Application gateways and proxies mediate requests and can enforce application-specific policy. Secure web gateways add web filtering, malware analysis, identity integration, and sometimes encrypted-traffic inspection.

IDS technologies detect suspicious behavior, whereas IPS technologies can block it; both require tuning to manage false positives and false negatives. Endpoint and network controls complement one another by providing different evidence and response capabilities. Effective rule design begins with asset identification and documented business flows, uses least privilege and segmentation, logs strategically, and includes testing and review. Finally, monitoring and inspection must be governed ethically and legally, with attention to privacy, accountability, availability, and the limitations of automated decisions.

Key Terms

Firewall: A control that permits, denies, or inspects network traffic according to policy.

Security zone: A network area whose systems share similar trust and access requirements.

Packet filtering: Evaluating packets using fields such as addresses, ports, and protocols.

Stateful inspection: Filtering that considers the state of a communication session.

Connection table: Records maintained by a stateful device to track active flows.

Default deny: A policy in which traffic is denied unless explicitly permitted.

DMZ: A separated network zone for services that must be reachable from less-trusted networks.

Proxy: An intermediary that receives a request and makes a separate request to another system.

Forward proxy: A proxy representing internal clients accessing external services.

Reverse proxy: A proxy representing internal servers to external clients.

Application gateway: A control that understands and mediates a particular application protocol.

Secure web gateway: A service that filters, inspects, and monitors web access.

IDS: An intrusion detection system that identifies and reports suspicious activity.

IPS: An intrusion prevention system that can block or modify suspicious traffic.

False positive: A benign event incorrectly classified as malicious.

False negative: Malicious activity that a detection system fails to identify.

Network segmentation: Dividing a network to limit communication and reduce lateral movement.

Endpoint detection and response: Host-based monitoring and response for suspicious activity.

SIEM: A platform that collects and correlates security events from multiple sources.

Least privilege: Providing only the access necessary for an authorized task.

Review Questions

Short Answer Questions

  1. What is the purpose of a firewall rule?
  2. How does stateful inspection differ from stateless packet filtering?
  3. Distinguish a forward proxy from a reverse proxy.
  4. What is the difference between an IDS and an IPS?
  5. Why should firewall rules have owners and review dates?

Long Answer Questions

  1. Explain how a small organization could use zones, default deny, and least privilege to protect a public web service and an internal database.
  2. Discuss the benefits and risks of HTTPS inspection by a secure web gateway.
  3. Compare signature, anomaly, and behavioral detection approaches.
  4. Explain how endpoint telemetry can improve network-based incident response.
  5. Discuss why firewalls are necessary but insufficient as a complete cybersecurity strategy.

Analytical / Application Questions

  1. A rule allows any host in a DMZ to connect to an internal database. Analyze the weaknesses and propose a narrower policy.
  2. An IPS generates thousands of alerts after a new application is deployed. Develop a safe tuning and validation process.
  3. Design a high-level security-zone and traffic policy for an organization with public services, employees, guests, administrators, and sensitive records.

Multiple Choice Questions with Answers

Question 1

Which principle requires traffic to be denied unless it is explicitly permitted?

A. Implicit trust

B. Default deny

C. Open routing

D. Load balancing

Correct Answer: B. Default deny

Question 2

What is the primary feature that distinguishes a stateful firewall from a stateless packet filter?

A. It tracks communication-session context

B. It eliminates the need for firewall rules

C. It encrypts every packet automatically

D. It operates only on wireless networks

Correct Answer: A. It tracks communication-session context

Question 3

Which proxy represents internal clients when they access external websites?

A. Reverse proxy

B. Forward proxy

C. Database proxy

D. ARP proxy

Correct Answer: B. Forward proxy

Question 4

What is the main role of an IPS?

A. Assigning IP addresses

B. Blocking or modifying suspicious traffic

C. Replacing all endpoint antivirus controls

D. Providing physical access to servers

Correct Answer: B. Blocking or modifying suspicious traffic

Question 5

Why should a database rule normally restrict the source to a specific application server?

A. To increase the number of exposed hosts

B. To support least privilege

C. To disable state tracking

D. To avoid recording events

Correct Answer: B. To support least privilege

Question 6

Which situation is a false positive?

A. A real attack is missed

B. A benign event is classified as malicious

C. A malicious event is blocked correctly

D. A permitted service is documented

Correct Answer: B. A benign event is classified as malicious

Question 7

Which technology commonly mediates and filters employee web browsing?

A. Secure web gateway

B. Network time protocol

C. File allocation table

D. Power supply unit

Correct Answer: A. Secure web gateway

Question 8

Why is segmentation useful in network defense?

A. It guarantees that no system can be compromised

B. It limits unnecessary communication and lateral movement

C. It removes the need for authentication

D. It makes all traffic anonymous

Correct Answer: B. It limits unnecessary communication and lateral movement

Question 9

Which information is especially useful when correlating endpoint and firewall events?

A. The endpoint process responsible for a connection

B. The monitor manufacturer

C. The keyboard layout only

D. The building paint color

Correct Answer: A. The endpoint process responsible for a connection

Question 10

What is an important governance concern when decrypting HTTPS traffic?

A. It always reduces bandwidth to zero

B. It may expose sensitive personal or confidential information

C. It prevents all malware automatically

D. It eliminates certificate management

Correct Answer: B. It may expose sensitive personal or confidential information

Network & Internet Security
Chapter 7 of 14