Intrusion Detection System Analysis and its implementation in Linux

Source: Internet
Author: User
Article title: Intrusion Detection System Analysis and implementation in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: Xue Jingfeng, Department of Computer Science, Beijing University of Technology, Li Zhiqiang
  
I. Intrusion detection system analysis
  
1.1 What is an intrusion detection system
  
Intrusion refers to any attempt to endanger the integrity, confidentiality, or availability of computer resources. Intrusion detection, as its name implies, is the discovery of intrusion behaviors. It passes through several
Key points are collected and analyzed to find any violations of security policies and signs of attacks on the network or system. The combination of the software and hardware used for intrusion detection is the intrusion detection system (IDS ). Unlike other security products, the intrusion detection system requires more intelligence. it must be able to analyze the data and produce useful results. A qualified intrusion detection system can greatly simplify the work of administrators and ensure secure network operation.
  
1.2 Classification of intrusion detection systems
  
IDS can be divided into host-based IDS and network-based IDS based on different data sources used for detection.
  
Host-based IDS use various audit log information (such as host logs, router logs, and firewall logs) as the detection data source. Generally, host-based IDS can monitor security records and system records in systems, events, and operating systems. When files change, IDS compares new record entries with attack tags to see if they match. If yes, the system sends an alarm to the administrator to take measures.
  
The network-based intrusion detection system uses the original network packet as the data source. Network-based IDS usually use a network adapter running in hybrid mode to monitor and analyze all communication services through the network in real time. Once an attack is detected, the IDS response module responds to the attack, such as notifying the administrator, interrupting the connection, and terminating the user.
  
1.3 intrusion detection methods
  
By studying the process and characteristics of intrusion behaviors, the intrusion detection technology enables the security system to respond to intrusion events and intrusion processes in real time. There are two detection methods: misuse intrusion detection and exception intrusion detection.
  
In misuse intrusion detection, assuming that all intrusion behaviors and methods can be expressed as a pattern or feature, all known intrusion methods can be found by matching methods. The key to misuse intrusion detection is how to express the intrusion mode and distinguish real intrusion from normal behavior. The advantage is that there are few false positives, but the limitation is that it can only discover known attacks and cannot do anything about unknown attacks.
  
In the abnormal intrusion detection, it is assumed that all intrusion behaviors are different from normal behaviors. in this way, if the track of normal system behavior is established, in theory, all system states that are different from normal tracks can be considered suspicious attempts. For example, abnormal network traffic during abnormal time is considered suspicious through traffic statistical analysis. The limitation of anomaly intrusion detection is that not all intrusions are abnormal, and the trajectory of the system is difficult to calculate and update.
  
Comparing the two detection methods, we can find that anomaly detection is difficult to quantitatively analyze. this detection method has inherent uncertainty. In contrast, Misuse Detection follows the defined pattern. it can detect audit record information by matching the pattern, but it can only detect known intrusions. Therefore, these two types of detection machines are not perfect. As for the specific detection method, there are already many intrusion detection methods, but any method has its limitations and cannot solve all the problems. Therefore, the research on intrusion detection methods is still the focus of the current research on intrusion detection.
  
II. implementation in Linux
  
Based on the research on intrusion detection technology, we designed and implemented a network-based intrusion detection system in Linux.
  
2.1 System composition
  
The system Structure 1 is shown in. The data collection module collects original network data streams from the network. after some preprocessing, the data is sent to the data analysis module for analysis, in order to determine whether there is any intrusion that violates the security policy. The analysis results are sent to the alarm module in a timely manner, and the alarm module generates alarm information to the console. You can interact with the console through the user interface. on the console, you can configure each module and receive alarm information.
  
System composition
  
2.2 function description of the system
  
The system implements the main functions of intrusion detection, including data collection, data preprocessing, intrusion analysis, and alarms. Specifically, you can complete the following functions:
  
● Capture network data packets that meet the specified conditions.
  
● Reorganize IP addresses to provide IP packet data.
  
● Reorganize the TCP stream to provide TCP stream data.
  
● Reorganize application-layer data streams to provide HTTP data streams.
  
● Implement a rule-based intrusion detection method.
  
● Submit the analysis results to the console.
  
● Accept console configuration and management.
  
The implementation of this system function is mainly reflected in the data collection module and data analysis module. The two modules are described in detail below.
  
2.3 Data Collection Module
  
Data collection is the basis of Intrusion Detection. the efficiency of intrusion detection depends largely on the reliability and correctness of the collected information. In a network-based intrusion detection system, the data collection module needs to monitor the network traffic of a certain network segment or several hosts of the protected network, after preprocessing, the status and behavior information of the network, system, user, and application activities are obtained. Data collection requires several key points in the network.
  
