Abnormal IP address detection method and device

By analyzing the number of SSH login attempts and the number of destination IP addresses in the SSH log, and using preset thresholds to determine abnormal IP addresses, the problem of low efficiency and poor accuracy in detecting illegal cracking behaviors in the existing technology is solved, and the detection of illegal cracking behaviors is realized. Real-time, comprehensive and accurate detection.

CN118740484AActive Publication Date: 2024-10-01CHINA TELECOM CORP LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410986856.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-01
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The existing technology has low efficiency and poor accuracy in detecting abnormal IP addresses with illegal cracking behaviors, and it is difficult to quickly and accurately identify the source IP addresses with illegal cracking behaviors.

Method used

By obtaining SSH logs, we analyze the number of SSH login attempts and the number of destination IP addresses of the source IP address in different time periods, and use preset thresholds to determine abnormal IP addresses based on SSH connection frequency and distribution statistical characteristics to achieve real-time and accurate analysis of illegal cracking behaviors. Comprehensive and accurate detection.

Benefits of technology

It improves the efficiency and accuracy of illegal cracking behavior detection, and can identify abnormal IP addresses that are at risk of illegal cracking in real time, comprehensively and accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740484A_ABST
    Figure CN118740484A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal IP address detection method and device. The method comprises the following steps: acquiring a first SSH log; analyzing the first SSH log to obtain a first number of times that each first source IP address performs SSH login attempts in a plurality of first sub-time periods and a first number of first destination IP addresses that each first source IP address performs SSH login attempts in a plurality of second sub-time periods; and determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with an illegal cracking behavior or not according to a size relationship between a plurality of first times of each first source IP address and a first preset threshold value and a size relationship between a plurality of first numbers of each first source IP address and a second preset threshold value. According to the method and the device, the technical problems of low efficiency and poor accuracy of analyzing the abnormal IP address with the illegal cracking behavior in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security, and more specifically, to a method and device for detecting abnormal IP addresses. Background Art

[0002] With the rapid development of mobile Internet, more and more people choose to use SSH (Secure Shell) protocol to remotely connect to manage resources and data in cloud services, smart devices, computers and other systems. Although this brings convenience to users, it is also accompanied by a series of potential threats, especially illegal personnel using illegal cracking methods to steal user information or remotely control user devices.

[0003] The so-called illegal cracking behavior is an illegal behavior method of iterative trial and error, which attempts to crack passwords, user names, discover hidden pages or crack encrypted information keys by splicing probability. Although it takes different cracking times depending on the number and complexity of passwords, it is still widely used due to its advantages of low technical difficulty and difficulty to be discovered. Therefore, there is an urgent need for a method for quickly and accurately detecting the source IP address of illegal cracking behavior. Summary of the invention

[0004] The embodiments of the present application provide a method and device for detecting abnormal IP addresses, so as to at least solve the technical problems of low efficiency and poor accuracy in analyzing abnormal IP addresses with illegal cracking behaviors in related technologies.

[0005] According to one aspect of an embodiment of the present application, a method for detecting an abnormal IP address is provided, including: obtaining a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; analyzing the first SSH log to obtain a first number of SSH login attempts made by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between multiple first numbers of each first source IP address and a first preset threshold and a size relationship between multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are determined based on SSH connection frequency statistical features corresponding to a second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and SSH connection distribution statistical features corresponding to a second number of second destination IP addresses made by each second source IP address for SSH login attempts, respectively.

[0006] Optionally, obtaining the first SSH log includes: obtaining the first SSH log by viewing a system log file or using a system log service.

[0007] Optionally, before determining whether the first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior, the method also includes: obtaining multiple second SSH logs, wherein the second SSH log is used to record process information of at least one second source IP address attempting to log in to multiple second destination IP addresses through the SSH protocol within a second time period; for each second SSH log, analyzing the second SSH log to obtain a second number of SSH login attempts made by each second source IP address within the first sub-time period and a second number of second destination IP addresses made by each second source IP address within each second sub-time period; determining an SSH connection frequency statistical indicator based on the second number of SSH login attempts made by the multiple second source IP addresses recorded in each second SSH log within the first sub-time period, and determining an SSH connection distribution statistical indicator based on the second number of second destination IP addresses made by the multiple second source IP addresses recorded in each second SSH log within the second sub-time period; determining a first preset threshold based on the SSH connection frequency statistical indicator, and determining a second preset threshold based on the SSH connection distribution statistical indicator.

