Mid Security
Mid Security
INTRODUCTION
1. Group Information
2. Reason for Topic Selection
3. Objectives
Chapter 1. Overview of Firewall in Network Security (Hà)
1.1. Concept of Firewalls
1.2. Firewalls rules and Policy
1.3 Types of firewalls
1.4. Common techniques in Firewall configuration
Chapter 2. Stateful Firewalls and Its Applications in Network Security ( Đăng )
2.1. Introduction to Stateful Firewalls
2.2. Working of Stateful Firewalls
2.3. Advantages and Limitations
2.4. Configuration
2.4.1. -sT (TCP Connect Scan)
2.4.2. -sV và -A (Service Version & Aggressive Scan)
2.4.3. -p (Port Specification)
2.4.4. -sU (UDP Scan)
2.5. Examples of Stateful Firewall tools and their applications
Chapter 3. Practical Implementation with Stateful Firewall
3.1. Testing Environment
3.2. Parameters Used in the Experiment
3.3. Test Cases (Hà)
3.4. Analysis and Evaluation of Results (Hà)
CONCLUSION
INTRODUCTION
1. Group Information
3. Objectives
The objective of using a firewall is to protect the network from unauthorized access and
cyber threats, by monitoring and controlling incoming and outgoing traffic to ensure that
only legitimate connections are allowed. Firewalls also help enforce the organization's
security policies, ensuring the confidentiality, integrity, and availability of data and systems.
Additionally, firewalls support secure remote access and safe online operations, contributing
to the overall cybersecurity strategy of the organization.
Chapter 1. Overview of Firewall in Network Security
Firewall rules are logical conditions used to determine whether a data packet should be allowed
or denied. These rules are based on various attributes such as:
Policies are implemented using rule sets and are typically based on the default-deny principle—
everything is blocked unless explicitly allowed.
● Packet-filtering firewall
This is the most fundamental type, which examines the header information of each
packet and makes decisions based on criteria such as source and destination IP
address, port number, and protocol. These firewalls are fast and simple but cannot
inspect the payload of packets, making them less effective against more sophisticated
attacks.
Packet-filtering can be static (fixed rules), dynamic (rules adjusted based on events), or
stateful, which tracks the state of each connection to ensure that packets belong to a
valid session.
● Hybrid firewall
It combines features from multiple firewall types. A hybrid system may include both
packet filtering and proxy functionalities, along with stateful inspection. Modern firewalls
often fall into this category and are marketed as Next-Generation Firewalls (NGFWs) or
Unified Threat Management (UTM) devices.
These solutions typically provide additional features:
- Intrusion detection/prevention systems (IDS/IPS),
- Deep packet inspection
- Application awareness (e.g., blocking social media)
- SSL inspection.
1.4. Common techniques in Firewall configuration
Firewall configuration is a critical task to ensure the system operates securely and efficiently.
One of the most widely used techniques is the default-deny policy, where all network traffic is
blocked by default, and only explicitly allowed services are permitted. This is considered a best
practice because it minimizes the attack surface.
Network Address Translation (NAT) is another key method, allowing private internal IP
addresses to access the internet using a single public IP, thus hiding internal network structure.
Port forwarding is used when specific internal services (like a web server or SSH access) must be
accessible from outside, by mapping external ports to internal IP and ports.
Firewall administrators also apply zone-based configurations, dividing the network into
segments such as inside, outside, and DMZ. Different rules are applied to traffic between each
zone, allowing for granular control and better isolation of services.
Other techniques include setting time-based rules, protocol restrictions (e.g., blocking Telnet or
FTP), and applying logging/auditing for tracking unauthorized access attempts.
Chapter 2. Stateful Firewalls and Its Applications in Network Security
A stateful firewall (or stateful inspection firewall) is a network security device that
monitors active connections and makes filtering decisions based on both predefined rules
and the state of network traffic. In contrast to basic packet-filtering firewalls which inspect
packets in isolation, a stateful firewall keeps a state table tracking details of each ongoing
connection (e.g. source/destination IPs, ports, connection status) from the moment it is
opened until it is closed. This context awareness means the firewall can recognize if an
incoming packet is part of an existing legitimate session or a brand new request. Now
considered a traditional firewall technology, stateful firewalls examine packet header
information (like addresses and ports) and remember past traffic, allowing them to allow or
block traffic based on both rules and connection context. This was a major improvement
over early “stateless” firewalls, which had no memory of past packets.
2.2. Working of Stateful Firewalls
Stateful firewall operation: A stateful firewall examines traffic in the context of existing
connections. When the first packet of a new connection arrives, the firewall performs
thorough checks (e.g. against security policies, access control lists, routing, and NAT rules)
to decide if that connection is allowed. If permitted, the firewall will create an entry in its
state table for that session, recording details like the 5-tuple (source/dest IP, source/dest
port, protocol) and the connection’s state. Once the connection is established, subsequent
packets do not need to be re-evaluated from scratch against all rules; the firewall
recognizes them as part of an existing session and lets them through as long as they match
the expected state. This greatly speeds up packet processing – in Cisco’s ASA firewall, for
example, established flows go through a “fast path” that quickly verifies the packet’s
session and sequence numbers rather than repeating full ACL checks. Essentially, if a
packet is part of a known active connection, the firewall allows it automatically, whereas
unknown packets (not matching any saved state) are subject to security policies.
For example: consider a client inside a network browsing a website: the client initiates an
outgoing TCP connection (the TCP three-way handshake) to the web server. The stateful
firewall sees this new connection setup and, if allowed by policy, adds it to the state table.
When the web server responds with packets back to the client, the firewall checks its state
table, recognizes these packets as belonging to the established session, and automatically
permits them back to the client without needing an explicit inbound rule. In effect, the
firewall enables bidirectional communication for the duration of the session by tracking the
state – the return traffic is allowed in because it’s matching an outbound request that was
already approved. This behavior simplifies security management and improves security,
since unsolicited packets (not matching any known connection) can be dropped by default.
Handling of UDP and other protocols: Because UDP and certain other protocols are
connectionless (they have no built-in handshake or explicit session teardown), a stateful
firewall cannot track them in exactly the same way as TCP. However, stateful firewalls
still manage these using pseudo-state mechanisms. For instance, when a UDP packet is
sent from an internal host to an external server, the firewall will temporarily allow the
corresponding response from that server’s IP/port back in, treating it as part of a “UDP
conversation” tracked in the state table. If the response arrives within a certain timeout and
matches the expected addresses/ports, it is permitted. In Cisco ASA, even protocols like
UDP or ICMP can have connection state information created for them, so that return traffic
is recognized and allowed just like with TCP. The firewall essentially remembers recent
UDP communications and will let the reply packets through (and then remove the state
entry after an idle timeout). If no matching state exists for an incoming UDP packet, the
firewall will treat it as unsolicited and block it (unless explicitly allowed by a rule). This
way, stateful inspection extends to connectionless traffic as well, improving security for
UDP-based services.
2.3. Advantages and Limitations
2.4. Configuration
The network model is designed and deployed on Cisco Packet Tracer , simulating a system
consisting of:
● Cisco ASA 5505 firewall , configured to be divided into three security zones:
Objective: Verify that ICMP traffic initiated from the inside network is allowed to reach external
networks, and that the return traffic is permitted due to stateful inspection.
Steps:
Expected Result: ASA allows the outbound ping and tracks the connection state. When the
ICMP reply returns, the ASA permits it since it matches an established session.
Objective: Confirm that unsolicited inbound ICMP traffic is blocked by default, demonstrating
ASA’s stateful nature.
Expected Result: The ASA drops the ping because it did not originate from the inside and no
session exists. This verifies the ASA does not allow inbound traffic unless it is part of an existing
stateful connection.
Objective: Test ASA’s behavior when a TCP session is initiated from inside to outside.
Steps:
● From PC-B, access a simulated web service on R1 using HTTP (port 80).
Expected Result: ASA tracks the TCP handshake (SYN, SYN-ACK, ACK) and allows return
traffic as part of the established session.
Objective: Ensure ASA blocks unsolicited inbound TCP connection attempts to internal hosts.
Steps:
Expected Result: ASA blocks the connection because it is not part of an existing session. This
behavior is core to stateful firewall functionality.
Test Case 5: TCP Connection to DMZ Server with Static NAT and ACL
Objective: Verify that ASA allows inbound access to a DMZ server when a proper ACL and
static NAT mapping exist.
Steps:
● From PC-C, initiate an HTTP request to the DMZ server using the public IP
209.165.200.227.
● ASA translates the request and checks if it matches the ACL permitting TCP port 80.
Expected Result: ASA allows the traffic due to an explicit ACL and static NAT, and statefully
inspects the session for return traffic.
The test results confirm the effectiveness of Cisco ASA as a stateful firewall, capable of
inspecting traffic and dynamically managing connection states. The ASA distinguishes between
new, existing, and invalid connections, applying different rules based on the context of each
packet.
In Test Case 1, we observed that return ICMP traffic was initially blocked until we explicitly
enabled ICMP inspection. This demonstrated ASA's default policy of allowing only TCP/UDP
return traffic and its flexibility to extend inspection to other protocols via MPF.
Test Case 2 highlighted the core principle of a stateful firewall: unsolicited inbound traffic
without a prior outbound request is blocked, reducing the attack surface of the internal network.
In Test Case 3, the ASA successfully managed the TCP three-way handshake and maintained the
session state, allowing bidirectional communication only within that session.
Test Case 4 confirmed ASA’s strict control over session initiation. No session state existed for
the unsolicited outside-to-inside TCP attempt, so the ASA dropped it silently, consistent with
secure firewall behavior.
Finally, Test Case 5 combined stateful inspection with static NAT and ACLs, showing that ASA
can selectively permit external access to internal services in a secure, controlled way.
Overall, the behavior observed in each scenario validates that the ASA's stateful firewall
maintains comprehensive session awareness. It dynamically opens and closes access based on
session state, which is essential for preventing unauthorized access while allowing legitimate
communication.
Research Sources for ASA :
- What Is a Firewall? - Cisco
- Cisco Secure Workload User Guide – Stateful Firewall Example, Cisco.com