Category-Based Intrusion Detection Using PCA

Existing Intrusion Detection Systems (IDS) examine all the network features to detect intrusion or misuse patterns. In feature-based intrusion detection, some selected features may found to be redundant, useless or less important than the rest. This paper proposes a category-based selection of effective parameters for intrusion detection using Principal Components Analysis (PCA). In this paper, 32 basic features from TCP/IP header, and 116 derived features from TCP dump are selected in a network traffic dataset. Attacks are categorized in four groups, Denial of Service (DoS), Remote to User attack (R2L), Remote to User attack (U2R) and Probing attack. TCP dump from DARPA 1998 dataset is used in the experiments as the selected dataset. PCA method is used to determine an optimal feature set to make the detection process faster. Experimental results show that feature reduction can improve detection rate for the category-based detection approach while maintaining the detection accuracy within an acceptable range. In this paper KNN classification method is used for the classification of the attacks. Experimental results show that feature reduction will significantly speed up the train and the testing periods for identification of the intrusion attempts.


Introduction
Intrusion Detection Systems (IDS) is designed to complement other security measures based on attack prevention (firewalls, antivirus, etc.).Amparo Alonso-Betanzos et al. [1] say that "The aim of the IDS is to inform the system administrator of any suspicious activities and to recommend specific actions to prevent or stop the intrusion".Intrusion can be defined as an attempt to gain unauthorized access to network resources [2].IDS is necessary for effective computer system protection.There are two approaches for intrusion detection, i.e. signaturebased and anomaly-based intrusion detection.In signature-based or misuse detection method, patterns of well known attacks are used to identify intrusions [3].In anomaly-based intrusion detection, network traffic is monitored and compared versus any deviation from the established normal usage patterns to determine whether the current state of the network is anomalous.An anomalous traffic can be flagged as intrusion attempt.Misuse detection uses well defined patterns known as signatures of the attacks.Anomaly-based detection builds a normal profile and anomalous traffic is detected when the deviation from the normal model reaches a preset threshold [4].
Signature-based IDSs typically require human input to create attack signatures or to determine effective models for the normal behavior [4].Feature selection ranking can be used in anomaly-based and signature-based intrusion detection systems.Feature selection is an important issue in intrusion detection.The reason for it is due to the large number of features that should be monitored for the intrusion detection purpose.Elimination of useless or less relevant features will maintain accuracy of the detection while speeding up its calculations.Therefore, any reduction in the number of features used for the detection will significantly improve the overall performance of the IDS.In cases where there are no useless features, concentrating on the most important ones is expected to improve the execution speed of an IDS.This increase in the detection speed will not affect accuracy of the detection in a significant way.
Incorrect selection of the features may not only reduce the speed of the operation but may also reduce detection accuracy [5].
This paper reports a work aimed on improving the intrusion detection time using a category-based intrusion detection model.In Figure 1, network traffic in divided into six groups, normal, DoS, R2L, U2R, Probing and Undetermined Anomalous Behavior (UAB).The main goal in a Category-Based Intrusion Detection (CBID) is to reduce the amount of data that is less important with regard to the intrusion detection and to eliminate them.
This approach has the benefit of reducing memory requirements for storage, reducing data transfer and processing time, and improving the detection rate [6].IDS has to examine a very large audit data in a short period of time.Therefore, any reduction in the volume of data may save the processing time [7].
Considering certain attack categorizes, some features in the traffic data are more relevant than the rest for intrusion detection.
Feature reduction can be performed in several ways [7][8][9][10].In this paper, the category-based approach is used to find the relevance between features extracted from the network traffic.This paper also proposes a method based on TCP/IP header parameters and derived features selected from TCP dump network traffic dataset.In the proposed approach, Principal Components Analysis (PCA) is used as a dimension reduction technique.KNN classification method is used the detection of the intrusion attempts and results are reported.