[0008] Optionally, the SSH connection frequency statistical indicator includes at least: an average value of the number of connections, a standard deviation of the number of connections, and the SSH connection distribution statistical indicator includes at least: an average value of the number of addresses, a standard deviation of the number of addresses, wherein determining the first preset threshold based on the SSH connection frequency statistical indicator includes: taking the sum of the average value of the number of connections and a preset multiple of the standard deviation of the number of connections as the first preset threshold; determining the second preset threshold based on the SSH connection distribution statistical indicator includes: taking the sum of the average value of the number of addresses and a preset multiple of the standard deviation of the number of addresses as the second preset threshold.

[0009] Optionally, based on the size relationship between multiple first numbers of each first source IP address and a first preset threshold and the size relationship between multiple first quantities of each first source IP address and a second preset threshold, determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior, includes: for each first source IP address recorded in the first SSH log, judging whether the first number of SSH login attempts made by the first source IP address in a first sub-time period is greater than the first preset threshold; if the first number of SSH login attempts made by the first source IP address in a second target time period is greater than the first preset threshold, continuing to judge whether the second number of first destination IP addresses made by the first source IP address in the second sub-time period with SSH login attempts is less than the second preset threshold; if the first number of first destination IP addresses made by the first source IP address in a third target time period with SSH login attempts is less than the second preset threshold, determining that the first source IP address is an abnormal IP address with illegal cracking behavior.

[0010] Optionally, the method also includes: determining that the first source IP address recorded in the first SSH log is a normal IP address when a first number of SSH login attempts made by the first source IP address within the second target time period is not greater than a first preset threshold, and / or a first number of first destination IP addresses made by the first source IP address within the third target time period is not less than a second preset threshold.

[0011] Optionally, after determining that the first source IP address is an abnormal IP address with illegal cracking behavior, the method further includes: deduplicating multiple abnormal IP addresses with illegal cracking behavior to obtain a target abnormal IP address with illegal cracking behavior in the first SSH log.

[0012] According to another aspect of an embodiment of the present application, an abnormal IP address detection device is also provided, including: an acquisition module, used to acquire a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; an analysis module, used to analyze the first SSH log to obtain a first number of SSH login attempts by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; an abnormality detection module, used to determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between multiple first numbers of each first source IP address and a first preset threshold and a size relationship between multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are respectively determined based on a statistical feature of an SSH connection frequency corresponding to a second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and a statistical feature of an SSH connection distribution corresponding to a second number of second destination IP addresses by each second source IP address for SSH login attempts.

[0013] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned abnormal IP address detection method by running the computer program.

[0014] According to another aspect of an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein the computer program implements the above-mentioned abnormal IP address detection method when executed by a processor.

[0015] In an embodiment of the present application, the detection system considers the characteristics of illegal cracking behavior (more frequent SSH login attempts and fewer connected destination IP addresses), parses and counts the acquired first SSH log to obtain the first number of SSH login attempts made by each first source IP address recorded in the first SSH log within multiple first sub-time periods and the first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods; then, the multiple first numbers of each first source IP address obtained are compared with the first preset threshold, and the multiple first numbers of each first source IP address are compared with the second preset threshold to determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with an illegal cracking risk. Among them, the first preset threshold and the second preset threshold are determined according to the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses for SSH login attempts by each second source IP address, thereby realizing real-time, comprehensive and accurate detection of illegal cracking behaviors, and further solving the technical problems of low efficiency and poor accuracy of related technical analysis of abnormal IP addresses with illegal cracking behaviors. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing an abnormal IP address detection method according to an embodiment of the present application;

[0018] Figure 2 It is a flowchart of an optional abnormal IP address detection method according to an embodiment of the present application;

[0019] Figure 3 is a schematic structural diagram of an optional abnormal IP address detection device according to an embodiment of the present application;

[0020] Figure 4 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0024] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:

[0025] SSH (Secure Shell) is a network security protocol that provides secure network services in an insecure network environment by limiting secure access and file transfer through encryption and authentication mechanisms.

