Implementation and Design Pfsense Based Intrusion Detection and Prevention System by Using Suricata
Implementation and Design Pfsense Based Intrusion Detection and Prevention System by Using Suricata
Submitted by:
Yasir Mehmood 2018-MSTN-8
Master of Science
In
Telecommunication Networks
Submitted by:
Yasir Mehmood 2018-MSTN-8
Signed:
Date:
Acknowledgments
Several individuals have helped me in making this project a reality. I would like to thank all
of them for extending their kindest support. First and foremost, I would like to express
special thanks and gratitude to my Project supervisor Dr. Atif Hameed who through his
timely guidance and sincere efforts made it possible for me to complete the Project. His
immense knowledge about the particular topic and the dedication to impart that knowledge
into his students has to be pivotal in the completion of this project.
I dedicate this to my parents, wife and who had
kept me motivated throughout my M.Sc. Program and
sacrificed their emotions while I was busy in my studies.
Chapter 1 Contents
List of Figures...............................................................................................................vi
Abstract..........................................................................................................................vii
1.1 Introduction.............................................................................................................1
1.1.1 Machines.........................................................................................................2
1.1.2 Operating System............................................................................................2
1.1.3 Software..........................................................................................................2
1.2 Problem Statement..................................................................................................3
1.3 Project Aims & Objectives......................................................................................3
1.4 Related Work..........................................................................................................4
1.5 Network Architecture..............................................................................................4
1.5.1 The signature Based Intrusion Detection System............................................4
1.5.2 Anomaly Based Intrusion Detection System...................................................5
1.5.3 Network-Based Intrusion Prevention System (NIPS)......................................5
1.5.4 Wireless Intrusion Prevention System (WIPS)................................................5
1.5.5 Network Behavior Analysis (NAB)................................................................6
1.5.6 Host-Based Intrusion Prevention System (HIPS)...........................................6
1.6 PFsense....................................................................................................................6
1.7 Suricata Intrusion Detection System........................................................................7
Packet Acquisition...................................................................................................8
Decode and Stream Application Layer....................................................................8
Detection.................................................................................................................8
Output.....................................................................................................................9
1.8 Intrusion Prevention System using Suricata..........................................................17
1.9 Results...................................................................................................................20
1.10 Summary...............................................................................................................21
References:.......................................................................................................................22
List of Figures
Figure-1: Block Diagram..............................................................................................................3
Figure-2: PFsense and Suricata security infrastructure..................................................................7
Figure -3:Suricata Packet Capture and Detection..........................................................................9
Figure-4: Installation Window....................................................................................................10
Figure-5: PFsense Login Screen..................................................................................................11
Figure-6: System Settings...........................................................................................................12
Figure-7: DHCP configuration....................................................................................................13
Figure-8: WAN Interface............................................................................................................13
Abstract
This report covers details related to the design, implementation, and functionality of an IDS
that has been developed by the author of this report as a final year project that was a
mandatory requirement for their degree program. Since the author selected Suricata as a
mainstay for their IDS, therefore the report contains details regarding the reasons that
support this design. Also, the report considers the technical features of Suricata and
supporting platforms i.e., PFsense. Moreover, the report also takes a brief yet comprehensive
look at the previously conducted relevant work in this domain, as well as describes the
modern-day intrusion detection and prevention systems. To emphasize the work done
throughout the project, the report also contains screen-snippets to serve as a guideline for the
aspirants who want to materialize this particular project for their own needs. All in all, this
report follows a thorough approach to discuss the components of this project and forms a
theoretical foundation to base the practical work that has been conducted during this project.
Chapter 1
Introduction
1.1 Introduction
The world has seen rapid growth in terms of technology and computer networks during the
twenty-first century, and most people denote the current era as the era of technology and
communication. Although these advancements have revolutionized the way we
communicate, they have also opened new fronts to ensure safety and security. This is
essential for safe transmission of data across the internet to secure the transmission lines and
nodes which is a vital aspect of network security and management; thus, we can ensure
trustworthy and safe communication throughout the network. Cloud computing is one of the
fastest-growing sectors of computer science. This specific field deals with the shared
networks in IT (Information Technology) and computer resources for users. Despite many
developments in technology in network security, over the past few decades, the Internet
remains a hostile environment for networked computer systems. However, such rapid
growth in terms of technology and computer networks can also bring a variety of security
flaws and concerns that further lead towards massive loss, not only to a home user but also to
organizational assets by unauthorized access of data packets and network transmission lines
which can be effectively resolved using a system like Suricata [1], [2].
Previously, only cybersecurity experts and top-notch intruders knew the methods to break
into a system; however, technology breakdown has now enabled any person to sneak into
any system by tricking the firewall. To prevent such security intrusion threats, there are two
kinds of intrusion systems such as intrusion detection system (IDS) and intrusion prevention
systems (IPS). Suricata is a network threat detection system that provides capabilities of
intrusion detection, intrusion prevention, and network security monitoring. Suricata deeply
observes the packet exchange between transmission lines, and It employs deep packet
inspection and pattern matching techniques that make it exceptionally useful for network
security monitoring scenarios, as well as an IDS (intrusion detection System) and IPS
(intrusion prevention system). During the past twenty years, several companies have
launched network security and intrusion detection systems to achieve goals such as integrity,
confidentiality, and availability. [1], [3]
The world is now shifting towards multi-thread processors that have enabled the
development of multi-threaded software application design. Suricata follows a similar design
element, and it is a multithreaded network intrusion detection and prevention system. The
network monitoring and intrusion detection systems have become an essential component of
organizational network infrastructure incite of a growing number of cyber-attacks and
network intrusions across the globe. Intrusion detection is a process of detecting any sort of
malicious activity on networks that are mainly caused by unauthorized access to the system.
IDSs deeply monitor and analyse the ongoing network traffic and look for security breaches
in the existing dataset and incoming/outgoing data-files to negate the possibility of a hacker
to sneak into the system. As an IDS, Suricata detects the intrusion in the system with the help
of rulesets. Those rules-sets are predefined in Suricata-rules and can be modified by the
system administrator. Suricata uses a PFsense firewall which is used to create a dedicated
firewall for a network, moreover; PFsense creates and maintains a logbook of traffic on the
network which makes it a reliable tool to monitor communication between network nodes.
This project consists of several software tools and applications as stated below [4], [5]:
1.1.1 Machines
VMware (Virtual Machine-ware) is a software-based emulation tool that provides the
architecture and functionality of a dedicated physical computer on shared resources from its
host platform [6].
1.1.2 Operating System
Windows OS 8 (64 Bit version)
1.1.3 Software
PFsense Firewall ISO is installed on a virtual machine or a physical computer to make a
dedicated firewall for a network that also features unified threat management, load
balancing, and Multi-WAN.
If summarized, this project would enable us to identify and monitor real-time intrusion
moreover we would be able to manage traffic logs more efficiently. This project would
further enable safe and secure communication between network nodes providing a threat-
proof environment to boose efficiency in network traffic analysis. A key feature of Suricata
is that it enables the network administrator to balance the IDS-workload according to the
processing requirements at different locations within a network. Previously, the intrusion
systems used statical anomaly detection, host systems to detect, user profiles, and signatures.
Which used a rule-based expert system to detect known types of intrusion based on user
profiles, the host system, and the target system. This kind of system is limited to the
detection of a threat, with no prevention systems available. Firewalls can process the packets
very quickly; however, their response relies upon the port-address or IP address with no deep
packet inspection system. If described otherwise, firewalls have no visibility into packet
content and the context of traffic. Nevertheless, Suricata offers deep packet inspection and its
ability to analyse the events occurring inside the network allows it to provide a fool-proof
network security solution against cyberattacks [4], [7].
F
igure-1: Block Diagram
For this project, a virtual environment would be installed on VMware to replicate a PC that
would serve the role of an attacker within a wide area network (WAN PC). Another
environment would be created on a virtual machine using Windows as an operating system
that would act like a victim on the Local area network (LAN PC). The attacker would
remotely access the LAN PC and would generate a threat for the victim’s computer against a
single IP address. The user (network administrator in this context) would set some rules
against the data package. These predefined rules (as set by the user) in the Suricata package
against different ports such as telnet, FTP, and HTTP would deny access against the single
IP address to prevents the threat [4], [8].
1.6 PFsense
In a typical networking environment, the traffic is required to pass through a
firewall before entering or going out of the network. In other words, the firewall
serves as a boundary or access-control mechanism within a system and the outer
traffic. PFsense firewall is an open-source FreeBSD OS firewall which is a
comprehensive security tool, and an integral part of the Suricata-based security
framework. In addition to complementing the functionality of Suricata, PFsense can
also be utilized as a stand-alone solution to monitor the data packets as well as the
traffic on a network. Fundamentally, as a firewall, its primary role is to saves the
network devices from both internal and external threats to ensure the security,
integrity, and reliability of the communication process. In the context of this project,
PFsense is being used to manage and support the rules defined within Suricata, as
well as to balance the network load using its state-of-the-art multi-WAN and load
balancing techniques. PFsense is among one of few tools that use a graphical user
interface (GUI) to display alerts and traffic logs, making it easy for the network
administrator to take quick action against any suspicious activities that may occur
with a system [21].
Figure-2: PFsense and Suricata security infrastructure
1.7 Suricata Intrusion Detection System
Suricata is an intrusion detection and privation system that uses the signature-analysis
technique to identify malicious data packets and abnormal network activities within a
network. The signature-based analysis is a proven network security method with reliable
outcomes. Suricata makes it better and uses a deep packet Inspection technique to match
patterns for standard input and output data formats. For example, Suricate uses JSON
integration tools, YAML, SIEMs, and Kibana database systems to simplify tasks such as
packet capturing, detection, and prevention while maintaining their effectiveness. The
pattern matching methods follows certain pre-defined rules that are stored in the form of
structured text-files. These structured text-files contain critical information related to the
network traffic data of the user’s interest. These rules contain specific instructions that not
only specify various rules but also contain information regarding the events to trigger certain
rules/responses. These rules then generate alerts when malicious data tries to break-in
through the system and generates a security-based alert notification. These rules may contain
some sequence of characters, regular expressions, or bytes that entitled as a pattern. Patterns
are a crucial part of these rules, each rule may contain one or more patterns to compare with
the network traffic [4], [7], [8].
These patterns in a rule can further be broken down into three parts i.e., action, header, and
rule options. As a tool, Suricata has a set of certain keywords that are specific to it. Another
IDS, Snort’s header contains specific attributes such as rules, network-layer (L3) protocols,
source, and destination IP addresses. On a framework level, both Suricata and Snort are very
similar; however, Suricata prefers application layer protocols over network-layer protocols
whereas, Snort prefers network layer protocols e.g., File Transfer Protocol (FTP), Hypertext
Transfer Protocol (HTTP), Transport Layer Security (TLS), and Domain Name System
(DNS). The data packets are decoded by using Suricata’s decoding function twice and the
log is saved in the tabular form before these data packets are further processed in detection
modules. The aforementioned decoding tools read the packet to decode the data and the data
is saved in internal representations of Suricata where each data packet is called once at a
time in detection modules before it is placed into decoding pipelines. As far as the
functionality of these decoding pipelines is concerned, firstly the source address of the
captured packet is interpreted and then the Data link layer protocols are decoded. The
decoding process completes at the last and highest layer of the OSI (Open Systems
Interconnection) model. During the detection process of captured packets, the Suricata rules
are matched with internal data representations that have been created by the decoder earlier
[7], [22].
Unlike the decoding module, the detection process is capable of processing a single data
packet in multiple detection modules simultaneously. This approach does not only saves time
but also boosts efficiency, making Suricata an efficient and fast IDS. For the sake of
simplicity, Suricata has been entirely programmed in C-programming language and it does
not support C++ as all of Suricata’s modules have been developed in C. Suricata, being a
user-friendly tool, divides the network traffic into multiple streams following the multi-
threading approach. This technique does not only simplify the task-management for the users
but also enables Suricata to make more efficient and effective use of modern multi-core
systems. The following section takes a brief yet comprehensive look at the four key modules
of Suricata that are mainly regarding as boosters for improvement in processing
performance. Basically, these modules represent the formation of multi-threading in Suricata
[23].
Packet Acquisition
As the name suggests, this thread module is responsible to handle and read
the data packets from the network.
Decode and Stream Application Layer
This thread module is mainly related to performing the decoding function, as
well as inspecting the data-packets.
Detection
This particular thread module is designed to compare the signature of data-
packets and network communication patterns. This module makes use of Suricata’s
multi-threading capabilities to run multiple threads against one data-packet
simultaneously to increase the speed of this process.
Output
As the name implies, this phase is related to the output of the previous
module. When the process reaches this phase, the data packets have been processed
and their outcomes are used in this process to generate alerts for suspicious
activities.
The following diagram illustrates the above-mentioned process to signify
that how a packet is captured and decoded in Suricata thread modules.
3. The next step aims to the reverting of HTTP as a web-configuration protocol. The PFsense
would provide the web browser address to access the web interface of PFsense. After login
where username “Admin” and password “PFsense” were used as credentials. The web
interface would present an initial setup where the user can change the password of PFsense.
This concludes the basic installation and configuration of the PFsense firewall.
Figure-5: PFsense Login Screen
4. The configuration console screen offers the option to “Accept These Settings” and clicking
this option selects the default parameters for the program. The next screen contains the
selection options for quick/easy install and the selection of this option leads to another
selection screen that lets the user choose between the standard kernel installation or
embedded kernel installation. For this particular project, “Standard Kernel Installation” was
selected, and then the system was rebooted to implement these settings. After the reboot, the
installation process begins automatically. As default settings, PFsense is initially configured
to WAN with DHCP interface only. Since LAN is not configured by default; therefore, an IP
address needs to be allocated for this purpose as LAN can be configured manually. As a
recommended measure, LAN is to be configured using a static IPVersion4 address in the
PFsense terminal. This address serves as a default gateway for all hosts that are then plugged
into the system. The following screen showcases the system information, interfaces, traffic
graphs, and firewall logs.
Figure-6: System Settings
5. In PFsense from the Admin page, click on the Services tab to get to the slide bar of “Packet
Manager”, From packet manager install Suricata. System -> Packet Manager -> Available
Packages -> Suricata.
9. Now, after inspection and protection modules of Suricata has started to function, the home-
net and external network are set to their default parameters. Also, alerts have been set.
Figure 11: Alerts Screen
10.
The
following screen signifies that all of the rulesets have been selected and loaded into the
system. As stated earlier, these rules are utilized to generate alerts against malicious and
suspicious network activities to ensure a secure and reliable communication process.
Figure 12: Rulesets
11. The following screen showcases the alerts that were generated by the system in response to
simulated network-rules violations.
Figure 13: Ruleset violation alerts
12. The host-specific defragmentation and stream settings policies can be found in the WAN
flow/stream folder. These policies were altered in accordance with the requirements
possessed by this particular program.
Figure 14: policies
13. The following screenshot specifies the flow-manager settings, as well as flow-timeout
settings for TCP, UDP, and ICMP connections. The new connection timeout for TCP, UDP,
and ICMP has been set to 60, 30, and 30 seconds respectively.
Figure 15: connection timeout durations
14. The following screen showcases the alert-log entries. These entries consist of 10000 most
recent error/alert log entries.
15. The following screen specifies the policy and parameters that have been set by the network
administrator for this specific project. For this particular project, the alert retention values
have been set to 90 days. Nevertheless, these values can be changed or modified according to
certain conditions of a system.
Figure 17: retention values for logs
Now PFsense is installed, configured, and ready to set the rules for network
traffic. When the PFsense configuration has been completed, now is the time to
install the IDS/IPS system to create rules and allow only secure and appropriate
traffic through the network firewall. In PFsense the default option for rues is “Allow
All” which can be changed according to the requirements of each scenario. PFsense
offers a User interface, wherefrom system “Package Manager” installs Suricata
Intrusion Detection System. After installation, it could be seen under the “Services”
tab in PFsense.
1.8 Intrusion Prevention System using Suricata
As mentioned earlier, Suricata is an intrusion detection and privation system that employs its
signature-analysis technique to identify malicious data packets as well as abnormal network
activities within a network. In 1998, Jackob Nielsen predicted that the annual bandwidth of
users is expected to increase by an average of 50% and this exponential growth of user’s
bandwidth creates design problems for the developers of network intrusion detection and
prevention systems. The increased traffic on network system often exceeds the operational
boundaries of Intrusion prevention system and as a result the system is forced to drop the
packets rendering ineffectiveness. The System specialists often utilize algorithms and
Application Specific Integrated Circuits to avoid this kind of ineffectiveness. However, these
applications and systems tend to be costly. On the other hand, Suricata is an open-source
intrusion prevention system that is a cost-effective alternative that is not only provides
practical multithreaded intrusion detection but also prevents the unauthorized access to the
network by controlling the unwanted and malicious activities within a network.
The following diagram illustrates the above-mentioned process to signify that how Suricata
monitors and prevents security breaches within a network using Suricata thread modules.
1. The following screen illustrates the “Alert and Block” settings that have been configured to
the legacy mode by the network administer for this specific project while utilizing 10.0.0.1
as gateway IP address on LAN for point to point (P2P) communication. The Legacy Mode
inspects the data packets of the network system while the inline Mode inserts the Suricata
inspection engine into network stack. In addition, a packet leakage occurs in inline mode to
create the traffic, and if the traffic matches a specific rule, it generates an alert and traffic can
be blocked autonomously before even passing the IDS. In contrast, the legacy mode scans
the data packets, matches the packets with rules and then blocks the host ID.
2. The following screen showcases the rules sets. There exist 41 types of alerts in Suricata and
each alert log has a unique ID to generate Error Code.
4. The following screen showcases the alert entries that are triggered by the Alert Rule to drop
the data packets. As mentioned above, each log has a specific ID to generate the Error code.
In this project, PFsense is being used to manage and support the rules defined within
Suricata, to balance the network load using its state-of-the-art multi-LAN and load balancing
techniques.
1.9 Results
Since the objective of this project was to develop a cost-effective yet practical intrusion
detection and prevention system; thus, these objectives have been attained after the
promising results have been showcased by the system. The system monitors the incoming-
outgoing network traffic against the rules defined as set by the network administrator and
generates alerts if users violate these rules. For instance, if users (the computers that are
being monitored by the project) try to access an IP that has been blacklisted by the network
administrator, then an alert is generated for the network-administrator. Then the network
admin may opt to grant or restrict users’ access to that particular IP/website. It is important
to note that, network administrator chooses between a time-range to grant/revoke the access.
For example, the restriction may be time-based to control the access for a certain period of
time. Moreover, these restrictions may also be a set of either incoming or outgoing network
traffic. For example, the internal users may be allowed to access an external network, but the
external network may be restricted from passing any data to the users within the network that
is being protected by the IDS/IPS.