Related Works
In a reported work, Chakraborty [11] reports that the existence of irrelevant and redundant features generally affects the performance of machine learning part of the work.Chakraborty Proves that proper selection of the feature set results in better classification performance.A. H. Sung et al. [8] have demonstrated that the elimination of these unimportant and irrelevant features did not significantly reduced performance of the IDS.
Chebrolu et al. [7], report that an important advantage for combining redundant and complementary classifiers is to increase robustness, accuracy and better overall generalization.Chebrolu et al. [7] have also identified important input features in building IDS that are computationally efficient and effective.In their reported work, they have investigated performance of three feature selection algorithms, i.e.Bayesian networks (BN), Classification and Regression Trees (CART) and an ensemble of BN and CART.
Sung and Mukkamala [8], have explored SVM and Neural Networks to identify and categorize features with respect to their importance to detect specific kinds of attacks such as probing, DoS, Remote to Local (R2L), and User to Root (U2R).They have also demonstrated that elimination of these less important and irrelevant features did not reduce the performance of IDS significantly.Mukkamala et al. [12] have demonstrated that use of ensemble of classifiers gave the best accuracy for each category of attack patterns.In designing a classifier, their first step was to carefully construct different connectional models to achieve best generalization performance for the classifiers.Sung and Mukkamala [13] have analyzed data from a large network traffic since it causes a prohibitively high overhead and often becomes a major problem for the IDS.
Chebrolu et al. [7] proposed CART-BN approach, where CART performed best for Normal, Probe and U2R and the ensemble approach worked best for R2L and DoS.Meanwhile, A. Abraham et al. [14] proved that ensemble of Decision Tree was suitable for Normal, LGP for Probe, DoS and R2L and Fuzzy classifier was good for R2L attacks. A. Abraham et al. [15] demonstrated the ability of their proposed Ensemble structure in modeling light-weight distributed IDS.