[0026] SSH login attempt: refers to the process of trying to connect to a remote server or computer through the SSH protocol, which usually includes the following steps: client initiates connection (user uses SSH client software to try to connect to the specified server IP address and port), server response (SSH daemon on the server receives the connection request and prepares for authentication), authentication process (user provides credentials to verify his identity, usually including username and password combination), login attempt (if the credentials provided by the user are correct, the server will allow the user to log in; if the credentials provided by the user are incorrect, the server will reject the login attempt and record the failed login attempt), log (regardless of whether the login attempt is successful or not, the SSH server will usually record detailed information of the attempt in the log file, including time, source IP address, username used, destination IP address, etc.), session establishment (once the user successfully logs in, SSH will establish an encrypted session, and the user can execute remote commands or management tasks through this session), and exit the session (after the user completes the operation, he can actively exit the SSH session, or the server may automatically disconnect the session after a period of inactivity).

[0027] Example 1

[0028] According to an embodiment of the present application, a method embodiment of an abnormal IP address detection method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing an abnormal IP address detection method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0030] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0031] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the abnormal IP address detection method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the abnormal IP address detection method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0032] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0033] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0034] In the above operating environment, Figure 2 is a flow chart of an optional abnormal IP address detection method according to an embodiment of the present application, such as Figure 2As shown, the method at least includes steps S202-S206, wherein:

[0035] Step S202: Obtain a first SSH log.

[0036] In the technical solution provided in step S202, when the user remotely connects to the server (i.e., the first destination IP address) through the SSH protocol on the client (i.e., the first source IP address), the system often records the process information of the source IP address connecting to the destination IP address through SSH to obtain the SSH log. Therefore, in order to detect whether there is an abnormal IP address with illegal cracking behavior in the first time period (which can be understood as the time period to be detected), the detection system can first obtain the first SSH log in the first time period.

[0037] It should be noted that the first SSH log may record process information of a single first source IP address connecting to multiple first destination IP addresses via SSH, or may record process information of multiple first source IP addresses connecting to multiple first destination IP addresses via SSH.

[0038] Step S204: Analyze the first SSH log to obtain a first number of SSH login attempts made by each first source IP address in multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address in multiple second sub-time periods.

[0039] In the technical solution provided in step S204, illegal cracking behavior usually involves using some illegal cracking software to make a large number of login attempts on a single or several login pages or login interfaces intended to be attacked, and the operation can be stopped only after the cracking is successful. Therefore, compared with normal connection behavior, illegal cracking behavior will use different user name and password combinations to make multiple login attempts in a short period of time, so the number of login attempts is more frequent (especially when there are failed attempts); at the same time, the same source IP address will attempt to log in to different destination IP addresses multiple times within a specific time period, so the number of destination IP addresses attempted to log in is smaller. Based on the above characteristics, the detection system of the present application can analyze the first SSH log to obtain a feature value for detecting whether the source IP address is an abnormal IP address.

[0040] Specifically, the detection system may first parse the first SSH log to obtain record information recorded in the log including fields such as the first source IP address (Src Address), the first destination IP address (Dst Address), and time (Time) (i.e., process information of the first destination IP address connected to by the user through SSH at a certain moment through the first source IP address). Then, the log is grouped according to the first source IP address, and the first number of SSH login attempts made by the first source IP address in multiple first sub-time periods and the first number of first destination IP addresses made by the first source IP address in multiple second sub-time periods are counted. For example, the detection system may count the first number of SSH login attempts made by each first source IP address every five minutes and the first number of first destination IP addresses made by each first source IP address every day.

[0041] Step S206, determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on the relationship between the multiple first numbers of each first source IP address and the first preset threshold and the relationship between the multiple first quantities of each first source IP address and the second preset threshold.

[0042] In the technical solution provided in step S206, the detection system can determine the first preset threshold and the second preset threshold based on the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses for SSH login attempts by each second source IP address. Then, the first number of times counted in the above step S204 is compared with the first preset threshold, and the first number is compared with the second preset threshold, respectively, and by judging the size relationship between the two, it is detected whether the first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior.