Specifically, the data collection module needs to listen to network packets, reorganize IP addresses, analyze TCP/UDP protocols, and analyze application layer protocol data streams. The collected data must be preprocessed before it can be submitted to the data analysis module. The data sources required by different analysis methods are different, so preprocessing is quite different. However, in general, the data analyzed by the analysis module is based on the data information of a certain network protocol layer, or some parts of the data are directly used. Therefore, in the design of the system, the data collection module not only collects data, but also performs protocol analysis on the information. Protocol analysis processes IP-based data collected on the network to obtain data based on certain protocols. This system mainly analyzes TCP/IP protocol families.
  
Network data collection is achieved through the broadcast feature of the Ethernet network. Ethernet data transmission is achieved through broadcast. However, when the system works normally, applications can only receive data packets from the host as the target host, other data packets will be discarded. To collect all the data flowing through this segment, we need to first set the NIC to the hybrid mode so that it can receive packets whose target MAC address is not its own MAC address, and then directly access the data link layer, the application filters the data to listen to all data flowing through the network card.
  
When capturing data, we use libpcap. libpcap is a group capture function library provided by the access operating system that is unrelated to the implementation. it is used to access the data link layer. The C function interface provided by this library can be used for system development that needs to capture network interface data packets. This library provides consistent programming interfaces for different platforms. on the platform where libpcap is installed, programs written using libpcap as interfaces can be freely used across platforms.
  
Libpcap captures data frames on the internet. we also need to perform protocol analysis on the data frames. the protocol analysis process is as follows: first, obtain data packets from the monitored subnet based on pre-defined filtering rules, and then process the TCP/IP stack from bottom to top, it mainly involves IP restructuring and TCP/UDP layer protocol processing, and finally analyzes the application layer protocol.
  
Protocol Analysis is available in every operating system. here, we choose the libnids function library. Libnids is developed based on libnet and libpcap. it encapsulates many general functions for developing network intrusion detection systems. The interface functions provided by libnids not only monitor all network communication and check data packets flowing through the local network, but also support reorganizing TCP data segments and processing IP segment packages. It also has good portability.
  
2.4 Data Analysis module
  
Data analysis is the core of the intrusion detection system. Various analysis methods have their own advantages and disadvantages. However, the rule-based detection method stores various intrusion methods as rules in the rule repository. Therefore, the detection efficiency can be improved on the basis of a complete rule repository, therefore, we mainly consider the rule-based detection method in the implementation of this system.
  
Rule-based detection is a misuse detection method. The intrusion detection system needs to summarize and identify the corresponding intrusion modes from previous attack and intrusion activities, and store these intrusion modes in the rule repository, then, the existing activities of the system are matched with the rules in the rule repository to determine whether there is any intrusion.
  
Each rule-based intrusion detection method requires a definite intrusion mode Library, that is, a rule repository, which stores rules that describe intrusion methods and behaviors. In our system, we use the SNORT intrusion description method. SNORT is an open-source lightweight network-based intrusion detection system. This description method is simple and easy to implement, and can describe the vast majority of intrusion behaviors. Because of its simplicity, the detection speed is faster.
  
Each rule in a rule repository is logically divided into two parts: Rule header and rule option. The rule header contains the operation, protocol, source IP address, destination IP address, network mask, and port of the rule. Rule options include alarm information and pattern information to be checked. The general format of the rule is:
  
   <规则操作> <协议> <源主机ip> <源端口> <方向操作符> <目标主机ip> <目标端口> ( <规则选项1:值1> ; <规则选项2:值2> ;...; <规则选项n:值n> ;)
  
The part before the parentheses is the rule header, and the part in the parentheses is the rule option. The phrase before the colon in the rule option section is called the option keyword. The rule option is not a required part of the rule. it is only used to define the specific characteristics for collecting specific data packets. Different parts of a rule must be satisfied at the same time before execution, which is equivalent to "and" operation. All rules in the same rule repository file are equivalent to one "or" operation.
  
The following is an example: alert tcp any-> 192.168.1.0/24 111 (content: "| 00 01 86 a5 |"; msg: "mountd access ";). This rule describes any data packets that use the TCP protocol to connect to Port 111 of any host in the network 192.168.1.0/24. if binary data 00 01 86 a5 appears, then the system sends out the warning message mountd access.
  
Rule operations describe what to do when a packet suitable for a condition is found. There are two types of operations: alert and log. If it is alert, the selected alarm method is used to generate an alarm and record this packet. if it is log, only this packet is recorded.
  
The protocol specifies the protocol currently in use. For IP addresses and ports, the keyword "any" can be used to define any IP addresses. Specify the network mask after the IP address, for example,/24 to specify a Class C network,/16 to specify a Class B network, and/32 to specify a specific host. For example, 192.168.1.0/24 specifies a range from 192.168.1.1 to 192.168.1.255.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.