Network Security
Network Security
A firewall is a security system that monitors and controls incoming and outgoing
network traffic based on predetermined security rules.
or
A Network Firewall is a system or group of systems used to control access between two
networks -- a trusted network and an untrusted network -- using pre-configured rules or
filters.
Its primary purpose is to establish a barrier between a trusted internal network and
untrusted external networks (such as the internet).
Firewalls help protect systems from unauthorized access, cyberattacks, and other
security features
Firewall is device that provides secure connectivity between networks (internal/
external).
All messages entering or leaving the intranet pass through the firewall, which
examines each message & blocks those that do not meet the specified security
criteria.
Why do we need a firewall?
To protect confidential information from those who do not explicitly need to access it.
To protect our network & its resources from malicious users & accidents that
originate outside of our network.
Hardware Firewall
• It is a physical device.
5
Usually more expensive, harder to configure.
6
Software Firewall
• It is a software application.
7
• Usually less expensive, easier to configure.
8
Types of Firewalls
1.Packet-Filtering Firewall
1. Function: Inspects packets of data sent between computers on a network. It
checks the packet header for the source, destination IP address, and port number.
2. Pros: Simple, fast, and effective for basic filtering.
3. Cons: Limited inspection (doesn’t examine packet content); vulnerable to attacks
that bypass header rules.
Stateful Inspection Firewall
1. Function: Tracks the state of active connections and makes decisions based on
the state of the connection, not just individual packets.
2. Pros: More secure than packet filtering; can track the context of network traffic.
3. Cons: More resource-intensive than packet-filtering firewalls.
Proxy Firewall (Application-Level Gateway)
1. Function: Acts as an intermediary between the internal network and the external
world by filtering requests at the application level (e.g., HTTP, FTP).
2. Pros: Provides deep inspection of data; can block malicious content at the
application level.
3. Cons: Can slow down traffic; requires more resources.
Next-Generation Firewall (NGFW)
1. Function: Combines traditional firewall functions with advanced features such as
deep packet inspection, intrusion prevention systems (IPS), and application
awareness.
2. Pros: High level of security, integrates multiple security features.
3. Cons: Expensive and complex to manage.
Firewall Functions
Traffic Filtering: Controls what traffic can pass between networks based on IP
addresses, ports, and protocols.
VPN Support: Secures remote connections by encrypting data over the internet.
Logging and Monitoring: Records traffic logs for auditing and identifying suspicious
activity.
Access Control: Defines who can access certain services or data and enforces
authentication.
What a personal firewall can do
Stop hackers from accessing your computer.
15
Example Use Case:
Imagine you're running a web server that hosts your company's website. You set up a firewall on
your network perimeter to block any incoming traffic on ports other than 80 (HTTP) and 443 (HTTPS).
Rule Example: Only allow HTTP and HTTPS traffic (port 80 and 443) and block all other ports like
port 22 (SSH), port 23 (Telnet), and port 25 (SMTP). This ensures that only web traffic is allowed
in and out, protecting your server from other types of network-based attacks.
Real-World Example:
Scenario: You want to block external access to your internal network from specific IP addresses that
are known to belong to malicious actors or are simply not supposed to have access.
Firewall Action: The firewall will block the traffic from these IPs, preventing them from
communicating with your network.
Next-Generation Firewall
Feature Packet Filtering Stateful Inspection Proxy Firewall
(NGFW)
Layer of Operation Network Layer (Layer 3) Transport Layer (Layer 4) Application Layer (Layer 7) Multiple layers (Layer 3–7)
18
Introduction to IDS (Intrusion Detection Systems)
What is IDS?: Intrusion Detection Systems (IDS) are tools that monitor networks,
computers, or applications to find signs of suspicious or harmful activity.
Why IDS?: The goal is to catch bad activities (like hacking or malware) before they can
cause damage.
Instead of blocking traffic like firewalls, it monitors traffic for suspicious activity (like
unusual patterns, known attack signatures, or abnormal behavior).
IDS can alert you if an attack is happening, even if it hasn't been blocked by the firewall.
It works by analyzing traffic for signs of attacks that could slip through the firewall.
Host-Based IDS (HIDS)
• It is a security system that is installed on an individual computer (or "host") to monitor and protect it.
• It focuses on what's happening inside the computer, like changes to files, system settings, or any
activity that could indicate a security threat.
Example of Real-World Usage
Monitoring a Server:
1. Consider a web server running a website. The server might have important files that handle
sensitive data.
2. A HIDS installed on the server can watch for changes in the files (e.g., changes to the
database or configuration files) or abnormal login attempts (like someone trying to guess the
admin password).
3. If a hacker tries to alter files, HIDS will detect that and raise an alarm, enabling the
administrator to take immediate action before the hacker can cause any damage.
Detailed Monitoring: HIDS focuses on the internal behavior of a host, making it ideal for detecting
suspicious activity that might not be visible from the outside (e.g., through the network).
Real-Time Alerts: It gives immediate alerts when something suspicious happens on the host, like a file
being changed or unauthorized access attempts.
Focus on System-Level Threats: It’s great for detecting attacks like malware infections, privilege
escalation (where an attacker gains higher permissions), and other local threats.
Limitations of HIDS
While HIDS is great for protecting individual computers, it does have some limitations:
Cannot Protect Against Network-Based Attacks: If a hacker attacks your network (e.g., by exploiting
vulnerabilities in the router or other devices), HIDS on an individual computer won’t be able to detect
it until the attack reaches the computer itself.
Resource-Intensive: HIDS can consume a lot of system resources, especially if it’s monitoring
multiple activities constantly. This could slow down the performance of the system.
What is APIDS (Application-Based IDS)?
An Application-Based IDS (APIDS) is a security system that focuses specifically on
monitoring applications (like web servers or other software applications) to detect and
protect against attacks targeting those apps.
What it does: It looks for malicious activity or attacks happening within applications.
Why it's important: Applications are often a target for hackers because they can have
vulnerabilities. APIDS helps to detect attacks that try to exploit these weaknesses.
Examples:
A Virtual Private Network (VPN) is a crucial technology that ensures secure and private
communication over public and untrusted networks.
In today’s digital world, where cyber threats, data surveillance, and privacy breaches
are increasing, VPNs provide a shield against malicious actors, unauthorized access,
and network monitoring.
By creating an encrypted tunnel between a user's device and a remote server, VPNs
mask IP addresses, prevent data interception, and allow users to browse the internet
anonymously.
Communication Without a VPN
Without a VPN, when a user accesses the internet, the following happens:
User Request: A user sends a request to visit a website (e.g., www.example.com) from
their device (computer, smartphone, etc.).
Data Transmission via ISP: The request first travels through the user’s router and is sent
to their ISP. The ISP acts as a gateway, forwarding the request to the appropriate web
server.
ISP Monitoring and Tracking: The ISP can see and log all browsing activity, including
visited websites, search queries, and personal data.
Data Sent to the Web Server: The ISP routes the request to the website’s server, which
processes the request and sends the webpage data back.
Response Back to the User: The website’s data returns through the ISP and router to the
user’s device.
Without a VPN: Security and Privacy Risks
Data Interception and Hacking: Public Wi-Fi networks, such as those in cafes, airports, and hotels, are
often unsecured, allowing hackers to intercept data using tools like packet sniffers. Sensitive information,
including login credentials and financial details, can be stolen.
ISP and Government Surveillance: Internet Service Providers (ISPs) and governments can monitor browsing
activities, track user behavior, and store internet usage data. In some countries, government agencies
impose strict surveillance, limiting online freedom and privacy.
Geo-Restrictions and Censorship: Many streaming services, news websites, and applications are
restricted based on geographic location. Users in censored regions may be unable to access certain
websites due to government-imposed restrictions.
Phishing and Identity Theft: Without encryption, cybercriminals can launch phishing attacks and steal
users’ personal information, such as banking credentials, emails, and credit card details, leading to identity
theft and financial fraud.
Workplace and Remote Access Risks: Employees working remotely without a VPN expose their company’s
sensitive data to cyber threats. Hackers can exploit weak network security to launch attacks, compromising
corporate information.
Online Activity Tracking and Targeted Ads: Many websites track users' online activities using cookies and IP
addresses, creating detailed user profiles. This data is often sold to advertisers, leading to excessive targeted
ads and loss of online anonymity.
Communication With a VPN
User Request Through VPN Client: The user initiates a request through a VPN
application, which encrypts all outgoing traffic before sending it.
Data Travels Through the VPN Server: The encrypted request is sent to a secure
VPN server, which acts as an intermediary between the user and the destination
website.
ISP Cannot See Activity: The ISP can only see an encrypted data stream going to the
VPN server, but it cannot read the contents or determine the final destination (e.g.,
the website the user is visiting).
VPN Server Forwards Request: The VPN server decrypts the request and sends it to
the destination website (e.g., www.example.com).
Website Response Sent Securely: The website sends back the requested data to the
VPN server, which then encrypts it and forwards it securely to the user.
User Receives Secure Data: The VPN application on the user’s device decrypts the
data so they can access the website.
Understanding How a VPN Works
A VPN functions by rerouting internet traffic through a secure server before it reaches
its final destination.
When a user connects to a VPN, their internet request is first encrypted and sent to a
VPN server.
The VPN server then assigns the user a new IP address and forwards their request to
the intended website or online service.
As a result, the user's real IP address remains hidden, and all transmitted data is
encrypted, making it difficult for hackers, government agencies, or internet service
providers (ISPs) to track or intercept online activities.
The encryption used in VPNs is a vital security mechanism. Most modern VPNs use
robust encryption standards such as AES-256 (Advanced Encryption Standard with a
256-bit key) to ensure that data remains secure even if intercepted.
Data Encryption and Secure Browsing: VPNs encrypt internet traffic using strong
encryption protocols like AES-256, preventing hackers, ISPs, and government agencies
from intercepting sensitive information. Even on public Wi-Fi, users remain protected
from cyber threats.
Anonymity and IP Masking: A VPN hides the user’s real IP address and assigns a new one
from a different location, preventing websites, ISPs, and third parties from tracking online
activities. This ensures anonymity and privacy.
Bypassing Geo-Restrictions and Censorship: Users can access blocked content, such
as streaming services (Netflix, Hulu, BBC iPlayer), social media, and news websites, by
connecting to VPN servers in different countries.
Protection Against Phishing and Cyber Threats: VPNs reduce the risk of phishing
attacks by encrypting login credentials and preventing man-in-the-middle (MITM) attacks.
Some VPN services offer built-in security features like ad blockers and malware
protection.
Secure Remote Access for Employees: VPNs allow employees to securely access
company resources, databases, and cloud applications from remote locations. This
protects sensitive business data from cyberattacks and unauthorized access.
Prevention of Online Tracking and Advertising Profiling: VPNs prevent websites from
tracking users' online behavior, blocking targeted ads and maintaining digital privacy. This
reduces unwanted advertisements and data collection.
Types of VPNs and Their Applications
The Remote Access VPN is widely used by individuals and employees to securely access
company networks from remote locations.
Site-to-Site VPNs connect multiple networks, allowing organizations with different office
locations to securely share data and communicate as if they were on the same local
network.
Mobile VPNs are specifically designed for users who frequently switch between
networks, ensuring seamless connectivity without losing VPN protection.
Additionally, Cloud VPNs are increasingly being adopted by businesses that rely on
cloud-based applications, offering scalable security solutions
Remote Access VPN
Allows individual users to securely connect to a private network over the internet.
Users install VPN client software on their devices, which establishes an encrypted connection to a VPN
server.
Use Cases:
•Employees working remotely.
•Securing public Wi-Fi connections.
•Bypassing geographical restrictions on content.
Limitations:
•Designed for users who move across different networks (e.g., from Wi-Fi to mobile data)
while maintaining a secure VPN connection.
Use Cases:
•A VPN service hosted in the cloud, eliminating the need for physical infrastructure.
•Managed by third-party providers like AWS, Google Cloud, and Azure.
Use Cases:
Limitations:
Dependence on Third Parties: Users rely on external providers for security and
performance.
Higher Latency: Data must pass through cloud VPN servers, which can introduce
delays.
Challenges and Limitations of VPNs
While VPNs provide numerous benefits, they also come with certain challenges. One of
the primary concerns is speed reduction, as encryption and rerouting of traffic through
VPN servers can introduce latency.
Additionally, some VPN providers keep logs of user activities, raising concerns about
trust and data privacy.
Another challenge is that VPNs are banned or restricted in certain countries, such as
China, Russia, and the UAE, where governments impose strict internet control
measures.
The device encrypts outgoing traffic before sending it to the VPN server.
Users connect remotely to this central VPN server for secure access.
For businesses and banks, VPN is deployed on servers and routers to secure
remote employees and sensitive data.
o A network packet analyzer will try to capture network packets and tries to display that
packet data as detailed as possible.
o In the past, such tools were either very expensive, proprietary, or both.
o Wireshark is perhaps one of the best open source packet analyzers available today.
Why people use Wireshark
o It will not warn you when someone does strange things on your network that he/she is
not allowed to do.
o Wireshark will not manipulate things on the network, it will only "measure" things from
it.
o It is designed to lure attackers into interacting with a seemingly real but isolated and
monitored environment.
o The goal of a honeypot is to study the attack patterns, tools, and techniques used
by cybercriminals and enhance security measures accordingly.
o Honeypots are essential for cyber defense, security research, and forensic
analysis.
o Divert attackers away from actual assets to reduce the risk of real data breaches.
Types of Honeypots
A. Low-Interaction Honeypots
o Simulates a few services such as open ports, weak credentials, or basic network
responses.
o Mostly used to detect and log automated attacks like botnets and brute-force
attacks.
Medium-Interaction Honeypots
o Example Use Case: Analyzing attack vectors used by malware and ransomware.
High-Interaction Honeypots
Fully functional real systems that attackers can interact with.
Production Honeypots
Step 1: Deployment
o Any access attempt is considered malicious since legitimate users are not
supposed to interact with it.
Step 3: Data Collection & Analysis
o All attacker actions are recorded, including:
o IP addresses
o Commands executed
o Malware uploaded
o Exploits attempted
o Analysts use this data to identify new vulnerabilities and attacker
behaviors.
o A fake SSH server is deployed with weak credentials (e.g., username: admin,
password: 123456).
o The honeypot captures the most commonly used passwords, which helps in
enforcing stronger password policies.
.
Example 2: Studying Ransomware Behavior
o A research honeypot is set up to allow ransomware to execute in a controlled
environment.
o The honeypot logs encryption patterns, ransom notes, and network traffic.
o Security experts use this data to develop decryption tools and mitigation
strategies.
o Attackers enter stolen credentials, thinking they are breaching a real system.
o The security team collects IP addresses and attacker details, which helps in
law enforcement investigations.
Advantages
Reduce False Positives – Unlike traditional IDS, honeypots only log real attacks.
Improve Threat Intelligence – Helps security teams understand attacker motives and
techniques.
Does Not Prevent Attacks – Honeypots only collect data but do not actively stop
threats.
Risk of Exploitation – If not properly isolated, an attacker could use the honeypot to
launch attacks on real systems.
Honeypot Detection Techniques (How Hackers Identify Honeypots)
o Behavioral Analysis – If the system does not behave like a real-world service,
hackers suspect a honeypot.