[0043] It should be noted that, in order to ensure the validity of data comparison, the time range corresponding to the second number of SSH login attempts by multiple second source IP addresses can be made the same as the time range corresponding to the multiple first numbers of the first source IP address, and the time range corresponding to the second number of second destination IP addresses determined by the second source IP address for SSH login attempts can be made the same as the time range corresponding to the multiple first numbers of the first source IP address. In addition, in some cases, when the data collection range is different, some statistical methods (such as standardization, normalization, covariate adjustment, etc.) can also be used to adjust the data for comparative analysis to reduce the impact caused by the range difference.

[0044] The above method of this embodiment is further introduced below.

[0045] As an optional implementation, in the technical solution provided in the above step S202, the method for obtaining the first SSH log may include: viewing a system log file and using a system log service, wherein:

[0046] (1) Check the / var / log / secure file. The / var / log / secure file is the main storage location for SSH logs. It records detailed information about all SSH connections, including time, IP, user name, password, authentication method, and whether authentication is successful. Therefore, you can learn about the status of SSH connections by checking the / var / log / secure file.

[0047] (2) Use the system log system to view the SSH system log. For example, Journald is a Linux system log system that can centrally manage, store, and view system logs. Therefore, you can view the SSH log through Journald.

[0048] (3) Use the system log daemon to view the SSH log. For example, rsylogd is a Linux system log daemon that can send system logs to a remote server or redirect them to other files. You can also use rsylogd to view SSH logs.

[0049] As an optional implementation, in the technical solution provided in the above step S206, the detection system can construct statistical features by analyzing the SSH logs, and perform data analysis on the statistical features, and combine the SSH connection behavior pattern and the abnormal cracking principle to obtain a threshold for distinguishing illegal cracking behavior from normal connection behavior. Therefore, the detection system sets the first preset threshold and the second preset threshold in the following manner, including:

[0050] Step 1: Obtain the second SSH logs within multiple second time periods.

[0051] Specifically, the detection system can also obtain the second SSH logs in multiple second time periods by viewing the system log file or using the system log service, for example, obtaining the second SSH logs in five consecutive single months.

[0052] Step 2: For each second SSH log, analyze the second SSH log to obtain a second number of SSH login attempts made by each second source IP address in the first sub-time period and a second number of second destination IP addresses made by each second source IP address in each second sub-time period.

[0053] Specifically, the detection system parses multiple second SSH logs to obtain record information including the second source IP address (Src Address), the second destination IP address (Dst_Address), the time (Time) and other fields recorded in each log (that is, the process information of the user connecting to the second destination IP address through SSH at a certain moment through the second source IP address). Then, the second source IP address is grouped and the second number of SSH login attempts made by the second source IP address in multiple first sub-time periods is counted (recorded as Connect-count i , which can be understood as the number of SSH connections per unit time), and the second number of second destination IP addresses (referred to as Dst IP-number) of SSH login attempts made by the second source IP address in multiple second sub-time periods i ).

[0054] Step 3: determining an SSH connection frequency statistical index according to a second number of SSH login attempts made by the multiple second source IP addresses recorded in each second SSH log within the first sub-time period, and determining an SSH connection distribution statistical index according to a second number of second destination IP addresses that make SSH login attempts by the multiple second source IP addresses recorded in each second SSH log within the second sub-time period;