Data Reduction and Feature Selection
Using PCA Principal Components Analysis (PCA) is a predominant linear dimensionality reduction technique, and it has been widely applied on datasets in many different scientific domains [16].PCA allows us to compute a linear transformation that maps data from a high dimensional space to a lower dimensional space.The first principal components have the highest contribution to the variance in the original dataset.Therefore, the rest can be disregarded with minimal loss of the information value during the dimension reduction process.Another method is to use their weights and transform data in to a new space with lower dimensions.The transformation works in the following way [17]: , , , Given a set of observations x 1 , x 2 , •••, x M are N × 1 vectors, where each observation is represented by a vector of length N. Thus, the dataset is presented by matrix Equation (1).
The mean value for each column is defined by the expected value.This is explained in Equation (2).
Once the mean value is subtracted from the data yields expression Equation (3).(3) Sampled N × N covariance matrix characterizes how data is scattered [18].
The eigenvalues of C: a basis (i.e.any vector x or actually   x x  can, can be written as a linear combination of the eigenvectors) Equation ( 5).
During the dimensionality reduction, only the terms corresponding to the K largest eigenvalues are mentioned in Equation ( 6) [19].
The linear transformation R N ⇒ R K by PCA that performs the dimensionality reduction is presented in Equation (7).
The new variables (i.e.b i 's) are uncorrelated.The covariance matrix for the b i 's is presented in Equation ( 8).
The covariance matrix represents only second order statistics among the vector values.
Let n to be the dimensionality of the data.The covariance matrix is used to calculate U T CU that is a diagonal matrix.U T CU is sorted and rearranged in the form of so that the data exhibits maximum variance in y 1 , the next largest variance in y 2 and so on, with minimum variance in y n [20,21].

K-Nearest Neighbor Algorithm (KNN)
The K-nearest neighbor (KNN) decision rule has been a ubiquitous classification tool with good scalability.Ex-perience has shown that the optimal choice of K is dependent on the data.This makes it difficult to tune the parameters for different applications.
KNN classification algorithm tries to find the K nearest neighbors of x 0 and uses a majority vote to determine the class label of x 0 .Without any prior knowledge, the KNN classifier usually applies Euclidean distances as the distance metric [22].
KNN is an example of instance-based learning, in which the training data set is stored, so that, a classification for a new unclassified record may be found simply by comparing it to the most similar records in the training set.
The most common distance function is Euclidean distance, which represents the usual manner in which humans think of distance in the real world (8): where the m attribute values of two records [23,24].

Three Way Handshake
The three-way handshake in Transmission Control Protocol (also called the three message handshake) is a method used to establish and tear down network connections.This handshaking technique is referred to as the 3-way handshake or as "SYN-SYN-ACK" (or more accurately SYN, SYN-ACK, ACK).The TCP handshaking mechanism is designed so that two computers attempting to communicate can negotiate the parameters of the network connection before beginning communication.This process is also designed so that both ends can initiate and negotiate separate connections at the same time.Below is a (very) simplified description of the TCP 3-way handshake process (Figure 2). Source sends a TCP Synchronize packet to destination;  Destination receives source's SYN;  Destination sends a Synchronize Acknowledgement packet; Synchronization and Acknowledgem entified by a bit inside the TCP header of the segment.TCP knows whether the network connection is opened, synchronized or established by using the Synchronization and Acknowledgement messages when establishing a network connection.
When the communi other 3-way communication is performed to tear down the TCP connection.This setup and teardown of a TCP connection is part of the reason why TCP qualifies to be a reliable protocol [25].

The Dataset Used in This Work
The DARPA'98 dataset was used for the train in the reported work.The dataset provides around 4 gigabytes of compressed TCP dump data [26] for 7 weeks of the network traffic [27].This dataset can be processed into about 5 millions of connection records each about 100 bytes in size.Dataset contains payload of the packets transmitted between hosts inside and outside a simulated military base.BSM1 audit data from one UNIX Solaris host for some network sessions are also provided.DARPA 1998 TCP dump dataset [28] was preprocessed and labeled using two class labels, e.g., normal and attack.

Pre-Processing
In this work 32 basic f header protocols.These features are derived from TCP, IP, UDP and ICMP packet headers without inspecting the payload.The possible candidates for this feature category includes timestamp, source port, source IP, destination port, destination IP, flag, to name a few.In another dataset 116 derived features are selected from TCP dump network traffic dataset [28].This dataset is intended to provide a wide variety of features characterizing flows.This includes simple statistics about packet length and inter-packet timings, and information derived from the transport protocol (TCP) such as SYN and ACK counts.This information is extracted using all the packets transmitted in both directions as well as on each direction individually (server → client and client → server).
Many packet statistics are derived directly by cou ckets, and packet header-sizes.A significant number of features (such as estimates of round-trip time, size of TCP segments, and the total number of retransmissions) are derived from the TCP headers.TCP trace [29] was used for this information.
Each object within data P packets between client and server.All of the features that are extracted i splayed in Appendix 1, Table A.1.Wire-shark, Editcap and TCP trace softwares are used to analyze and minimize TCP dump files and extract features [30,31].
The dataset contains 13 different types of attacks th e broadly categorized into five groups such as DoS, U2R, R2L, Probing and anomalous behavior.Goal is categorize different intrusion methods into a number of categories.This approach aims to summarize the intrusion method into a few similar approaches.Following the proposed approach, system will be able to deal with variations of the different attacks within each category.Considering the DARPA'98 dataset, there are five main categories of attacks proposed in this paper.The proposed attack categories are listed and described in the following sections.Denial of service attacks consume a large sources thus preventing legitimate users from receiving service with some minimum performance or they may prevent a computer from complying with a legitimate requests by consuming its resources [32,33].Apache2, Back, Land, Mail bomb, SYN Flood, Ping of death, Process table, Smurf, Teardrop, Udpstorm and Neptune attacks are some examples of the Dos attack.In this work Syn flood attack is used for the experiments.Therefore, Syn flood scenario will be explained in this section: Syn flood is a DoS attack in which every TCP/IP implementtation is vulnerable to it in some degree.Each half-open TCP connection made to a machine will cause the "tcpd" server to add a record to the data structure that stores information describing all pending connections (Figure 3).This data structure has a size limit and it may overflow by intentionally creating too many partially-open connections.The half-open connections data structure on the victim server system will eventually fill up.Once the data structure is full, unless the table is emptied, the system will not be able to accept any new incoming con- ents imed on generating a categorized tate dataset.In the experiments for th , so that, half-open connections will eventually expire and the victim server system will recover.However, the attacker system can simply continue sending IP-spoofed packets requesting new connections faster than the rate victim system can drop the pending connections.Christopher [35] believes that "Typical SYN flooding attacks can vary several parameters: the number of SYN packets per source address sent in a batch, the delay between successive batches, and the mode of source address allocation".

User to Roo
In this attack, an attacker starts with a user account on the system and will end in gaining root access on that system.Regular programming mistakes and environment assumption give an attacker opportunity to exploit the vulnerabilities that may lead to a root access.An example of this type of attacks include buffer overflow, Eject, Ffbconfig, Fdformat, Loadmodule, Perl, Ps, Xterm, perlmagic and ffb attacks [36].

Remote to User Attacks (R2L)
In this attack, an attacker sends packet over a network and exploits the machine's vulnerability to gain local access as a user illegally.There are different types of R2U attacks; the most common attack in this class is carried out using social engineering.Examples for these types of attacks are Dictionary, Ftp_write, Guest, Imap, Named, Phf, Sendmail, Xlock, Xsnoop, guessing password and Dict attacks [36].

Probing Attacks
Probing is a class of att network to gather information for the purpose of finding known vulnerabilities.An attacker with a map of machines and services that are available on a network can manipulate the information and look for exploits.There are different types of probing, some of them abuse the computer's legitimate features; others use social engineering techniques.This class of attacks is the most common because it requires very little technical expertise.Examples are Ipsweep, Mscan, Nmap, Saint, Satan, pingsweep and Portsweep attacks [6].

Undetermined Anomalou
There are anomalous user behaviors, such as "a becomes (i.e.behaves like) a system administrator".For example, when your computer was automatically blacklisted (blocked) by the network due to the number of abnormal activities originating from your connection, it is possible that your computer is infected with a worm and/or virus.

Misuse D
Training data from the D files" that identify the tim destination host and port, and the name of each attack [37][38][39][40].This information is used to select intrusion data for the purpose of pattern mining and feature construction, and to label each connection record with "normal" or "attack" label types.The final labeled training data is used for training the classifiers.Due to the large volume of audit data, connection records are stored in several data files.Table 1 shows 43418 basic feature samples and 20095 derived feature samples that include records from both attack and normal state categories that are selected for the analysis.These data are extracted from the fifth day of the sixth week.Sequences of normal connection records are randomly extracted to create the normal dataset.
Dictionary table is used to convert text data into numeric da

Experim
Experiments were a attacked or normal s basic features, 9459 normal connections and 33,959 attacks are included in the categorized attack and were randomly selected to create a dataset.As for the derived features, 10,413 normal connections and 9682 are included in the categorized attack and were randomly selected to create another dataset.With these dataset that included derived features, all experiments repeated again and selected some derived feature in attacks categorized.
Classes of the relevant features with their associated information value are reported in Tables 2 and 3.In ese tables, all attack categories are compared versus the normal state.As it is reported in this paper, some different features were selected from attacks categories and

Experimental Results
Eac computer network features.Afor used to compare each session known attack behavior.Table 2 for basic and Table 3 for derived features show relevant features in descending order for different attack categories.As reported in Table 2, one single feature (number 27) in normal behavior have 98.22% information value, this is maximum information.
Value in the normal dataset.Once the component number 25 is included, their total information value will rise to 98 can be said that the component number 25 does not have a significant effect in detecting the normal state.Comparing information value of the component number 25 versus threshold value for the normal state and R2L attack, normal state and R2L attack can be separated.In the derived features, six features i.e. features: 105, 99, 23, 107, 103 and 89 have 99.22% information value for the normal behavior.
As the three-way handshaking was explained in Section 5, intruder may use Syn Flag for the intrusion.The experimental resul n Flag (Appendix 1, Table A.1) have the highest  Fin flag has the highest information value.Hence, it is the most important component in the probing scenario attack and for the detection purpose.Comparing results of this experiment with TCP FIN scan scenario, intrusion attempt by probing attack can be detected.In Table 2, result of the probing attack scenario shows that the first four components are TCP flags with 70.97% of information value.
TCP scan attack, hackers scan the network to identify TCP port numbers that are listening.The TCP packets used in this scan have only their TCP FIN flag set.Results from the experiments in Table 2, for probing attacks, show that the 29th component in Table A.1 i.e.KNN classification method was implemented to show the performance of the proposed measures and to prove that feature reduction will speed up the training and the test processes for the attack identification system considerably.Table 4 shows the confusion matrix for applying the KNN classification method.In Table 5, the classification time for the experiments using all the features are compared with when only effective features are used.True positive and false positive for six classes reported.Once the detection time for the two different feature sets are compared, the result shows that using effective features, the detection time is reduced without any decline in the detection accuracy.Hence, detection time can be reduced using effective features extracted by means of the PCA.In a different experiment, all the attacks in Table 6 are categorized in an attack class and normal connections are categorized as the second category and the KNN classification method was applied.Process time in this experiment decreased as well, while the accuracy showed a small change.ethod based on Principal C o-A) for CBID is proposed and im emented to provide r with a smaller set o but h improved the detection speed.Feature selection reduced the total number of features in the dataset (32 basic features and 116 derived features).Due to the smaller search space, this reduction means that less data is needed for training the classifier.Paper reports a new CBID approach that can produce better and more accurate results in identifying the category of the attacks instead of the precise type of the attack.This result also indicates that there are analytical solutions for the feature selection that are not based on the trial and error.The possibility and feasibility of detecting intrusions based on characterization of different types of attacks such as DoS, probes, U2R and R2L attacks is an important goal in the reported work.Results of this investigation seem to be promising.
Results indicate that normal state of the network and category of the attacks can be identified using a small number of a carefully selected network features.On the other hand, it is proven that certain features have no conbution to intrusion detection.Experimental results show that dimension reduction and identification of effective network features for category-based selection can reduce the process time in an intrusion detection system while maintaining the detection accuracy within an acceptable range.