[0055] Specifically, the third step can be understood as analyzing the Connect-count values ​​obtained from each second SSH log obtained in the second step. i 、Dst IP-number i The data are sorted in order of size, and statistical indicators are calculated by using calculators, spreadsheet software (such as Microsoft Excel, Google Sheets), statistical software (such as SPSS, Python's NumPy library) and other tools, wherein the calculated statistical indicators include at least: mean (mean value of data) and standard deviation (square root of variance, used to indicate the degree of data dispersion). Therefore, the SSH connection frequency statistical indicators determined by the above method include at least: mean number of connections and standard deviation of connection times, and the SSH connection distribution statistical indicators include at least: mean number of addresses and standard deviation of address number.

[0056] Step 4: Determine a first preset threshold based on the SSH connection frequency statistical indicator, and determine a second preset threshold based on the SSH connection distribution statistical indicator.

[0057] Optionally, the detection system may use the sum of the average value of the number of connections and the standard deviation of the number of connections of a preset multiple as the first preset threshold (denoted as Count Max), and the sum of the average value of the number of addresses and the standard deviation of the number of addresses of the preset multiple is taken as the second preset threshold (denoted as Number Max ).

[0058] For example, the first preset threshold may be set to the average value of the number of connections plus two or three times the standard deviation of the number of connections. Similarly, the second preset threshold may be set to the average value of the number of addresses plus two or three times the standard deviation of the number of addresses.

[0059] As an optional implementation, in the technical solution provided in the above step S206, the detection system can perform the following judgment process on the statistical information of each first source IP address recorded in the first SSH log to detect whether the first source IP address is an abnormal IP address with illegal cracking behavior, including:

[0060] The detection system may first determine whether the first number of SSH login attempts by the first source IP address in the first sub-time period is greater than a first preset threshold, that is, determine whether the Connect-count i Is it greater than Count? Max ,in,

[0061] When the first number of SSH login attempts made by the first source IP address within the second target time period is not greater than the first preset threshold, that is, the number of SSH login attempts made by the first source IP address within a unit time is small, it can be preliminarily determined to be a normal IP address based on the illegal cracking behavior characteristics (i.e., multiple SSH login attempts are initiated from a single source IP address in a short period of time to quickly try all possible user name and password combinations);

[0062] In the case where the first number of SSH login attempts made by the first source IP address in the second target time period is greater than the first preset threshold, that is, the first source IP address makes a large number of SSH login attempts per unit time, indicating that the user has made multiple attempts to illegally crack the login at the first source IP address. In order to further accurately determine, the detection system may further determine whether the second number of the first destination IP address that the first source IP address attempts to log in through SSH in the second sub-time period is less than the second preset threshold, that is, determine whether the Dst IP-number i Is it less than Number? Max ,in,

[0063] In a case where the first number of the first destination IP addresses that the first source IP address attempts to log in to through SSH within the third target time period is not less than the second preset threshold, that is, the number of the destination IP addresses that the first source IP address attempts to log in to through SSH within the set time period is large, it can be preliminarily determined that it is a normal IP address;

[0064] When a first number of first destination IP addresses that attempt SSH logins by the first source IP address within a third target time period is less than a second preset threshold, the first source IP address is determined to be an abnormal IP address with illegal cracking behavior.

[0065] By repeatedly executing the above detection steps, the detection result of each first source IP address recorded in the first SSH log (i.e., whether it is an abnormal IP address of illegal cracking behavior) can be obtained. Since the first SSH log may record multiple connection process information of the same first source IP address, a result can be obtained by analyzing each connection process information. Therefore, in order to finally filter out all abnormal IP addresses with illegal cracking behavior in the first SSH log, the detection system can also perform deduplication processing on the detection result obtained in the above step S206, that is, multiple abnormal IP addresses with illegal cracking behavior, to obtain abnormal IP addresses with illegal cracking behavior in the first SSH log.

[0066] Based on the scheme defined in the above steps S202 to S206, it can be learned that in an embodiment, the detection system considers the characteristics of illegal cracking behavior (more frequent SSH login attempts and fewer connected destination IP addresses), and parses and counts the obtained first SSH log to obtain the first number of SSH login attempts made by each first source IP address recorded in the first SSH log within multiple first sub-time periods and the first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods; then, the multiple first numbers of each first source IP address obtained are compared with the first preset threshold, and the multiple first numbers of each first source IP address are compared with the second preset threshold to determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking risk cracking behavior. Among them, the first preset threshold and the second preset threshold are determined respectively according to the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses for SSH login attempts by each second source IP address, thereby realizing real-time, comprehensive and accurate detection of illegal cracking behavior, and further solving the technical problems of low efficiency and poor accuracy of related technical analysis of abnormal IP addresses with illegal cracking behavior.

[0067] Example 2

[0068] Based on Embodiment 1 of the present application, an embodiment of an abnormal IP address detection device is also provided, and the abnormal IP address detection method of the above embodiment is executed when the device is running. Figure 3is a schematic diagram of the structure of an optional abnormal IP address detection device according to an embodiment of the present application, such as Figure 3 As shown, the abnormal IP address detection device at least includes an acquisition module 31, an analysis module 32 and an abnormality detection module 33, wherein:

[0069] An acquisition module 31 is used to acquire a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period;

[0070] an analysis module 32, configured to analyze the first SSH log to obtain a first number of SSH login attempts made by each first source IP address in a plurality of first sub-time periods and a first number of first destination IP addresses made by each first source IP address in a plurality of second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period;

[0071] The anomaly detection module 33 is used to determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on the size relationship between multiple first numbers of each first source IP address and the first preset threshold and the size relationship between multiple first quantities of each first source IP address and the second preset threshold, wherein the first preset threshold and the second preset threshold are respectively determined based on the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses made by each second source IP address for SSH login attempts.

[0072] It should be noted that the various modules in the above-mentioned abnormal IP address detection device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.

[0073] Example 3

[0074] According to an embodiment of the present application, a non-volatile storage medium is further provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the abnormal IP address detection method in Example 1.

[0075] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; analyzing the first SSH log to obtain a first number of SSH login attempts made by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between the multiple first numbers of each first source IP address and a first preset threshold and a size relationship between the multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are determined based on SSH connection frequency statistical features corresponding to a second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and SSH connection distribution statistical features corresponding to a second number of second destination IP addresses made by each second source IP address for SSH login attempts, respectively.

[0076] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the abnormal IP address detection method in Example 1 is implemented.

[0077] Optionally, the computer program executes the following steps: obtaining a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; analyzing the first SSH log to obtain a first number of SSH login attempts made by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between the multiple first numbers of each first source IP address and a first preset threshold and a size relationship between the multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are determined based on SSH connection frequency statistical features corresponding to a second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and SSH connection distribution statistical features corresponding to a second number of second destination IP addresses made by each second source IP address for SSH login attempts, respectively.

[0078] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the abnormal IP address detection method in Example 1 is executed when the program is running.

[0079] Optionally, when the program is running, the following steps are executed: obtaining a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; analyzing the first SSH log to obtain a first number of SSH login attempts made by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between the multiple first numbers of each first source IP address and a first preset threshold and a size relationship between the multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are determined based on SSH connection frequency statistical features corresponding to the second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and SSH connection distribution statistical features corresponding to the second number of second destination IP addresses made by each second source IP address for SSH login attempts, respectively.

[0080] According to an embodiment of the present application, an electronic device is also provided, wherein: Figure 4 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 4 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the abnormal IP address detection method in the above-mentioned embodiment 1 when running.

[0081] Optionally, the processor is configured to implement the following steps by executing a computer program: obtaining a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; analyzing the first SSH log to obtain a first number of SSH login attempts made by each first source IP address within multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address within multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on a size relationship between the multiple first numbers of each first source IP address and a first preset threshold and a size relationship between the multiple first numbers of each first source IP address and a second preset threshold, wherein the first preset threshold and the second preset threshold are determined based on the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts made by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses made by each second source IP address for SSH login attempts.

[0082] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0083] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0086] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0088] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for detecting abnormal IP addresses, characterized in that: include: Obtain a first secure shell (SSH) log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; Analyze the first SSH log to obtain a first number of SSH login attempts made by each first source IP address in multiple first sub-time periods and a first number of first destination IP addresses made by each first source IP address in multiple second sub-time periods, wherein the first sub-time period and the second sub-time period are both shorter than the first time period; Based on the size relationship between the multiple first numbers of each of the first source IP addresses and the first preset threshold and the size relationship between the multiple first quantities of each of the first source IP addresses and the second preset threshold, determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior, wherein the first preset threshold and the second preset threshold are respectively determined based on the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses for SSH login attempts by each second source IP address.

2. The method according to claim 1, characterized in that Get the first SSH log, including: Get the first SSH log by viewing the system log file or using the system log service.

3. The method according to claim 1, characterized in that Before determining whether the first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior, the method further includes: Acquire multiple second SSH logs, wherein the second SSH logs are used to record process information of at least one second source IP address attempting to log in to multiple second destination IP addresses through the SSH protocol within a second time period; For each of the second SSH logs, analyze the second SSH log to obtain a second number of SSH login attempts made by each of the second source IP addresses in the first sub-time period and a second number of the second destination IP addresses for which each of the second source IP addresses makes SSH login attempts in each of the second sub-time periods; Determine the SSH connection frequency statistical index according to a second number of SSH login attempts made by the multiple second source IP addresses recorded in each of the second SSH logs within a first sub-time period, and determine the SSH connection distribution statistical index according to a second number of second destination IP addresses for SSH login attempts made by the multiple second source IP addresses recorded in each of the second SSH logs within a second sub-time period; The first preset threshold is determined based on the SSH connection frequency statistical indicator, and the second preset threshold is determined based on the SSH connection distribution statistical indicator.

4. The method according to claim 3, characterized in that The SSH connection frequency statistical index includes at least: the average number of connections and the standard deviation of the number of connections; the SSH connection distribution statistical index includes at least: the average number of addresses and the standard deviation of the number of addresses, wherein: Determining the first preset threshold based on the SSH connection frequency statistical indicator includes: taking the sum of the average value of the number of connections and a preset multiple of the standard deviation of the number of connections as the first preset threshold; Determining the second preset threshold based on the SSH connection distribution statistical indicator includes: taking the sum of the average value of the number of addresses and a preset multiple of the standard deviation of the number of addresses as the second preset threshold.