Future Work
Plan for the future work is to use different classification method from the intrusion dete the full and the reduce differences in their accuracy and speed.Also merging KDD Cup 99 features with 116 newly derived features to generate one single dataset and repeat all the experiment for the new dataset and to compare the result with the result reported in this paper.The count of all the packets with at least a byte of TCP data payload (client to server) actual_data_pkts_a_b 19 The cou client) actual_data_pkts_b_a 20 The total bytes of data seen.Note that this incl retransmissions/ window probe packets if actual _a_b udes bytes from retransmissions/ window probe packets if any actual_data_byte_b_a 22 rexm_data_pkts_b_a 24 found in the retransmitted packets (client to server) pically sent by a sender when opened up now (client to server) e typically sent by a sender when en now (server to client) zwnd_pr

Derived feature
The total bytes of data sent in the window probe packets (server to client) zwnd_probe_byte_b_a 30 nt of all the packets with at least a byte of TCP data payload (server to udes bytes from any (client to server) The total bytes of data seen Note that this incl _data_byte 21 (server to client) The count of all the packets found to be retransmissions (client to server) rexmt_data_pkts_a_b 23 The count of all the packets found to be retransmissions (server to client) The total bytes of data rexmt_data_bytes_a_b 25 The total bytes of data found in the retransmitted packets (server to client) The count of all th rexmt_data_bytes_b_a 26 e window probe packets seen (window probe packets are ty the receiver last advertised a zero receive window to see if the window has zwnd_probe_pkts_a_b 27 The count of all the window probe packets seen (window probe packets ar the receiver last advertised a zero receive window to see if the window is op obe_pkts_b_a 28 The total bytes of data sent in the window probe packets (client to server) zwnd_probe_byte_a_b 29

Continued
RTT samples of full-size segments.t size seen in the connection (client to RTT a_b The total number of full-size RTT samples, calculated from the Full-size segments are defined to be the segments of the larges server) _full_sz_smpls_ 89 The total number of full-size RTT samples, calculated from the RTT samples of full-size segments.Full-size segments are defined to be the segments of the largest size seen in the connection (server to client) RTT_full_sz_smpls_b_a 90 The minimum full-size RTT sample (client to server) RTT_full_sz_min_a_b 91 The minimum full-size RTT sample (server to client) _full_sz_min_b_a The standard deviation of full-size RTT samples (serve RTT_full_sz_stdev_b_a 98 The total number of ack packets received after losses we precisely, a post-loss ack is found to occur when an ack (acknowledgment value in the ack packet is 1 greater th one packet occurring before the packet acknowledged, packet is received after we observed a (perceived) loss The total number of ack packets received after losses post_loss_acks_a_b 99 precisely, a post-loss ack is found to occur when an a (acknowledgment value in the ack packet is 1 greater than the pack one packet occurring before the packet acknowledged, was retransm packet is received after we observed a (perceived) loss event and ar post_loss_acks_b_a 100 The count of the number of segments that were cumulatively acknowledged and not directly acknowledged (client to server) The count of the number of segments that were cumulatively acknowledged and not directly acknowledged (server to client) The total number of duplicate acknowledgments received (client to server) The total number of duplicate acknowledgments received (server to client) The total number of triple duplicate acknowledgments received (three duplicate acknowledgments acknowledging the same segment), a condition commonly used to trigger the fast-retransmit/fast-recover duplicate_acks_b_a 104 phase of TCP (client to server) The total number of triple duplic acknowledging the same segment), a condition commonly used to trigger the fast-retransmit/fa phase of TCP (server to client) triple_dupacks_b_a 106 The maximum number of retransmissions seen for any segment during the l (client to server) The maximum number of retransmissions seen for any segment during the l max_retrans_a_b 107 (server to client) The minimum time seen between any two (re)transmissions of a segment amongst all the retransmissions seen (client to server) The minimum time seen between any two (re)transmissions of a segment amongst all the retransmiss seen (server to client) min_retr_time_b_a 110 The maximum time seen between any two (re)transmissions of a segment (client to server) The maximum time seen between any two (re)transmissions of a segment (server to client) max_retr_time_b_a 112 The average time seen between any two (re)transmissions of a segment calculated from all the retransm sions (client to server) avg_retr_time_a_b 113 The average time seen between any two (re)transmissions of a segment calculated from all the retransmissions (server to client) The standard deviation avg_retr_time_b_a 114 server) The standard deviation client) sdv_retr_time_b_a 116

Figure 1 .
Figure 1.Category-based separation of the network traffic.

Figure 5 .
Figure 5.A comparison between the information value of different features in different states of the network operation (derived features).

Figure 6 .
Figure 6.Comparison between Scree graphs for the different calculated PCA coefficients (basic features).

Figure 7 .
Figure 7.Comparison between Scree graphs for the different calculated PCA coefficients (derived features).
RTT_full_sz_max_a_b 93 rage full-size RTT sample (client to server) RTT_full_sz_avg_a_b 95 dard deviation of full-size RTT samples (client to server) RTT_full_sz_stdev_a_b 97 r to client) re detected and a retransmission occurred.More packet acknowledges a packet sent an the packet's last sequence number), and at least was retransmitted later.In other words, the ack event and are recovering from it (client to server) were detected and a retransmission occurred.More ck packet acknowledges a packet sent et's last sequence number), and at least itted later.In other words, the ack e recovering from it (server to client) time samples obtained from all the retransmissions (client to sdv_retr_time_a_b 115 of the retransmission time samples obtained from all the retransmissions (server to RTT 92 The maximum full-size RTT sample (client to server) The maximum full-size RTT sample (server to client) The ave RTT_full_sz_max_b_a 94 The average full-size RTT sample (server to client) The stan RTT_full_sz_avg_b_a 96

A comparison between the information value of different features in different states of the network operation (basic features).
presented in Figures 4 and .The Scree graph for the h attack has a different consequence and effect on ementioned features are against a normal or a.84% of the total information value.Therefore, it t shows that component number 28 i.e.