5. The method according to claim 1, characterized in that Determining whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior according to a relationship between the multiple first numbers of each of the first source IP addresses and a first preset threshold and a relationship between the multiple first quantities of each of the first source IP addresses and a second preset threshold includes: For each of the first source IP addresses recorded in the first SSH log, determining whether a first number of SSH login attempts made by the first source IP address in a first sub-time period is greater than the first preset threshold; If the first number of SSH login attempts made by the first source IP address in the second target time period is greater than the first preset threshold, continue to determine whether the second number of the first destination IP address made by the first source IP address in the second sub-time period is less than the second preset threshold; When the first number of first destination IP addresses that perform SSH login attempts by the first source IP address within the third target time period is less than the second preset threshold, the first source IP address is determined to be an abnormal IP address with illegal cracking behavior.

6. The method according to claim 5, characterized in that The method further comprises: When a first number of SSH login attempts made by the first source IP address within a second target time period is not greater than the first preset threshold, and / or a first number of first destination IP addresses made by the first source IP address within a third target time period is not less than the second preset threshold, it is determined that the first source IP address recorded in the first SSH log is a normal IP address.

7. The method according to claim 5, characterized in that After determining that the first source IP address is an abnormal IP address with illegal cracking behavior, the method further includes: Deduplication processing is performed on the multiple abnormal IP addresses with illegal cracking behaviors to obtain the target abnormal IP address with illegal cracking behaviors in the first SSH log.

8. An abnormal IP address detection device, characterized in that: include: An acquisition module, configured to acquire a first SSH log, wherein the first SSH log is used to record process information of at least one first source IP address attempting to log in to multiple first destination IP addresses through the SSH protocol within a first time period; an analysis module, configured to analyze the first SSH log to obtain a first number of SSH login attempts made by each first source IP address in a plurality of first sub-time periods and a first number of first destination IP addresses made by each first source IP address in a plurality of second sub-time periods, wherein the first sub-time period and the second sub-time period are both smaller than the first time period; An anomaly detection module is used to determine whether each first source IP address recorded in the first SSH log is an abnormal IP address with illegal cracking behavior based on the size relationship between multiple first numbers of each of the first source IP addresses and a first preset threshold and the size relationship between multiple first quantities of each of the first source IP addresses and a second preset threshold, wherein the first preset threshold and the second preset threshold are respectively determined based on the SSH connection frequency statistical characteristics corresponding to the second number of SSH login attempts by multiple second source IP addresses recorded in multiple second SSH logs, and the SSH connection distribution statistical characteristics corresponding to the second number of second destination IP addresses for SSH login attempts by each second source IP address.

9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the abnormal IP address detection method described in any one of claims 1 to 7 by running the computer program.

10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the abnormal IP address detection method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Website security defense method

    CN110011977A

  • Account violent cracking behavior detection method and system and related device

    CN110798428A

  • Brute force cracking detection method, system and device and medium

    CN112688930A

  • Method and device for realizing SSH brute force attack defense through log analysis

    CN115834109A

  • Network attack detection method, device, equipment and medium

    CN117081844A