WO2021189257A1 - Malicious process detection method and apparatus, electronic device, and storage medium - Google Patents

Malicious process detection method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2021189257A1
WO2021189257A1 PCT/CN2020/080922 CN2020080922W WO2021189257A1 WO 2021189257 A1 WO2021189257 A1 WO 2021189257A1 CN 2020080922 W CN2020080922 W CN 2020080922W WO 2021189257 A1 WO2021189257 A1 WO 2021189257A1
Authority
WO
WIPO (PCT)
Prior art keywords
candidate
socket
system call
target
processes
Prior art date
Application number
PCT/CN2020/080922
Other languages
French (fr)
Chinese (zh)
Inventor
郭子亮
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN202080094694.3A priority Critical patent/CN115023699A/en
Priority to PCT/CN2020/080922 priority patent/WO2021189257A1/en
Publication of WO2021189257A1 publication Critical patent/WO2021189257A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow

Definitions

  • This application relates to the field of network security technology, and more specifically, to a method, device, electronic device, and storage medium for detecting malicious processes.
  • the firewall usually has strict restrictions on the access of external machines to the machine, but there are few restrictions on the machine's active connection to the external machine. Therefore, if the hacker uses the rebound connection, even if the machine actively connects to the external machine, it can well evade the firewall. Supervise to attack the machine and threaten the safety of the machine. Therefore, in order to improve network security, it is necessary to detect malicious processes with bounced connections in the host, but it is currently impossible to achieve effective detection of such malicious processes.
  • This application proposes a malicious process detection method, device, electronic equipment, and computer readable storage medium to improve the above-mentioned defects.
  • an embodiment of the present application provides a method for detecting a malicious process.
  • the method includes: obtaining a target process requesting a network connection; obtaining a system call operation of the target process; if the system call operation is related to the target system The invocation operation matches, and it is determined that the target process is a malicious process.
  • an embodiment of the present application also provides a device for detecting malicious processes.
  • the device includes: a process acquisition module for acquiring a target process requesting a network connection; an operation acquiring module for acquiring information about the target process System call operation; an operation matching module for determining that the target process is a malicious process if the system call operation matches the target system call operation.
  • an embodiment of the present application also provides an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the one or more processors, and the one or more programs are configured to execute the foregoing method.
  • the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores program code, and the program code can be invoked by a processor to execute the foregoing method.
  • the malicious process detection method, device, electronic equipment, and computer readable storage medium provided by this application obtain the target process requesting network connection, and then obtain the system call operation of the target process, and perform the system call operation and the target system call operation Match and determine that the target process is a malicious process.
  • the embodiment of the present application first selects the target process according to whether the process requests an external network connection, and then determines the target process matching the target system call operation according to whether the system call operation of the target process matches the target system call operation It is a malicious process, so that it can detect not only the malicious process established by the system's own command interpreter, but also the malicious process that is not established according to the system rules, thereby greatly reducing the rate of false negatives of malicious processes and improving malicious processes The report rate is higher to achieve more effective detection.
  • Figure 1 shows a schematic diagram of a socket-based communication process
  • FIG. 2 shows a schematic diagram of an application scenario of a malicious process detection method provided by an embodiment of the present application
  • FIG. 3 shows a schematic flowchart of a method for detecting a malicious process according to an embodiment of the present application
  • FIG. 4 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application
  • FIG. 5 shows a schematic flowchart of a malicious process detection method provided by another embodiment of the present application.
  • Fig. 6 shows a schematic flowchart of step S320 in Fig. 5 in an exemplary embodiment
  • FIG. 7 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application.
  • FIG. 8 shows a schematic flowchart of step S420 in FIG. 7 in an exemplary embodiment of the present application
  • FIG. 9 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application.
  • FIG. 10 shows a schematic flowchart of step S530 in FIG. 9 in an exemplary embodiment of the present application
  • FIG. 11 shows a schematic flowchart of a method for detecting a malicious process according to yet another embodiment of the present application.
  • FIG. 12 shows a schematic flowchart of a malicious process detection method provided by an exemplary embodiment of the present application
  • FIG. 13 shows a block diagram of a module for detecting a malicious process according to an embodiment of the present application
  • FIG. 14 shows a structural block diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 15 shows a storage unit used to store or carry program code implementing the method for detecting malicious processes according to the embodiment of the present application according to an embodiment of the present application.
  • Transmission Control Protocol/Internet Protocol It is an industry standard protocol set, designed for wide area networks (WANs).
  • UDP User Data Protocol, User Datagram Protocol
  • the protocol corresponding to TCP Belongs to a kind of TCP/IP protocol family.
  • Socket is an abstraction layer of middleware that communicates between the application layer and the TCP/IP protocol suite. It is a set of interfaces. In the design mode, Socket is actually a facade mode, which hides the complex TCP/IP protocol family behind the Socket interface. For users, a set of simple interfaces is everything, allowing Socket to organize data to conform to the specified protocol. Applications that use the TCP/IP protocol usually use sockets to implement communication between network processes.
  • Socket-based communication Take TCP connection as an example to explain the socket-based communication process. Please refer to Figure 1.
  • the server initializes Socket, and then binds to the port to monitor the port ( listen), call accept to block and wait for the client to connect.
  • a client initializes a Socket
  • connects to the server and the connection is successful, then the connection between the client and the server is established.
  • the client sends a data request
  • the server receives the request and processes the request, then sends the response data to the client, the client reads the data, and finally closes the connection, and the interaction ends.
  • System call When Linux starts, it first starts the kernel.
  • the kernel is a computer program that directly manages and manages the hardware, including CPU, memory space, hard disk interface, network interface, and so on. All computer operations must be passed to the hardware through the kernel.
  • the function of the kernel is summarized as a system call, and the function of the kernel can be realized through the system call operation.
  • the system call provides a clear interface for the upper program and hides the complex structure of the kernel. A function on an operating system can be seen as the effect of a combination of system calls.
  • Shell is a command-language interpreter, with its own built-in shell command set, which is an interface program used to interact with the Linux kernel.
  • the shell provides an interface through which the user can access the services of the operating system kernel.
  • the shell communicates with various upper-layer applications, and the shell communicates with system calls.
  • Shell is both a command language and a programming language.
  • a shell script is a script program written for the shell, a program with command parsing and execution. Shell scripts can be interpreted by the shell and passed to the kernel.
  • Shell process a running process of a shell program written in accordance with the programming syntax specified by the shell.
  • shells in Linux and UNIX systems include Bourne shell (sh), (Bourne Again shell, bash), C shell (csh), and Korn shell (ksh).
  • bash is the default shell of most Linux systems.
  • these shells can also be recorded as shells that come with the system.
  • connection between the control terminal and the controlled terminal can generally be achieved through two connection methods.
  • the first connection mode can be called forward connection.
  • the control end actively connects to the port of the controlled end, and the controlled end monitors the port to realize the connection, that is, when the connection is forward, the controlled end
  • the control terminal is the client in the network concept.
  • remote desktops, web services, shells, etc. are generally implemented by forward connections.
  • the use of the first connection method may lead to problems such as the control end being unable to connect to the controlled end, continuous control of the controlled end, or failure to receive requests from the controlled end. Therefore, some attackers such as hackers, in order to break through the aforementioned restrictions to control or attack or invade the user's host, they will use the second connection method to establish a connection with the host of the attacked party, namely: the host of the attacking party is in the host of the attacked party Create a socket on the above, the attacked party actively connects to the attacker’s port, and the attacker listens to the port for connection. At this time, the attacked party acts as the client and the attacker acts as the server. Compared with the aforementioned forward connection The roles of the client and server are reversed, and this connection method can be called a bounce connection.
  • the malicious process corresponds to a program with command parsing and execution
  • the program can be called a reverse shell
  • the malicious process can be further recorded as a reverse shell process. Therefore, according to the embodiments of this application, The provided method can detect the reverse shell process.
  • Reverse shell (reverse shell) program: It is a shell based on reverse connection. The control end monitors the port, the controlled end initiates a request to the port, and transfers the input and output of its command line to the control end. Reverse shell is essentially the reversal of the roles of the client and server in the network concept.
  • hackers can create a rebound shell without using the shell that comes with the system.
  • hackers can build on a self-developed command interpreter. , Write a program with command parsing and execution, which can be used as a shell.
  • hackers can also upload a shell program or copy the system shell to another directory and use it after changing the shell name, making the shell program incompatible with the system's own shell
  • the designated naming method is not in the designated directory of the system's own shell. This type of shell program is difficult to be detected by the current detection methods, that is, the current detection method will fail to report when it is applied to detect this type of malicious process.
  • embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for detecting malicious processes, so as to reduce the false negative rate of malicious processes.
  • FIG. 2 shows a schematic diagram of an application scenario of an image recognition method provided by an embodiment of the present application.
  • the application scenario includes a communication system 10 provided by an embodiment of the present application.
  • the communication system 10 includes: a first host 100 and a second host 200.
  • the first host 100 and the second host 120 may be connected through a network.
  • the first host 100 and the second host 200 may be terminals or servers. If they are terminals, the terminals may be, but are not limited to, mobile phones, tablets, MP3 players (Moving Picture Experts Group Audio Layer III, standard audio layer for dynamic image compression). 3) MP4 (Moving Picture Experts Group Audio Layer IV, standard audio layer for dynamic image compression 4) Players, personal computers or wearable electronic devices, etc.
  • the embodiment of the present application does not limit the device type of a specific terminal. If it is a server, the server can be a traditional server or a cloud server, it can be a server, or a server cluster composed of several servers, or a cloud computing service center.
  • the first host 100 and the second host 200 may be the same device or different devices, which is not limited here.
  • the first host 100 and the second host 200 may both be terminals or servers, or one may be a terminal and the other may be a server.
  • the first host 100 can be used to represent the compromised host, that is, the host of the attacked party, and the second host 200 can be used to represent the intruding host, that is, the host of the attacker. If the second host 200 creates a socket in the first host 100, so that the first host 100 actively requests to connect to the second host 200, the process related to this process can be regarded as the malicious process described in the embodiment of the present application. At this time, the first host 100 corresponds to the client in the network concept, and the second host 200 corresponds to the server in the network concept.
  • a specific host can have a role reversal between the invaded host and the invaded host under different circumstances. That is, if at a certain moment, host A is invaded by host B, then host A can be used as The compromised host is represented by the first host 100, and the host B can be used as the intruding host, and the second host 200 is represented; and if at another moment, the host A invades the host B, at this time, the host A can be used as the intruding host.
  • the second host 200 indicates that the host B can be used as the compromised host, which is represented by the first host 100.
  • FIG. 3 shows a schematic flow chart of a method for detecting a malicious process provided by an embodiment of the present application, which can be applied to the above-mentioned first host.
  • the following will elaborate on the process shown in FIG. 3.
  • the method can include:
  • the target process is a process with external connections, that is, the compromised host under this process will request network connections from other hosts.
  • the process can request a network connection to the outside based on various communication protocols, for example, the communication protocol can be TCP, UDP communication protocol, etc., which are not limited here.
  • the process should create a socket and use the socket to send connection requests to other hosts. For example, it is necessary to call connect() to send the connection request. Therefore, the process that has called connect() can be obtained as the target process for requesting a network connection.
  • the system call operation is used to record the system calls used by the process.
  • the system call operation of a process includes the type of system call and the time when the process uses the system call, thereby obtaining the system call operation of the target process , Can determine the system call operation used by the target process.
  • the number of acquired system call operations is multiple, by acquiring multiple system call operations of the target process, the execution order of the multiple system call operations can also be determined.
  • the system call operation of the target process can be obtained through the process identification (PID) of the target process.
  • PID is a value used to uniquely identify a process.
  • the number when the number is multiple, the number can be characterized as two or more.
  • the types of processes can include but are not limited to shell processes, database processes (such as mysql), server processes (such as apache, tomcat, nginx), etc., which are not limited here. It is understandable that the system call operations of different processes are different, so the type of process can be determined through the system call operation.
  • the target system call operation may be a system call operation of a specified type of process. Therefore, by matching the system call operation of the target process with the target system call operation, it can be determined whether the system call operation of the target process conforms to The characteristics of the process of the specified type.
  • the invading host attacks the invaded host, it will use the program with command analysis execution (such as shell program) to realize the attack based on rebound connection, so this kind of program (that is, the program with command analysis execution)
  • the process of the specified type may be the process corresponding to the program with command parsing and execution
  • the target system call operation may be the system call operation used in this type of process.
  • the specified type of process may be a shell process
  • the target system call operation may be a system call operation of the shell process.
  • the number of system call operations and target system call operations can be one or more, which is not limited here.
  • the system call operation matches the target system call operation, which can be multiple system call operations types and multiple target systems.
  • the type of the call operation matches.
  • a target system call operation that matches each of the multiple system call operations can be found, and it can be determined that the system call operation matches the target system call operation, for example, If multiple system call operations are A1, A2, A3, and multiple target system call operations are A1, A3, A2, A4, A5, it can be determined that the two match.
  • the execution order of the system call operations determines the type of a process to a certain extent, it is also possible to determine whether the target process is a malicious process according to the execution order of the system call operations. That is, when the system call operation matches the target system call operation, multiple system call operations and multiple target system call operations may at least partially overlap, and the execution order of the overlapped parts is required to be consistent. Specific implementation manners can be seen in the following embodiments, which will not be repeated here.
  • the compromised host can perform related processing on the malicious process.
  • the malicious process can be terminated, and the termination can include killing the malicious process or other operations, which is not limited here, so as to prevent the malicious process from continuing to attack the host in time, so as to eliminate the threat of the malicious process in time , Protect the security of the host.
  • the compromised host can be connected to the operation and maintenance management device, and after detecting the malicious process, the compromised host can report the detection result to the operation and maintenance management device.
  • the operation and maintenance management equipment receives the reported detection result and can perform corresponding maintenance on the intruded host.
  • the operation and maintenance management device may be a server, a firewall, a network management device, and so on.
  • the operation and maintenance management equipment can generate alarm information to remind the operation and maintenance personnel or other related personnel to respond to the maintenance of the compromised host.
  • the alarm information may be voice prompts, text prompts, light-on prompts, etc., which is not limited in this embodiment.
  • the malicious process detection method first obtains the target process requesting network connection, and then obtains the system call operation of the target process, and according to the system call operation of the target process and The matching result of the target system call operation determines whether the target process is a malicious process. It can detect not only malicious processes established according to system rules, but also malicious processes not established according to system rules, which greatly reduces the false negative rate of malicious processes and improves the Report rate of malicious processes, thereby improving the security of terminal use. Specifically, it can effectively detect the processes corresponding to various reverse shell programs that do not use the shell that comes with the system, such as those generated by hacker tools such as metasploit or created by command interpreters written by hackers. Good recognition effect.
  • the embodiment of this application obtains the target process according to whether a network connection is requested first, which can improve detection. Efficiency, better detection performance.
  • a process that performs network communication based on a socket may be acquired as a candidate process, and then a process requesting an external connection is determined from the candidate process as a target process.
  • FIG. 4 shows a method for detecting a malicious process provided by another embodiment of the present application. The method may include:
  • the candidate process is a process that performs network communication based on a socket.
  • This part of the process includes both processes that request external connections based on sockets and processes that are connected by other hosts based on sockets.
  • candidate processes are not only The socket is created, and the socket is also used, for example, the socket has been used for binding (bind) or connection (connect).
  • the candidate process may also include a process that only creates a socket but does not use the socket, that is, only calls socket(), but does not call bind() or connect().
  • the process that created the socket can be searched for, and then the process can be determined as a candidate process. The specific implementation manner can be seen in the embodiments described later, and will not be repeated here.
  • S220 Determine the target process according to the candidate process.
  • the system call operation of the candidate process can be obtained to detect whether there is a connection function. For example, it can be detected whether the candidate process calls connect(). If the candidate process calls connect(), the candidate process can be determined as the request network The connected process, that is, the candidate process is determined as the target process.
  • connection event of the candidate process may also be monitored, so that when the connection event is monitored, the candidate process whose connection event is monitored is determined as the target process.
  • step S240 may be as follows: The execution sequence of the operations matches, and the target process is determined to be a malicious process.
  • the aforementioned multiple target system call operations performed sequentially can be recorded as the target system call sequence, and multiple system call operations performed sequentially by the target process are recorded as the target process system call sequence, then multiple system calls
  • the execution order of the operations matches the execution order of the multiple target system call operations, which can be recorded as the system call sequence of the target process matches the target system call sequence.
  • the system call sequence of the target process is A1, A2, A3, and the multiple target system call operations are in the order of execution.
  • A1, A3, A2, that is, the target system call sequence is A1, A3, A2, at this time, it can be determined that the system call sequence of the target process does not match the target system call sequence.
  • the system call sequence of the target process is A1, A2, A3, and the target system call sequence is A0, A1, A2, A3, A4, it can be determined that the system call sequence of the target process matches the target system call sequence.
  • the execution order of multiple target system call operations can be determined by the system call operations executed sequentially by the shell process, and thus the target process that satisfies the match can be called a shell process .
  • the sequence of multiple target system call operations may include: waiting for data on the socket, reading data, executing commands, writing data, and waiting for data on the socket . Among them, reading data is reading data on the socket, and writing data is writing data in the socket. In some embodiments, if there is a target system call sequence composed of the aforementioned multiple target system call operations in the system call sequence of the target process. The overlapped part can make the detection the most accurate, that is
  • the target system call sequence is "waiting for data on the socket, reading data, executing commands, writing data, waiting for data on the socket", it can better reflect the characteristics of the shell process, and even in some implementations For example, as long as the system call sequence of a process is consistent with the target system call sequence, the process can be determined to be a shell process. If it is inconsistent, the process is determined not to be a shell process. Therefore, based on this target system call sequence, other The non-shell process is determined to be an error detection caused by a malicious process, which improves the detection accuracy of the shell process, thereby improving the detection accuracy of the rebound shell process.
  • the target system call sequence can be in addition to the standard system call sequence
  • other target system call sequences can also be used to match the system call sequence of the target process. As an implementation mode, it can be selected when the execution order of each system call operation in the standard system call sequence remains unchanged.
  • a subset of the standard system call sequence is regarded as the target system call sequence.
  • the target system call sequence can be "read data, execute command, write data", "wait for data on socket, read data, execute command, write data" "Etc., it is not limited here.
  • the target process can be determined according to the candidate process by monitoring the connection event of the candidate process, so that subsequent matching of the target process can be performed in time, thereby improving the efficiency of the malicious process, so that the malicious process can be detected in time , which helps prevent malicious process attacks in time, and can further improve terminal security.
  • FIG. 5 shows a method for detecting a malicious process provided by another embodiment of the present application. The method may include:
  • connection event is used to request a network connection.
  • a process can request a network connection by calling connect().
  • connect() the connection event of the process can be monitored.
  • the audit function can be used to monitor the connection events of the candidate process. Audit can customize the audit of the specified files or commands. As long as the corresponding rules are configured, the configuration rules can be through the command line (temporary This can be achieved in two ways: effective) or by editing the configuration file (permanently effective), which is not limited in this embodiment.
  • connection events of candidate processes can be monitored by editing configuration files and configuring audit configuration items. If a connection event occurs, it will be written to the audit log. By auditing the audit log, the process ID corresponding to the process where the connection event occurred can be found to determine the process where the connection event occurred.
  • step S320 may include:
  • the number of candidate processes can be multiple. If the number of candidate processes is too large, the number of processes that the host needs to monitor at the same time may be too large, which may result in reduced system operation efficiency or even jamming, so it is control simultaneous. The number of monitored processes, the number of candidate processes can be obtained, and whether the number of candidate processes exceeds the specified monitoring number.
  • the designated monitoring quantity can be determined according to actual needs, can also be preset by the program, or customized by the user, which is not limited here.
  • the designated monitoring quantity can be determined by the current system operating performance.
  • the current system operating performance can be reflected by the central processing unit (CPU) occupancy rate.
  • the CPU occupancy rate can be set to the specified
  • the mapping relationship table between the monitoring quantities, the corresponding designated monitoring quantity can be determined according to the CPU occupancy rate. The higher the CPU occupancy rate, the lower the designated monitoring number corresponding to the CPU occupancy rate. This can be used when the CPU occupancy rate is high. Reduce the number of monitoring, because too many processes are being monitored at the same time, resulting in reduced operating efficiency and even stuck.
  • the CPU occupancy rate can be a specified value or a range of values, which is not limited here.
  • the designated monitoring quantity can also be determined according to other parameters that can reflect the operating performance of the system, such as memory occupancy, which is not limited in this embodiment.
  • the candidate processes to be monitored are determined from the candidate processes, where the number of candidate processes to be monitored is less than the number of candidate processes, which can be reduced by subsequently monitoring only the connection events of the candidate processes to be monitored The number of processes monitored at the same time.
  • the number of candidate processes to be monitored can be less than or equal to the specified monitoring number, and when the number of candidate processes exceeds the specified monitoring number, the number of candidate processes to be monitored at the same time can be reduced to no more than the specified monitoring number.
  • the preset poetry selection rule can be based on the time when the connection event occurs. Specifically, the candidate process Monitoring is performed to monitor the connection event at an early time, and monitor the connection event at a later time. The details are not repeated here.
  • step S323 is substantially the same as the foregoing step S320, and will not be repeated here.
  • connection events of the candidate process can be monitored by configuring the audit (audit) configuration item. If a connection event occurs, it will be written to the audit log. By auditing the audit log, the candidate process corresponding to the connection event can be obtained Process IDs to further obtain candidate processes corresponding to these process IDs as target processes. Therefore, the target process that actively requests the network connection is obtained from the candidate process.
  • FIG. 7 shows a method for detecting a malicious process provided by still another embodiment of the present application. The method may include:
  • the first process is a process that creates a socket, that is, a process that creates a socket, and may include a process that uses a socket and a process that does not use a socket.
  • the process information of all processes may be acquired first, and then the process corresponding to the process information containing socket-related information is determined as the first process according to whether the process information contains socket-related information. Then the process information of the first process includes socket-related information.
  • the process that created the socket can be directly found as the first process.
  • the command lsof-i can be used.
  • the -i option of lsof can be used to list all processes that have created a socket.
  • the listed information includes the process ID of the process and the corresponding socket created If the socket index is specified, the process corresponding to the process identifier listed in the lsof-i command can be used as the first process, so that the first process can be found.
  • the socket index is used to uniquely identify a socket.
  • the socket index may be the index node (inode) of the socket.
  • other commands may also be used to directly search for the first process, which is not limited in this embodiment.
  • the first process can be directly used as a candidate process.
  • all processes that have created sockets are determined as candidate processes.
  • the candidate process is determined, when the target process is determined according to the candidate process, the part of the process that only created the socket but is not used can be filtered out by detecting connect(). Even if this part of the process is not filtered out, it is still determined as When the target process is the target process, this part of the process can also be filtered out when the subsequent system call operation matches. Therefore, the first process is directly used as the candidate process to realize the detection of the malicious process.
  • the process that created the socket can be directly determined as a candidate process
  • the target process is subsequently determined from the candidate processes, or when the matching is performed according to the system call operation, the part of the process that only creates but does not use the socket can still be filtered out, so that it can still effectively detect that not only the socket is created but also used, and Specifically, it is a malicious process that uses sockets to request external connections. Therefore, in some possible embodiments, the first process can be directly determined as a candidate process, and the malicious process can still be detected at this time.
  • step S420 may include:
  • S421 Detect whether the number of first processes exceeds a specified threshold.
  • the specified threshold may be determined according to actual needs, may also be preset by the system, or may be user-defined, which is not limited in this embodiment. In some embodiments, the specified threshold may be determined by the CPU usage rate. As the CPU usage rate increases, the specified threshold value may be reduced, so that the specified threshold value can be adjusted according to the current system operating efficiency to control the number of first processes.
  • the specified threshold is greater than or equal to the specified monitoring quantity, so that the number of the first process can be controlled first before the subsequent control of the number of candidate processes monitored at the same time based on the specified monitoring quantity, so as to avoid candidates determined by the first process The number of processes is too large, which reduces the efficiency of the system.
  • step S422 it is detected whether the number of first processes exceeds a specified threshold. If the number of first processes exceeds the specified threshold, step S422 may be executed. If the number of first processes does not exceed the specified threshold, the first process may be directly used as For the candidate process, the specific implementation can be seen in step S420, which will not be repeated here. As a result, when the number of the first processes does not exceed the specified threshold, that is, when there are fewer processes that have created sockets, the first process can be directly used as a candidate process for subsequent detection, reducing operation steps, thereby helping to improve detection efficiency.
  • the specific implementation manner of determining the candidate process from the first process may be: from the first process, find the process that performs network communication based on the socket as a candidate process. The details can be seen in the following embodiments, which will not be repeated here.
  • the process using the socket may be found from the first process, and then these processes are determined as candidate processes.
  • FIG. 9 shows a method for detecting a malicious process according to another embodiment of the present application. The method may include:
  • the process information is used to record the files opened by the process, and may include the process identifier and at least one file descriptor (file descriptor, fd) information, and each file descriptor information may include: file descriptors 0, 1, 2,... ...And object properties.
  • each file descriptor has a corresponding relationship with an object attribute, and the object attribute may include an object type and an object identifier.
  • the object type may include socket, pipe, etc.
  • the object identifier may include socket index, pipe index (pipe ID or pipe inode), etc.
  • the object type may be a socket
  • the object identifier may be the socket index corresponding to the socket
  • the process information of the process may include the socket Logo.
  • the socket identifier may be the field "socket".
  • the process information may also include the socket index corresponding to the socket identifier.
  • the socket index can be a number after "socket", that is, if a process creates a socket, its process information can include “socket: [435473]", where "435473” is the socket socket created by the process Connector index.
  • the process information corresponding to all processes can be obtained through the command ls-la/proc/pid/fd.
  • all the information of all processes in the Linux system are stored in the /proc directory.
  • S520 Acquire a process including the socket identifier in the process information as the first process.
  • the process information of the process may include the socket identifier, so the process that contains the socket identifier in the process information can be obtained as the first process, that is, the socket is created Word process.
  • the first process can only be a name for a process, and the process information of this process contains the socket identifier, that is, the host does not have to perform the operation of obtaining the first process, but can just obtain the process information of all processes. If the socket identification and the process identification exist in the process information, the process containing the socket identification in the process information can be named the first process, and the process identification of the process can be recorded as the process identification of the first process.
  • S530 From the first process, search for a process that performs network communication based on a socket, as a candidate process.
  • step S530 may include:
  • S531 Acquire a first socket index corresponding to a socket used to establish a network link for network communication.
  • sockets used to establish network links for network communication are used sockets, that is, sockets that are only created but not used are not included.
  • this type of socket binds a port through bind(), or sends a connection request through connect(). Therefore, by obtaining the socket index of this type of socket as the first socket index, it can be used to filter out the first process that has established a socket but is not used, so that the candidate process is determined from the first process Processes that only created sockets but are not used are not included.
  • the command cat/proc/net/tcp can be used to obtain the socket used to establish a network link for network communication.
  • the /proc/net/tcp directory contains not only the creation of the socket but also the Using the socket information of the socket, the socket information contains the socket index of the socket, and the socket index corresponding to the socket used to establish a network link for network communication can be recorded as the first socket index.
  • S532 Obtain a second socket index corresponding to the socket created by the first process.
  • the process information of all processes can be obtained, and the process that contains the socket identifier in the process information is obtained as the first process, and the process information of the first process also includes the corresponding socket identifier. Therefore, based on the process information of all processes, the socket index corresponding to the socket created by the first process can be obtained as the second socket index.
  • the process information contains the process ID, namely the pid, the socket ID, and the socket index
  • the socket corresponding to the socket ID in the process information may have only been created but not used, so the second The socket index is matched with the first socket index to determine a candidate process that uses the socket from the first process.
  • the first socket index is matched with the second socket index, and a process that performs network communication based on the socket is obtained as a candidate process.
  • the socket corresponding to the first socket index is a socket that is not only created but also used
  • the socket corresponding to the second socket index is a socket created but not necessarily used Socket, so in order to get candidate processes that have used sockets, the first socket index can be matched with the second socket index, and the second socket that matches the first socket index
  • the process corresponding to the word index is used as a candidate process.
  • the process information of all processes can be obtained by the command ls-la/proc/pid/fd, and the inode number of the socket can be obtained by the command cat/proc/net/tcp as the first socket index, and then pass Inode number Find the pid corresponding to the inode number in the process information, and determine the process corresponding to the pid as a candidate process.
  • the process information contains the socket ID process, get the process information of the first process, use the inode number corresponding to the socket ID as the second socket index, and get the socket through the command cat/proc/net/tcp
  • the inode number is used as the first socket index, the first socket index is matched with the second socket index, and the pid corresponding to the second socket index matching the first socket index is obtained, and the pid The corresponding process is determined as a candidate process.
  • FIG. 11 shows a method for detecting a malicious process according to yet another embodiment of the present application. The method may include:
  • S610 Find a process that performs network communication based on a socket, as a candidate process.
  • the process of network communication based on sockets can be found through the command netstat.
  • This command can generally be used to check the network connection of each port of the machine. . In an example, it can be found through the command netstat-tunpa.
  • the netstat command Since the information obtained through the netstat command can include the process pids that have TCP and UDP connections, the netstat command will not count sockets that are just created but not used (bind or connect), so you can directly find the sockets for network communication. Process, as a candidate process.
  • the information sent by the first host may not be received by the second host, or the information sent by the second host may not be received by the first host. If it is received, there may be a loss of information transmission, causing part of the attack command to not be received by the first host. Therefore, by first detecting the process of network communication based on the TCP communication protocol, the malicious process with a higher degree of threat can be detected first, so that it can be dealt with in a more timely manner and the security threat can be solved in a timely manner.
  • a specific implementation manner of step S610 may be: searching for a process that performs network communication based on TCP as a candidate process.
  • This method can be applied to the host, and specifically, the host runs a rebound shell detection module, and the rebound shell detection module can be used to execute the method provided in the embodiments of the present application.
  • the rebound shell detection module After the rebound shell detection module is started, it will obtain all process information by traversing the host /proc directory.
  • the process information includes the process ID (pid) and external connection information
  • the external connection information can include the socket ID and the inode number corresponding to the socket ID.
  • the way to obtain all process information can be through the command: ls-la/proc/pid/fd.
  • the inode number can be found through the command cat/proc/net/tcp, and then the process corresponding to the pid can be found through the inode number.
  • this embodiment monitors the external network connection of the process to obtain the process with external network connection, and then determines whether the process is a rebound shell process by detecting whether the system call sequence of the process conforms to the law of the system call sequence of the shell process . So it can effectively detect all kinds of reverse shell processes that do not use the shell that comes with the system, such as those generated by hacker tools such as Metasploit or command interpreters written by hackers, etc., which have a good recognition effect. Moreover, since the number of external connection events of the server is generally less than the number of creation of shell processes, the detection efficiency of the module is higher, and the detection performance will be better.
  • the malicious process detection apparatus 1300 may include: a process acquisition module 1310, an operation acquisition module 1320, and an operation matching module 1330 .
  • the process acquisition module 1310 is used to acquire the target process requesting network connection
  • the operation acquisition module 1320 is used to acquire the system call operation of the target process
  • the operation matching module 1330 is configured to determine that the target process is a malicious process if the system call operation matches the target system call operation.
  • the operation matching module 1330 includes: an order matching submodule, wherein:
  • the order matching sub-module is configured to determine that the target process is a malicious process if the execution order of the multiple system call operations matches the execution order of the multiple target system call operations.
  • the execution order of the multiple target system call operations is determined by the system call operations executed sequentially by the shell process.
  • sequence of the multiple target system call operations includes: waiting for data on the socket, reading data, executing a command, writing data, and waiting for data on the socket.
  • the process acquisition module 1310 includes: a candidate process acquisition sub-module and a target process determination sub-module, wherein:
  • Candidate process acquisition sub-module for acquiring candidate processes the candidate process being a process that performs network communication based on a socket;
  • the target process determining sub-module is configured to determine a target process according to the candidate process, and the target process is a process that requests a network connection based on a socket.
  • target process determining submodule further includes: a connection event monitoring unit and a target process acquiring unit, wherein:
  • connection event monitoring unit is used to monitor the connection event of the candidate process, and the connection event is used to request a network connection;
  • the target process obtaining unit is configured to obtain the candidate process as the target process if the connection event of the candidate process is monitored.
  • connection event monitoring unit includes: a monitoring quantity detection subunit, a process to be monitored determination subunit, and a process monitoring subunit, wherein:
  • the monitoring quantity detection subunit is used to detect whether the number of the candidate processes exceeds the specified monitoring quantity
  • the process to be monitored determination subunit is configured to determine the candidate process to be monitored from the candidate processes if the number of the candidate processes exceeds the specified monitoring number;
  • the process monitoring subunit is used to determine and monitor the connection event of the candidate process to be monitored.
  • the candidate process acquisition sub-module includes: a first process search unit and a first candidate determination unit, wherein:
  • the first process search unit is configured to search for a first process, and the first process is a process that creates a socket;
  • the first candidate determining unit is configured to determine a candidate process from the first process.
  • the first process searching unit includes: a process information acquiring subunit and a socket identification determining subunit, wherein:
  • the process information obtaining subunit is used to obtain process information corresponding to all processes, and the process information is used to record the files opened by the process;
  • the first process determining subunit is used to obtain the process containing the socket identifier in the process information as the first process.
  • the first candidate determining unit includes: a first candidate determining subunit, wherein:
  • the first candidate determination subunit is configured to search for a socket-based network communication process from the first process as a candidate process.
  • the first candidate determining subunit includes: a first index obtaining subunit, a second index obtaining subunit, and an index matching subunit, wherein:
  • the first index obtaining sub-unit is used to obtain the first socket index corresponding to the socket used to establish a network link for network communication;
  • the second index obtaining sub-unit is used to obtain the second socket index corresponding to the socket created by the first process
  • the index matching subunit is used to match the first socket index with the second socket index, and obtain a socket-based network communication process as a candidate process.
  • the first candidate determining unit includes: a second candidate determining subunit, wherein:
  • the second candidate determination subunit is used to search for a socket-based network communication process as a candidate process.
  • the candidate process acquiring submodule includes: a second candidate determining unit, wherein:
  • the second candidate determining unit is used to search for a process that performs network communication based on a socket, as a candidate process.
  • the second candidate determining unit includes: a third candidate determining subunit, wherein:
  • the third candidate determination subunit is used to find a process for network communication based on the TCP communication protocol as a candidate process.
  • the device 1300 for detecting a malicious process further includes: a process termination module, wherein:
  • the process termination module is used to perform termination processing on the malicious process.
  • the malicious process detection apparatus provided in the embodiment of the present application is used to implement the corresponding malicious process detection method in the foregoing method embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
  • the electronic device 1400 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, an e-book, a personal computer, or a server.
  • the electronic device 1400 in this application may include one or more of the following components: a processor 1410, a memory 1420, and one or more application programs, where one or more application programs may be stored in the memory 1420 and configured to be configured by One or more processors 1410 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
  • the processor 1410 may include one or more processing cores.
  • the processor 1410 uses various interfaces and lines to connect various parts of the entire electronic device 1400, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1420, and calling data stored in the memory 1420.
  • the processor 1410 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 1410 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs;
  • the GPU is used for rendering and drawing of display content;
  • the modem is used for processing wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor 1410, but may be implemented by a communication chip alone.
  • the processor 1410 further includes: an external storage device management module 1411 and a storage management service module 1414.
  • the external storage device management module 1411 may be the management and control center of the external storage system in the Android platform, and is a background process for managing and controlling the external storage device of the Android platform. Its functions mainly include: external storage device plug-in event detection, external storage device mounting, unloading, formatting, etc.; storage management service module 1414 is a module for the Android system framework layer to communicate with the external storage device management module 1411, and at the same time
  • the storage management service module 1414 is also a module that provides storage access interfaces and storage mounting message broadcasts to applications. Further, in an implementation manner, the external storage device management module 1411 and the storage management service module 1414 may communicate based on the Binder communication mechanism.
  • the memory 1420 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 1420 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 1420 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the data storage area can also store data created by the electronic device 1400 during use (such as phone book, audio and video data, chat record data) and the like.
  • each unit in the malicious process detection device shown in FIG. 13 is used as a function module such as a program package, each unit in the malicious process detection device is stored in the memory 1420 and can be called by the processor and executes the corresponding Function.
  • FIG. 15 shows a structural block diagram of a computer readable storage medium provided by an embodiment of the present application.
  • the computer readable storage medium 1500 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer readable storage medium 1500 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 1500 includes a non-transitory computer-readable storage medium.
  • the computer readable storage medium 1500 has storage space for the program code 1510 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 1510 may be compressed in an appropriate form, for example.

Abstract

Embodiments of the present application relate to the technical field of network security, and disclosed are a malicious process detection method and apparatus, an electronic device, and a storage medium. The method comprises: obtaining a target process requesting a network connection; obtaining a system call operation of the target process; and if the system call operation matches a target system call operation, determining that the target process is a malicious process. In the embodiments of the present application, the target process is first determined according to whether a network connection to the outside exists, and then, whether the target process is a malicious process is determined according to the system call operation of the target process, so that malicious processes established by a command interpreter of a system may be detected, and malicious processes that are not established according to system rules may also be detected, thereby greatly reducing the leakage rate of malicious processes and realizing more effective detection.

Description

恶意进程的检测方法、装置、电子设备及存储介质Malicious process detection method, device, electronic equipment and storage medium 技术领域Technical field
本申请涉及网络安全技术领域,更具体地,涉及一种恶意进程的检测方法、装置、电子设备及存储介质。This application relates to the field of network security technology, and more specifically, to a method, device, electronic device, and storage medium for detecting malicious processes.
背景技术Background technique
目前由于防火墙对外部机器接入本机通常有严格的限制,但对本机主动连接外部机器却限制很少,因此如果黑客采用反弹连接,即令本机主动连接外部机器,可以很好地逃避防火墙的监管,以对本机进行攻击,威胁本机安全。因此,为了提高网络安全,需要对主机中存在反弹连接的恶意进程进行检测,但目前尚且无法实现对这类恶意进程的有效检测。At present, the firewall usually has strict restrictions on the access of external machines to the machine, but there are few restrictions on the machine's active connection to the external machine. Therefore, if the hacker uses the rebound connection, even if the machine actively connects to the external machine, it can well evade the firewall. Supervise to attack the machine and threaten the safety of the machine. Therefore, in order to improve network security, it is necessary to detect malicious processes with bounced connections in the host, but it is currently impossible to achieve effective detection of such malicious processes.
发明内容Summary of the invention
本申请提出了一种恶意进程的检测方法、装置、电子设备及计算机可读取存储介质,以改善上述缺陷。This application proposes a malicious process detection method, device, electronic equipment, and computer readable storage medium to improve the above-mentioned defects.
第一方面,本申请实施例提供了一种恶意进程的检测方法,所述方法包括:获取请求网络连接的目标进程;获取所述目标进程的系统调用操作;若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程。In the first aspect, an embodiment of the present application provides a method for detecting a malicious process. The method includes: obtaining a target process requesting a network connection; obtaining a system call operation of the target process; if the system call operation is related to the target system The invocation operation matches, and it is determined that the target process is a malicious process.
第二方面,本申请实施例还提供了一种恶意进程的检测装置,所述装置包括:进程获取模块,用于获取请求网络连接的目标进程;操作获取模块,用于获取所述目标进程的系统调用操作;操作匹配模块,用于若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程。In the second aspect, an embodiment of the present application also provides a device for detecting malicious processes. The device includes: a process acquisition module for acquiring a target process requesting a network connection; an operation acquiring module for acquiring information about the target process System call operation; an operation matching module for determining that the target process is a malicious process if the system call operation matches the target system call operation.
第三方面,本申请实施例还提供了一种电子设备,包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述方法。In a third aspect, an embodiment of the present application also provides an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory And is configured to be executed by the one or more processors, and the one or more programs are configured to execute the foregoing method.
第四方面,本申请实施例还提供了一种计算机可读取存储介质,计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。In a fourth aspect, the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores program code, and the program code can be invoked by a processor to execute the foregoing method.
本申请提供的恶意进程的检测方法、装置、电子设备及计算机可读取存储介质,通过获取请求网络连接的目标进程,然后获取目标进程的系统调用操作,并在系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。由此,本申请实施例先根据进程是否请求对外的网络连接来筛选出目标进程,再根据目标进程的系统调用操作是否与目标系统调用操作匹配,来将与目标系统调用操作匹配的目标进程确定为恶意进程,从而不仅可检测出由系统自带的命令解释器所建立的恶意进程,还可检测出不按系统规则建立的恶意进程,从而大大降低对恶意进程的漏报率,提高恶意进程的上报率,实现更有效的检测。The malicious process detection method, device, electronic equipment, and computer readable storage medium provided by this application obtain the target process requesting network connection, and then obtain the system call operation of the target process, and perform the system call operation and the target system call operation Match and determine that the target process is a malicious process. Therefore, the embodiment of the present application first selects the target process according to whether the process requests an external network connection, and then determines the target process matching the target system call operation according to whether the system call operation of the target process matches the target system call operation It is a malicious process, so that it can detect not only the malicious process established by the system's own command interpreter, but also the malicious process that is not established according to the system rules, thereby greatly reducing the rate of false negatives of malicious processes and improving malicious processes The report rate is higher to achieve more effective detection.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了一种基于套接字的通信流程示意图;Figure 1 shows a schematic diagram of a socket-based communication process;
图2示出了本申请实施例提供的一种恶意进程的检测方法的应用场景示意图;FIG. 2 shows a schematic diagram of an application scenario of a malicious process detection method provided by an embodiment of the present application;
图3示出了本申请一个实施例提供的一种恶意进程的检测方法的流程示意图;FIG. 3 shows a schematic flowchart of a method for detecting a malicious process according to an embodiment of the present application;
图4示出了本申请另一个实施例提供的恶意进程的检测方法的流程示意图;FIG. 4 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application;
图5示出了本申请又一个实施例提供的恶意进程的检测方法的流程示意图;FIG. 5 shows a schematic flowchart of a malicious process detection method provided by another embodiment of the present application;
图6示出了图5中步骤S320在一个示例性实施例中的流程示意图;Fig. 6 shows a schematic flowchart of step S320 in Fig. 5 in an exemplary embodiment;
图7示出了本申请再一个实施例提供的恶意进程的检测方法的流程示意图;FIG. 7 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application;
图8示出了图7中步骤S420在本申请一个示例性实施例的流程示意图;FIG. 8 shows a schematic flowchart of step S420 in FIG. 7 in an exemplary embodiment of the present application;
图9示出了本申请还一个实施例提供的恶意进程的检测方法的流程示意图;FIG. 9 shows a schematic flowchart of a method for detecting a malicious process according to another embodiment of the present application;
图10示出了图9中步骤S530在本申请一个示例性实施例的流程示意图;FIG. 10 shows a schematic flowchart of step S530 in FIG. 9 in an exemplary embodiment of the present application;
图11示出了本申请又另一个实施例提供的恶意进程的检测方法的流程示意图;FIG. 11 shows a schematic flowchart of a method for detecting a malicious process according to yet another embodiment of the present application;
图12示出了本申请一个示例性实施例提供的恶意进程的检测方法的流程示意图;FIG. 12 shows a schematic flowchart of a malicious process detection method provided by an exemplary embodiment of the present application;
图13示出了本申请实施例提供的恶意进程的检测装置的模块框图;FIG. 13 shows a block diagram of a module for detecting a malicious process according to an embodiment of the present application;
图14示出了本申请实施例提供的电子设备的结构框图;FIG. 14 shows a structural block diagram of an electronic device provided by an embodiment of the present application;
图15示出了本申请实施例的用于保存或者携带实现根据本申请实施例的恶意进程的检测方法的程序代码的存储单元。FIG. 15 shows a storage unit used to store or carry program code implementing the method for detecting malicious processes according to the embodiment of the present application according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application.
术语定义Definition of Terms
传输控制协议/网间协议(Transmission Control Protocol/Internet Protocol,TCP/IP):是一个工业标准的协议集,为广域网(WANs)设计。Transmission Control Protocol/Internet Protocol (TCP/IP): It is an industry standard protocol set, designed for wide area networks (WANs).
UDP(User Data Protocol,用户数据报协议):与TCP相对应的协议。属于TCP/IP协议族中的一种。UDP (User Data Protocol, User Datagram Protocol): The protocol corresponding to TCP. Belongs to a kind of TCP/IP protocol family.
套接字(Socket):Socket是应用层与TCP/IP协议族通信的中间软件抽象层,它是一组接口。在设计模式中,Socket其实就是一个门面模式,它把复杂的TCP/IP协议族隐藏在Socket接口后面,对用户来说,一组简单的接口就是全部,让Socket去组织数据,以符合指定的协议。使用TCP/IP协议的应用程序通常采用套接字来实现网络进程之间的通信。Socket (Socket): Socket is an abstraction layer of middleware that communicates between the application layer and the TCP/IP protocol suite. It is a set of interfaces. In the design mode, Socket is actually a facade mode, which hides the complex TCP/IP protocol family behind the Socket interface. For users, a set of simple interfaces is everything, allowing Socket to organize data to conform to the specified protocol. Applications that use the TCP/IP protocol usually use sockets to implement communication between network processes.
基于套接字(socket)的通信:以TCP连接为例对基于套接字的通信过程进行说明,请参阅图1,服务器端初始化Socket,然后与端口绑定(bind),对端口进行监听(listen),调用accept阻塞,等待客户端连接。在这时如果有客户端初始化了一个Socket,然后连接(connect)服务器端,并连接成功,这时客户端与服务器端的连接就建立了。客户端发送数据请求,服务器端接收请求并处理请求,然后把回应数据发送给客户端,客户端读取数据,最后关闭连接,一次交互结束。Socket-based communication: Take TCP connection as an example to explain the socket-based communication process. Please refer to Figure 1. The server initializes Socket, and then binds to the port to monitor the port ( listen), call accept to block and wait for the client to connect. At this time, if a client initializes a Socket, then connects to the server, and the connection is successful, then the connection between the client and the server is established. The client sends a data request, the server receives the request and processes the request, then sends the response data to the client, the client reads the data, and finally closes the connection, and the interaction ends.
也就是说,在服务器端与客户端之间,如果作为一个服务器端,在调用socket()创建socket、调用bind()将创建的socket与端口绑定之后,会调用listen()来监听这个socket对应的端口,即,TCP服务器端依次调用socket()、bind()、listen()之后,就会监听指定的socket地址。而客户端依次调用socket()、connect()之后将向TCP服务器端发送一个连接请求,服务器端可接收到这个请求,与客户端建立连接。具体地,服务器端监听到这个连接请求之后,可调用accept()去接收连接请求,这样连接就建立好了。之后就可以开始网络输入输出(Input/Output,I/O)操作,即类同于普通文件的读写I/O操作,实现基于套接字的数据传输。That is to say, between the server side and the client side, as a server side, after calling socket() to create a socket and calling bind() to bind the created socket to the port, listen() will be called to monitor the socket The corresponding port, that is, after the TCP server calls socket(), bind(), and listen() in turn, it will monitor the specified socket address. After the client calls socket() and connect() in turn, it will send a connection request to the TCP server. The server can receive this request and establish a connection with the client. Specifically, after the server monitors the connection request, it can call accept() to receive the connection request, so that the connection is established. After that, you can start network input and output (Input/Output, I/O) operations, that is, read and write I/O operations similar to ordinary files to realize socket-based data transmission.
系统调用(system call):Linux启动时,首先会启动内核(kernel),内核是一段计算机程序,这个程序直接管理管理硬件,包括CPU、内存空间、硬盘接口、网络接口等等。所有的计算机操作都 要通过内核传递给硬件。为了方便调用内核,将内核的功能总结成为系统调用,通过系统调用操作可实现内核的功能。系统调用为上层程序提供了一个清晰的接口,隐藏了内核的复杂结构。一个操作系统上的功能可以看作是系统调用的组合的效果。System call: When Linux starts, it first starts the kernel. The kernel is a computer program that directly manages and manages the hardware, including CPU, memory space, hard disk interface, network interface, and so on. All computer operations must be passed to the hardware through the kernel. In order to facilitate the call of the kernel, the function of the kernel is summarized as a system call, and the function of the kernel can be realized through the system call operation. The system call provides a clear interface for the upper program and hides the complex structure of the kernel. A function on an operating system can be seen as the effect of a combination of system calls.
Shell:shell是一个命令语言解释器(command-language interpreter),拥有自己内建的shell命令集,它是用于和Linux内核之间交互的接口程序。shell提供了一个界面,用户通过这个界面可访问操作系统内核的服务,具体地,在Linux系统中,shell上通各种上层应用,下通系统调用。shell既是一种命令语言,又是一种程序设计语言。另外,Shell脚本(shell script),是一种为shell编写的脚本程序,一种带有命令解析执行的程序。Shell脚本可由shell解释后传给内核。Shell: Shell is a command-language interpreter, with its own built-in shell command set, which is an interface program used to interact with the Linux kernel. The shell provides an interface through which the user can access the services of the operating system kernel. Specifically, in a Linux system, the shell communicates with various upper-layer applications, and the shell communicates with system calls. Shell is both a command language and a programming language. In addition, a shell script is a script program written for the shell, a program with command parsing and execution. Shell scripts can be interpreted by the shell and passed to the kernel.
Shell进程:按照shell规定的编程语法写的shell程序的一次运行过程。Shell process: a running process of a shell program written in accordance with the programming syntax specified by the shell.
目前,在Linux和UNIX系统里常用的shell包括Bourne shell(sh)、(Bourne Again shell,bash)、C shell(csh)以及Korn shell(ksh)。而其中,bash是大多数Linux系统的缺省shell。在本申请实施例中,这些shell也可记为系统自带的shell。At present, commonly used shells in Linux and UNIX systems include Bourne shell (sh), (Bourne Again shell, bash), C shell (csh), and Korn shell (ksh). Among them, bash is the default shell of most Linux systems. In the embodiments of the present application, these shells can also be recorded as shells that come with the system.
为了更清楚表达本申请实施例的技术方案,在对本申请实施例进行详细说明前,先对本申请实施例所解决的技术问题以及发明人发现问题的过程进行说明如下:In order to express the technical solutions of the embodiments of the present application more clearly, before describing the embodiments of the present application in detail, the technical problems solved by the embodiments of the present application and the process by which the inventor finds the problems will be described as follows:
目前,控制端与被控端之间实现连接一般可通过两种连接方式。其中,第一种连接方式可称为正向连接,在该连接方式下是由控制端主动连接被控端的端口,被控端则监听该端口实现连接,即在正向连接时,被控端作为网络概念中的服务端,控制端作为网络概念中的客户端,例如,远程桌面、网络(web)服务、shell等一般采用正向连接实现。At present, the connection between the control terminal and the controlled terminal can generally be achieved through two connection methods. Among them, the first connection mode can be called forward connection. In this connection mode, the control end actively connects to the port of the controlled end, and the controlled end monitors the port to realize the connection, that is, when the connection is forward, the controlled end As the server in the network concept, the control terminal is the client in the network concept. For example, remote desktops, web services, shells, etc. are generally implemented by forward connections.
但是,由于防火墙限制、权限不足、端口被占用等限制,采用第一种连接方式可能导致控制端无法连接被控端、无法对被控端实现持续控制或无法接收被控端请求等问题。因此,一些攻击方如黑客,为了突破前述限制来控制或者说攻击、入侵用户主机,会采用第二种连接方式与被攻击方的主机建立连接,即由:攻击方主机在被攻击方的主机上创建一个套接字,由被攻击方主动连接攻击方的端口,攻击方则监听该端口实现连接,即此时被攻击方作为客户端,攻击方作为服务端,相对于前述正向连接下客户端和服务端的角色发生了反转,这种连接方式可称为反弹连接。However, due to firewall restrictions, insufficient authority, and port occupation, the use of the first connection method may lead to problems such as the control end being unable to connect to the controlled end, continuous control of the controlled end, or failure to receive requests from the controlled end. Therefore, some attackers such as hackers, in order to break through the aforementioned restrictions to control or attack or invade the user's host, they will use the second connection method to establish a connection with the host of the attacked party, namely: the host of the attacking party is in the host of the attacked party Create a socket on the above, the attacked party actively connects to the attacker’s port, and the attacker listens to the port for connection. At this time, the attacked party acts as the client and the attacker acts as the server. Compared with the aforementioned forward connection The roles of the client and server are reversed, and this connection method can be called a bounce connection.
当主机存在基于反弹连接的进程时,该进程可记为恶意进程,这类进程将威胁主机安全,因此,为了提高网络安全,需要对主机中存在反弹连接的恶意进程进行检测。When a host has a process based on a bounced connection, the process can be recorded as a malicious process. This type of process will threaten the security of the host. Therefore, in order to improve network security, it is necessary to detect the malicious process with bounced connections in the host.
另外,如果该恶意进程对应的是一种带有命令解析执行的程序,该程序可称为反弹shell(reverse shell),该恶意进程还可进一步记为反弹shell进程,因此,通过本申请实施例提供的方法可对反弹shell进程进行检测。In addition, if the malicious process corresponds to a program with command parsing and execution, the program can be called a reverse shell, and the malicious process can be further recorded as a reverse shell process. Therefore, according to the embodiments of this application, The provided method can detect the reverse shell process.
反弹shell(reverse shell)程序:是一种基于反弹连接的shell,其由控制端监听端口,被控端发起请求到该端口,并将其命令行的输入输出转到控制端。反弹shell本质上是网络概念的客户端与服务器端的角色反转。Reverse shell (reverse shell) program: It is a shell based on reverse connection. The control end monitors the port, the controlled end initiates a request to the port, and transfers the input and output of its command line to the control end. Reverse shell is essentially the reversal of the roles of the client and server in the network concept.
但是,发明人在研究中发现,基于反弹连接的程序并非必须使用系统自带的shell来建立,黑客可以不使用系统自带的shell来建立反弹shell,例如,黑客可基于自行开发的命令解释器,编写出带有命令解析执行的程序,即可作为shell使用,另外,黑客也可上传一个shell程序或复制系统shell到其他目录下更改shell命名后使用,使得该shell程序不符合系统自带shell的指定命名方式、不处于系统自带shell的指定目录中,这一类shell程序难以被目前的检测方法发现,即目前的检测方法在应用于检测这类恶意进程时会存在漏报情况。However, the inventor found in his research that programs based on rebound connections do not have to be built using the shell that comes with the system, and hackers can create a rebound shell without using the shell that comes with the system. For example, hackers can build on a self-developed command interpreter. , Write a program with command parsing and execution, which can be used as a shell. In addition, hackers can also upload a shell program or copy the system shell to another directory and use it after changing the shell name, making the shell program incompatible with the system's own shell The designated naming method is not in the designated directory of the system's own shell. This type of shell program is difficult to be detected by the current detection methods, that is, the current detection method will fail to report when it is applied to detect this type of malicious process.
因此,基于上述问题,本申请实施例提供了一种恶意进程的检测方法、装置、电子设备及计算机可读取存储介质,以减少对恶意进程的漏报率。Therefore, based on the foregoing problems, embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for detecting malicious processes, so as to reduce the false negative rate of malicious processes.
为了便于详细说明,下面先结合附图对本申请实施例所适用的应用场景进行示例性说明。For the convenience of detailed description, the following exemplarily describes the application scenarios applicable to the embodiments of the present application with reference to the accompanying drawings.
请参见图2,图2示出了本申请实施例提供的图像识别方法的应用场景示意图,该应用场景包括本申请实施例提供的一种通信系统10。该通信系统10包括:第一主机100和第二主机200。第一主机100和第二主机120之间可通过网络连接。Please refer to FIG. 2. FIG. 2 shows a schematic diagram of an application scenario of an image recognition method provided by an embodiment of the present application. The application scenario includes a communication system 10 provided by an embodiment of the present application. The communication system 10 includes: a first host 100 and a second host 200. The first host 100 and the second host 120 may be connected through a network.
其中,第一主机100、第二主机200可以为终端或服务器,若为终端,终端可以为但不限于为手机、平板电脑、MP3播放器(Moving Picture Experts Group Audio LayerⅢ,动态影像压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio LayerⅣ,动态影像压缩标准音频层面4)播放器、 个人计算机或可穿戴电子设备等等。本申请实施例对具体的终端的设备类型不作限定。若为服务器,服务器可以是传统服务器,也可以是云端服务器,可以是一台服务器,或者由若干台服务器组成的服务器集群,或者是一个云计算服务中心。Among them, the first host 100 and the second host 200 may be terminals or servers. If they are terminals, the terminals may be, but are not limited to, mobile phones, tablets, MP3 players (Moving Picture Experts Group Audio Layer III, standard audio layer for dynamic image compression). 3) MP4 (Moving Picture Experts Group Audio Layer IV, standard audio layer for dynamic image compression 4) Players, personal computers or wearable electronic devices, etc. The embodiment of the present application does not limit the device type of a specific terminal. If it is a server, the server can be a traditional server or a cloud server, it can be a server, or a server cluster composed of several servers, or a cloud computing service center.
其中,第一主机100与第二主机200可以为相同的设备,也可以为不同的设备,在此不作限定。例如,第一主机100与第二主机200可以均为终端,也可均为服务器,还可一个为终端、另一个为服务器。The first host 100 and the second host 200 may be the same device or different devices, which is not limited here. For example, the first host 100 and the second host 200 may both be terminals or servers, or one may be a terminal and the other may be a server.
于本申请实施例中,第一主机100可用于表示被入侵主机,即被攻击方的主机,第二主机200可用于表示入侵主机,即攻击方的主机。若第二主机200在第一主机100创建了socket,使得第一主机100主动请求连接第二主机200,这一过程相关的进程可作为本申请实施例中所述的恶意进程。,此时第一主机100对应网络概念中的客户端,第二主机200对应网络概念中的服务器端。In the embodiment of the present application, the first host 100 can be used to represent the compromised host, that is, the host of the attacked party, and the second host 200 can be used to represent the intruding host, that is, the host of the attacker. If the second host 200 creates a socket in the first host 100, so that the first host 100 actively requests to connect to the second host 200, the process related to this process can be regarded as the malicious process described in the embodiment of the present application. At this time, the first host 100 corresponds to the client in the network concept, and the second host 200 corresponds to the server in the network concept.
可以理解的是,一个具体的主机在不同情况下可发生被入侵主机和入侵主机之间的角色反转,即若在某一时刻,主机A被主机B入侵,则此时,主机A可作为被入侵主机,用第一主机100表示,主机B可作为入侵主机,用第二主机200表示;而若另一时刻,主机A入侵主机B,则此时,主机A可作为入侵主机,用第二主机200表示,主机B可作为被入侵主机,用第一主机100表示。It is understandable that a specific host can have a role reversal between the invaded host and the invaded host under different circumstances. That is, if at a certain moment, host A is invaded by host B, then host A can be used as The compromised host is represented by the first host 100, and the host B can be used as the intruding host, and the second host 200 is represented; and if at another moment, the host A invades the host B, at this time, the host A can be used as the intruding host. The second host 200 indicates that the host B can be used as the compromised host, which is represented by the first host 100.
下面将通过具体实施例对本申请实施例提供的恶意进程的检测方法、装置、电子设备及计算机可读取存储介质进行详细说明。The method, device, electronic device, and computer readable storage medium for detecting malicious processes provided by the embodiments of the present application will be described in detail below through specific embodiments.
请参阅图3,图3示出了本申请一个实施例提供的一种恶意进程的检测方法的流程示意图,可应用于上述第一主机。下面将针对图3所示的流程进行详细的阐述。该方法可以包括:Please refer to FIG. 3, which shows a schematic flow chart of a method for detecting a malicious process provided by an embodiment of the present application, which can be applied to the above-mentioned first host. The following will elaborate on the process shown in FIG. 3. The method can include:
S110:获取请求网络连接的目标进程。S110: Obtain a target process requesting a network connection.
其中,目标进程为存在对外连接的进程,即该进程下被入侵主机会向其他主机请求网络连接。进程可基于各种通信协议对外请求网络连接,例如通信协议可以为TCP、UDP通信协议等,在此不作限定。Among them, the target process is a process with external connections, that is, the compromised host under this process will request network connections from other hosts. The process can request a network connection to the outside based on various communication protocols, for example, the communication protocol can be TCP, UDP communication protocol, etc., which are not limited here.
以基于TCP、UDP通信协议请求网络连接为例,则进程应当创建有套接字,并使用套接字向其他主机发送连接请求,例如,需要调用connect()来发送连接请求。因此可获取调用过connect()的进程作为请求网络连接的目标进程。Taking the request for network connection based on TCP and UDP communication protocol as an example, the process should create a socket and use the socket to send connection requests to other hosts. For example, it is necessary to call connect() to send the connection request. Therefore, the process that has called connect() can be obtained as the target process for requesting a network connection.
S120:获取目标进程的系统调用操作。S120: Obtain the system call operation of the target process.
其中,系统调用操作用于记录进程所使用过的系统调用,在一些实施方式中,一个进程的系统调用操作包括系统调用的类型以及进程使用该系统调用的时刻,因而获取目标进程的系统调用操作,可确定目标进程所使用过的系统调用操作。另外,若获取的系统调用操作的数量为多个,通过获取目标进程的多个系统调用操作,还可确定多个系统调用操作的执行次序。Among them, the system call operation is used to record the system calls used by the process. In some embodiments, the system call operation of a process includes the type of system call and the time when the process uses the system call, thereby obtaining the system call operation of the target process , Can determine the system call operation used by the target process. In addition, if the number of acquired system call operations is multiple, by acquiring multiple system call operations of the target process, the execution order of the multiple system call operations can also be determined.
在一些实施例中,可通过目标进程的进程标识(Process Identification,PID)来获取目标进程的系统调用操作。其中,PID是用于唯一标识进程的数值。In some embodiments, the system call operation of the target process can be obtained through the process identification (PID) of the target process. Among them, PID is a value used to uniquely identify a process.
需要说明的是,于本申请实施例中,数量为多个时,可表征数量为两个或两个以上。It should be noted that, in the embodiments of the present application, when the number is multiple, the number can be characterized as two or more.
S130:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S130: If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
系统中可能运行有多种类型的进程,进程的类型可以包括但不限于shell进程、数据库进程(如mysql)、服务器进程(如apache,tomcat,nginx)等,在此不作限定。可以理解的是,不同进程的系统调用操作存在差异,因而可通过系统调用操作来确定进程的类型。There may be many types of processes running in the system. The types of processes can include but are not limited to shell processes, database processes (such as mysql), server processes (such as apache, tomcat, nginx), etc., which are not limited here. It is understandable that the system call operations of different processes are different, so the type of process can be determined through the system call operation.
在一些实施例中,目标系统调用操作可以是指定类型的进程的系统调用操作,由此,通过将目标进程的系统调用操作与目标系统调用操作进行匹配,可判断目标进程的系统调用操作是否符合指定类型的进程的特征。In some embodiments, the target system call operation may be a system call operation of a specified type of process. Therefore, by matching the system call operation of the target process with the target system call operation, it can be determined whether the system call operation of the target process conforms to The characteristics of the process of the specified type.
由于一般情况下,入侵主机在攻击被入侵主机时,会使用带有命令解析执行的程序(例如shell程序)来实现基于反弹连接的攻击,因此这类程序(即带有命令解析执行的程序)对应的进程可被定义为本申请实施例中的恶意进程。此时,指定类型的进程可以为带有命令解析执行的程序对应的进程,目标系统调用操作可以是该类进程中所使用的系统调用操作。例如,若检测的恶意进程为反弹shell进程,此时指定类型的进程可以是shell进程,目标系统调用操作可以是shell进程的系统调用操作。In general, when the invading host attacks the invaded host, it will use the program with command analysis execution (such as shell program) to realize the attack based on rebound connection, so this kind of program (that is, the program with command analysis execution) The corresponding process can be defined as a malicious process in the embodiment of this application. At this time, the process of the specified type may be the process corresponding to the program with command parsing and execution, and the target system call operation may be the system call operation used in this type of process. For example, if the detected malicious process is a rebound shell process, then the specified type of process may be a shell process, and the target system call operation may be a system call operation of the shell process.
其中,系统调用操作和目标系统调用操作的数量可为一个或多个,在此不作限定。Among them, the number of system call operations and target system call operations can be one or more, which is not limited here.
在一些实施例中,若系统调用操作的数量和目标系统调用操作的数量均为多个时,则系统调用操作与目标系统调用操作匹配,可以是多个系统调用操作的类型与多个目标系统调用操作的类型匹配。作为一种实施方式,若在多个目标系统调用操作中,可查找到与多个系统调用操作中的每个匹配的目标系统调用操作,可判定系统调用操作与目标系统调用操作匹配,例如,若多个系统调用操作分别为A1、A2、A3,多个目标系统调用操作分别为A1、A3、A2、A4、A5,可判定二者匹配。In some embodiments, if the number of system call operations and the number of target system call operations are both multiple, the system call operation matches the target system call operation, which can be multiple system call operations types and multiple target systems. The type of the call operation matches. As an implementation manner, if among multiple target system call operations, a target system call operation that matches each of the multiple system call operations can be found, and it can be determined that the system call operation matches the target system call operation, for example, If multiple system call operations are A1, A2, A3, and multiple target system call operations are A1, A3, A2, A4, A5, it can be determined that the two match.
在另一些实施例中,由于系统调用操作的执行次序在一定程度上决定了一个进程的类型,因此还可根据系统调用操作的执行次序来确定目标进程是否为恶意进程。即系统调用操作与目标系统调用操作匹配时,可以是多个系统调用操作与多个目标系统调用操作之间至少部分重合,而且要求重合部分的执行次序也一致。具体实施方式可见后述实施例,在此不再赘述。In other embodiments, since the execution order of the system call operations determines the type of a process to a certain extent, it is also possible to determine whether the target process is a malicious process according to the execution order of the system call operations. That is, when the system call operation matches the target system call operation, multiple system call operations and multiple target system call operations may at least partially overlap, and the execution order of the overlapped parts is required to be consistent. Specific implementation manners can be seen in the following embodiments, which will not be repeated here.
在一些实施例中,被入侵主机在确定目标进程为恶意进程后,可对恶意进程作相关处理。作为一种实施方式,可对恶意进程进行终止处理,终止处理可包括杀死恶意进程或其他操作,在此不作限定,从而及时阻止恶意进程对主机的继续攻击,以便及时排除该恶意进程的威胁,保护主机安全。In some embodiments, after determining that the target process is a malicious process, the compromised host can perform related processing on the malicious process. As an implementation manner, the malicious process can be terminated, and the termination can include killing the malicious process or other operations, which is not limited here, so as to prevent the malicious process from continuing to attack the host in time, so as to eliminate the threat of the malicious process in time , Protect the security of the host.
在一些实施例中,被入侵主机可与运维管理设备连接,则被入侵主机在检测到恶意进程后,可将检测结果上报给运维管理设备。运维管理设备接收该上报的检测结果,可对被入侵主机做相应的维护。其中,所述运维管理设备可以是服务器、防火墙、网管设备等等。In some embodiments, the compromised host can be connected to the operation and maintenance management device, and after detecting the malicious process, the compromised host can report the detection result to the operation and maintenance management device. The operation and maintenance management equipment receives the reported detection result and can perform corresponding maintenance on the intruded host. Wherein, the operation and maintenance management device may be a server, a firewall, a network management device, and so on.
另外,运维管理设备可生成告警信息,提示运维人员或其他相关人员对被入侵主机作响应的维护。告警信息可以是语音提示、文字提示、亮灯提示等,本实施例对此不作限定。In addition, the operation and maintenance management equipment can generate alarm information to remind the operation and maintenance personnel or other related personnel to respond to the maintenance of the compromised host. The alarm information may be voice prompts, text prompts, light-on prompts, etc., which is not limited in this embodiment.
实际应用中,一般基于系统自带的shell所建立的shell程序会按照系统规则进行命名和存储,即按固定的命名方式进行命名、并存储于固定的目录。所以现有技术在检测反弹shell进程时,会先获取shell进程再判断是否存在对外的网络连接,来检测shell进程是否为反弹shell进程。而目前获取shell进程时,往往是去固定的目录、按固定的命名来查找shell进程。因此,如果黑客编写了一个程序,不按系统规则中固定的命名方式对该程序进行命名、或该程序未被存储至前述固定的目录中、甚至都不采用系统自带的shell来编写该程序,则这类程序可逃避现有技术的检测。但是,这类程序如果仍可使得运行该类程序的主机主动建立对外部主机的连接,则这类程序仍可定义为反弹shell程序,对应的进程为反弹shell进程。因此,现有的检测方式会存在对这类不按系统规则建立的反弹shell进程的漏报,导致部分反弹shell的安全威胁无法被检测上报。In practical applications, generally shell programs created based on the shell that comes with the system will be named and stored in accordance with system rules, that is, named according to a fixed naming method and stored in a fixed directory. Therefore, in the prior art, when detecting a rebound shell process, the shell process is first acquired and then judged whether there is an external network connection to detect whether the shell process is a rebound shell process. At present, when obtaining the shell process, it is often to find the shell process in a fixed directory and according to a fixed name. Therefore, if a hacker writes a program, the program is not named according to the fixed naming method in the system rules, or the program is not stored in the aforementioned fixed directory, or even the shell that comes with the system is not used to write the program , Then this kind of program can evade the detection of the existing technology. However, if this type of program can still make the host running this type of program actively establish a connection to the external host, then this type of program can still be defined as a rebound shell program, and the corresponding process is a rebound shell process. Therefore, the existing detection methods may fail to report such rebound shell processes that are not established in accordance with the system rules, resulting in partial rebound shell security threats that cannot be detected and reported.
由此,相较于现有技术,本实施例提供的恶意进程的检测方法,通过先获取请求网路连接的目标进程,再获取目标进程的系统调用操作,并根据目标进程的系统调用操作与目标系统调用操作的匹配结果,确定目标进程是否为恶意进程,不仅可检测按系统规则建立的恶意进程,还可检测不按系统规则建立的恶意进程,大大降低恶意进程的漏报率,提高对恶意进程的上报率,从而提高终端使用安全性。具体地,可以有效检测各种不使用系统自带的shell所建立的反弹shell程序对应的进程,如对于metasploit等黑客工具生成的、或者由黑客编写的命令解释器所创建的反弹shell均有很好的识别效果。而且由于一般情况下,被入侵主机请求对外连接的进程比系统自带的shell创建的进程相比,数量更少,因此本申请实施例通过先根据是否请求网络连接来得到目标进程,可提高检测效率,检测性能更优。Therefore, compared with the prior art, the malicious process detection method provided by this embodiment first obtains the target process requesting network connection, and then obtains the system call operation of the target process, and according to the system call operation of the target process and The matching result of the target system call operation determines whether the target process is a malicious process. It can detect not only malicious processes established according to system rules, but also malicious processes not established according to system rules, which greatly reduces the false negative rate of malicious processes and improves the Report rate of malicious processes, thereby improving the security of terminal use. Specifically, it can effectively detect the processes corresponding to various reverse shell programs that do not use the shell that comes with the system, such as those generated by hacker tools such as metasploit or created by command interpreters written by hackers. Good recognition effect. Moreover, because in general, the number of processes that the intruded host requests for external connections is smaller than the processes created by the system’s own shell. Therefore, the embodiment of this application obtains the target process according to whether a network connection is requested first, which can improve detection. Efficiency, better detection performance.
在一些实施例中,可先获取基于套接字进行网络通信的进程作为候选进程,再从候选进程中确定请求对外连接的进程作为目标进程。具体地,请参阅图4,图4示出了本申请另一个实施例提供的恶意进程的检测方法,该方法可包括:In some embodiments, a process that performs network communication based on a socket may be acquired as a candidate process, and then a process requesting an external connection is determined from the candidate process as a target process. Specifically, please refer to FIG. 4, which shows a method for detecting a malicious process provided by another embodiment of the present application. The method may include:
S210:获取候选进程。S210: Obtain candidate processes.
其中,候选进程为基于套接字进行网络通信的进程,这部分进程既包括基于套接字请求对外连接的进程,也包括基于套接字被其他主机连接的进程,也就是说,候选进程不仅创建了socket,还使用了socket,例如使用socket进行过绑定(bind)或连接(connect)。Among them, the candidate process is a process that performs network communication based on a socket. This part of the process includes both processes that request external connections based on sockets and processes that are connected by other hosts based on sockets. In other words, candidate processes are not only The socket is created, and the socket is also used, for example, the socket has been used for binding (bind) or connection (connect).
另外,在一些可能的实施例中,候选进程也可以包括只创建了socket但并未使用socket的进程,即只是调用了socket(),却并未调用bind()或connect()。在一种实施方式中,可查找创建了套接字的进程,然后将该进程确定为候选进程,其具体实施方式可见后述实施例,在此不再赘述。In addition, in some possible embodiments, the candidate process may also include a process that only creates a socket but does not use the socket, that is, only calls socket(), but does not call bind() or connect(). In an implementation manner, the process that created the socket can be searched for, and then the process can be determined as a candidate process. The specific implementation manner can be seen in the embodiments described later, and will not be repeated here.
S220:根据候选进程确定目标进程。S220: Determine the target process according to the candidate process.
在一些实施例中,可获取候选进程的系统调用操作,检测是否存在连接函数,例如,可检测候选进程是否调用connect(),若候选进程调用了connect(),可将候选进程确定为请求网络连接的进程,即将候选进程确定为目标进程。In some embodiments, the system call operation of the candidate process can be obtained to detect whether there is a connection function. For example, it can be detected whether the candidate process calls connect(). If the candidate process calls connect(), the candidate process can be determined as the request network The connected process, that is, the candidate process is determined as the target process.
在另一些实施例中,也可监控候选进程的连接事件,以在监控到连接事件发生时,将被监控到连接事件发生的候选进程确定为目标进程。具体实施方式可见后述实施例,在此不再赘述。In other embodiments, the connection event of the candidate process may also be monitored, so that when the connection event is monitored, the candidate process whose connection event is monitored is determined as the target process. Specific implementation manners can be seen in the following embodiments, which will not be repeated here.
S230:获取目标进程的系统调用操作。S230: Obtain a system call operation of the target process.
S240:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S240: If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
在一些实施例中,系统调用操作的数量为多个,目标系统调用操作的数量为多个,则步骤S240的具体实施方式可以为:若多个系统调用操作的执行次序与多个目标系统调用操作的执行次序匹配,确定目标进程为恶意进程。In some embodiments, the number of system call operations is more than one, and the number of target system call operations is more than one. The specific implementation of step S240 may be as follows: The execution sequence of the operations matches, and the target process is determined to be a malicious process.
为方便描述,可将前述依次序执行的多个目标系统调用操作记为目标系统调用序列,将目标进程依次序执行的多个系统调用操作记为目标进程的系统调用序列,则多个系统调用操作的执行次序与多个所述目标系统调用操作的执行次序匹配,可记为目标进程的系统调用序列与目标系统调用序列匹配。For the convenience of description, the aforementioned multiple target system call operations performed sequentially can be recorded as the target system call sequence, and multiple system call operations performed sequentially by the target process are recorded as the target process system call sequence, then multiple system calls The execution order of the operations matches the execution order of the multiple target system call operations, which can be recorded as the system call sequence of the target process matches the target system call sequence.
例如,若多个系统调用操作按照被执行的执行次序分别为A1、A2、A3,即目标进程的系统调用序列为A1、A2、A3,多个目标系统调用操作按照被执行的执行次序分别为A1、A3、A2,即目标系统调用序列为A1、A3、A2,此时,可判定目标进程的系统调用序列与目标系统调用序列不匹配。再如,若目标进程的系统调用序列为A1、A2、A3,目标系统调用序列为A0、A1、A2、A3、A4,此时可判定目标进程的系统调用序列与目标系统调用序列匹配。For example, if multiple system call operations are A1, A2, A3 in the order of execution, that is, the system call sequence of the target process is A1, A2, A3, and the multiple target system call operations are in the order of execution. A1, A3, A2, that is, the target system call sequence is A1, A3, A2, at this time, it can be determined that the system call sequence of the target process does not match the target system call sequence. For another example, if the system call sequence of the target process is A1, A2, A3, and the target system call sequence is A0, A1, A2, A3, A4, it can be determined that the system call sequence of the target process matches the target system call sequence.
在一些实施例中,若恶意进程为反弹shell进程,则多个目标系统调用操作的执行次序可以由shell进程依次序执行的系统调用操作确定,由此可将满足匹配的目标进程称为shell进程。In some embodiments, if the malicious process is a reverse shell process, the execution order of multiple target system call operations can be determined by the system call operations executed sequentially by the shell process, and thus the target process that satisfies the match can be called a shell process .
在一些实施例中,多个目标系统调用操作依次序可包括:等待(wait)套接字上的数据、读(read)数据、执行命令、写(write)数据、等待套接字上的数据。其中,读数据为读socket上的数据、写数据为在socket写入数据,在一些实施方式中,目标进程的系统调用序列中如果存在与前述多个目标系统调用操作构成的目标系统调用序列完全重合的部分,可使得检测最为准确,即In some embodiments, the sequence of multiple target system call operations may include: waiting for data on the socket, reading data, executing commands, writing data, and waiting for data on the socket . Among them, reading data is reading data on the socket, and writing data is writing data in the socket. In some embodiments, if there is a target system call sequence composed of the aforementioned multiple target system call operations in the system call sequence of the target process. The overlapped part can make the detection the most accurate, that is
由于在目标系统调用序列为“等待套接字上的数据、读数据、执行命令、写数据、等待套接字上的数据”时,能够较好地反映shell进程的特征,甚至,在一些实施例中,只要一个进程的系统调用序列与该目标系统调用序列一致,可判定该进程为shell进程,若不一致,则判定该进程不为shell进程,因此基于这个目标系统调用序列,可避免将其他非shell进程确定为恶意进程导致的错误检测,提高对shell进程的检测准确度,从而可提高对反弹shell进程的检测准确度。Since the target system call sequence is "waiting for data on the socket, reading data, executing commands, writing data, waiting for data on the socket", it can better reflect the characteristics of the shell process, and even in some implementations For example, as long as the system call sequence of a process is consistent with the target system call sequence, the process can be determined to be a shell process. If it is inconsistent, the process is determined not to be a shell process. Therefore, based on this target system call sequence, other The non-shell process is determined to be an error detection caused by a malicious process, which improves the detection accuracy of the shell process, thereby improving the detection accuracy of the rebound shell process.
另外,若记“等待套接字上的数据、读数据、执行命令、写数据、等待套接字上的数据”为标准系统调用序列,则目标系统调用序列,除了可以为该标准系统调用序列外,还可以采用其他的目标系统调用序列来与目标进程的系统调用序列进行匹配,作为一种实施方式,可以在该标准系统调用序列中各系统调用操作的执行次序不变的情况下,取该标准系统调用序列的子集作为目标系统调用序列,例如,目标系统调用序列可以为“读数据、执行命令、写数据”、“等待套接字上的数据、读数据、执行命令、写数据”等,在此不作限定。In addition, if “waiting for data on the socket, reading data, executing commands, writing data, waiting for data on the socket” is a standard system call sequence, the target system call sequence can be in addition to the standard system call sequence In addition, other target system call sequences can also be used to match the system call sequence of the target process. As an implementation mode, it can be selected when the execution order of each system call operation in the standard system call sequence remains unchanged. A subset of the standard system call sequence is regarded as the target system call sequence. For example, the target system call sequence can be "read data, execute command, write data", "wait for data on socket, read data, execute command, write data" "Etc., it is not limited here.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
在一些实施例中,可以通过监控候选进程的连接事件来根据候选进程确定目标进程,以便及时对目标进程进行后续匹配,由此,可提高对恶意进程的效率,使得恶意进程可被及时检测到,从而有利于及时阻止恶意进程攻击,可进一步提高终端安全性。具体地,请参阅图5,图5示出了本申请又一个实施例提供的恶意进程的检测方法,该方法可包括:In some embodiments, the target process can be determined according to the candidate process by monitoring the connection event of the candidate process, so that subsequent matching of the target process can be performed in time, thereby improving the efficiency of the malicious process, so that the malicious process can be detected in time , Which helps prevent malicious process attacks in time, and can further improve terminal security. Specifically, please refer to FIG. 5. FIG. 5 shows a method for detecting a malicious process provided by another embodiment of the present application. The method may include:
S310:获取候选进程。S310: Obtain candidate processes.
S320:监控候选进程的连接事件。S320: Monitor the connection event of the candidate process.
其中,连接事件用于请求网络连接。Among them, the connection event is used to request a network connection.
在一些实施方式中,进程可通过调用connect()来请求网络连接,则在一个示例中,若一个进程调用connect(),可被监控到该进程的连接事件。In some embodiments, a process can request a network connection by calling connect(). In one example, if a process calls connect(), the connection event of the process can be monitored.
在一些实施例中,可利用审计(audit)功能来监控候选进程的连接事件,audit可以自定义对指定的文件或命令进行审计,只要配置好对应规则即可,配置规则可以通过命令行(临时生效)或者编辑配置文件(永久生效)两种方式来实现,本实施例对此不作限定。In some embodiments, the audit function can be used to monitor the connection events of the candidate process. Audit can customize the audit of the specified files or commands. As long as the corresponding rules are configured, the configuration rules can be through the command line (temporary This can be achieved in two ways: effective) or by editing the configuration file (permanently effective), which is not limited in this embodiment.
在一些实施方式中,为了能够实现对连接事件的长时间或多次监控,可通过编辑配置文件,配置审计(audit)配置项来监控候选进程的连接事件。如果有连接事件发生会写入audit日志中,通过审计该audit日志可找到发生连接事件的进程对应的进程标识,以确定发生连接事件的进程。In some embodiments, in order to be able to monitor connection events for a long time or multiple times, the connection events of candidate processes can be monitored by editing configuration files and configuring audit configuration items. If a connection event occurs, it will be written to the audit log. By auditing the audit log, the process ID corresponding to the process where the connection event occurred can be found to determine the process where the connection event occurred.
另外,在一些实施例中,为了避免因为同时监控的进程过多,导致运行效率降低甚至出现卡死,可控制同时监控的数量。具体地,请参阅图6,图6示出了图5中步骤S320在一个示例性实施例中的流程示意图,在该实施例中步骤S320可包括:In addition, in some embodiments, in order to avoid a decrease in operating efficiency or even a jam due to too many processes being monitored at the same time, the number of simultaneous monitoring can be controlled. Specifically, please refer to FIG. 6, which shows a schematic flowchart of step S320 in FIG. 5 in an exemplary embodiment. In this embodiment, step S320 may include:
S321:检测候选进程的数量是否超过指定监控数量。S321: Detect whether the number of candidate processes exceeds the specified monitoring number.
获取候选进程后,候选进程的数量可以为多个,候选进程的数量如果过多,则主机需要同时监控的进程的数量过多,可能导致系统运行效率降低,甚至出现卡死,因此为控制同时监控的进程的数量,可获取候选进程的数量,检测候选进程的数量是否超过指定监控数量。After obtaining candidate processes, the number of candidate processes can be multiple. If the number of candidate processes is too large, the number of processes that the host needs to monitor at the same time may be too large, which may result in reduced system operation efficiency or even jamming, so it is control simultaneous The number of monitored processes, the number of candidate processes can be obtained, and whether the number of candidate processes exceeds the specified monitoring number.
其中,指定监控数量可根据实际需求确定,也可以是程序预设,还可以是用户自定义,在此不作限定。Among them, the designated monitoring quantity can be determined according to actual needs, can also be preset by the program, or customized by the user, which is not limited here.
在一些实施方式中,指定监控数量可由当前系统运行性能确定,在一个示例中,系统当前运行性能可由中央处理器(Central Processing Unit,CPU)占用率来反映,此时可建立CPU占用率于指定监控数量之间的映射关系表,则根据CPU占用率可确定对应的指定监控数量,CPU占用率越高,CPU占用率对应的指定监控数量越低,由此可在CPU占用率较高时,减少监控数量,因为同时监控的进程过多,导致运行效率降低甚至出现卡死。其中,CPU占用率可以是指定数值,也可以是一个数值范围,在此不作限定。In some implementations, the designated monitoring quantity can be determined by the current system operating performance. In one example, the current system operating performance can be reflected by the central processing unit (CPU) occupancy rate. At this time, the CPU occupancy rate can be set to the specified The mapping relationship table between the monitoring quantities, the corresponding designated monitoring quantity can be determined according to the CPU occupancy rate. The higher the CPU occupancy rate, the lower the designated monitoring number corresponding to the CPU occupancy rate. This can be used when the CPU occupancy rate is high. Reduce the number of monitoring, because too many processes are being monitored at the same time, resulting in reduced operating efficiency and even stuck. The CPU occupancy rate can be a specified value or a range of values, which is not limited here.
另外,指定监控数量也可根据其他可反映系统运行性能的参数确定,例如内存占用率等,本实施例对此不作限定。In addition, the designated monitoring quantity can also be determined according to other parameters that can reflect the operating performance of the system, such as memory occupancy, which is not limited in this embodiment.
S322:若候选进程的数量超过指定监控数量,从候选进程中确定待监控候选进程。S322: If the number of candidate processes exceeds the specified monitoring number, determine candidate processes to be monitored from the candidate processes.
若候选进程的数量超过指定监控数量,从候选进程中确定待监控候选进程,其中,待监控候选进程的数量小于候选进程的数量,由此通过后续仅监控待监控候选进程的连接事件,可减少同时监控的进程的数量。If the number of candidate processes exceeds the specified number of monitoring, the candidate processes to be monitored are determined from the candidate processes, where the number of candidate processes to be monitored is less than the number of candidate processes, which can be reduced by subsequently monitoring only the connection events of the candidate processes to be monitored The number of processes monitored at the same time.
作为一种实施方式,待监控候选进程的数量可以小于或等于指定监控数量,则可在候选进程的数量超过指定监控数量时,将同时监控的候选进程的数量减少到不超过指定监控数量。As an implementation manner, the number of candidate processes to be monitored can be less than or equal to the specified monitoring number, and when the number of candidate processes exceeds the specified monitoring number, the number of candidate processes to be monitored at the same time can be reduced to no more than the specified monitoring number.
作为另一种实施方式,可设置每轮的目标监控数量,目标监控数量小于或等于指定监控数量,则可将候选进程分成多轮进行监控,每轮仅监控目标监控数量个候选进程作为待监控候选进程,完成一轮监控后可获取下一轮候选进程作为待监控候选进程。As another implementation method, you can set the target monitoring quantity for each round. If the target monitoring quantity is less than or equal to the specified monitoring quantity, then the candidate process can be divided into multiple rounds for monitoring. Each round only monitors the target monitoring quantity and the candidate processes are to be monitored. Candidate processes, after completing one round of monitoring, the next round of candidate processes can be obtained as candidate processes to be monitored.
作为又一种实施方式,还可基于预设筛选规则,例如,预设诗选规则可以为按连接事件的发生时刻进行筛选,具体地,可按连接事件的发生时刻的先后顺序,对候选进程进行监控,从而对连接事件的发生时刻早的先监控,对连接事件的发生时刻晚的后监控,具体不再赘述。As yet another implementation manner, it can also be based on a preset screening rule. For example, the preset poetry selection rule can be based on the time when the connection event occurs. Specifically, the candidate process Monitoring is performed to monitor the connection event at an early time, and monitor the connection event at a later time. The details are not repeated here.
S323:监控待监控候选进程的连接事件。S323: Monitor connection events of candidate processes to be monitored.
于本实施例中,步骤S323的实施方式与上述步骤S320大致相同,在此不再赘述。In this embodiment, the implementation of step S323 is substantially the same as the foregoing step S320, and will not be repeated here.
S330:若监控到候选进程的连接事件发生,获取候选进程作为目标进程。S330: If it is monitored that the connection event of the candidate process occurs, acquire the candidate process as the target process.
在一些实施方式中,可通过配置审计(audit)配置项来监控候选进程的连接事件,如果有连接事件发生会写入audit日志中,通过审计该audit日志可获取发生连接事件的候选进程对应的进程标识,以进一步获取这些进程标识对应的候选进程作为目标进程。由此从候选进程获取主动请求网络连接的目标进程。In some embodiments, the connection events of the candidate process can be monitored by configuring the audit (audit) configuration item. If a connection event occurs, it will be written to the audit log. By auditing the audit log, the candidate process corresponding to the connection event can be obtained Process IDs to further obtain candidate processes corresponding to these process IDs as target processes. Therefore, the target process that actively requests the network connection is obtained from the candidate process.
S340:获取目标进程的系统调用操作。S340: Obtain a system call operation of the target process.
S350:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S350: If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiment, and details are not described herein again.
在一些实施例中,在获取候选进程时,可查找创建了套接字的进程,再从创建了socket的进程中确定出有使用socket的候选进程。具体地,请参阅图7,图7示出了本申请再一个实施例提供的恶意进程的检测方法,该方法可包括:In some embodiments, when obtaining the candidate process, the process that created the socket may be searched for, and then the process that created the socket may be determined as the candidate process that uses the socket. Specifically, please refer to FIG. 7. FIG. 7 shows a method for detecting a malicious process provided by still another embodiment of the present application. The method may include:
S410:查找第一进程。S410: Find the first process.
其中,第一进程为创建套接字的进程,即为创建了socket的进程,可以包括使用了socket的进程和未使用socket的进程。Among them, the first process is a process that creates a socket, that is, a process that creates a socket, and may include a process that uses a socket and a process that does not use a socket.
在一些实施例中,可先获取所有进程的进程信息,再根据进程信息中是否包含套接字相关的信息,将包含套接字相关的信息的进程信息所对应的进程确定为第一进程,则第一进程的进程信息中包含套接字相关的信息。其具体实施方式可见后述实施例,在此不再赘述。In some embodiments, the process information of all processes may be acquired first, and then the process corresponding to the process information containing socket-related information is determined as the first process according to whether the process information contains socket-related information. Then the process information of the first process includes socket-related information. The specific implementation manner can be seen in the following embodiments, which will not be repeated here.
在另一些实施例中,可直接查找到创建了套接字的进程作为第一进程。在一个示例中,可以使用命令lsof-i实现,其中,lsof的-i选项可以用于列出所有创建了socket的进程,所列出的信息中包括进程的进程标识和所创建套接字对应的套接字索引,则可将命令lsof-i所列出的进程标识对应的进程作为第一进程,从而查找到第一进程。其中,套接字索引用于唯一标识一个套接字。例如,套接字索引可以为套接字的索引节点编号(index node,inode)。在其他示例中,也可使用其他命令来直接查找第一进程,本实施例对此不作限定。In other embodiments, the process that created the socket can be directly found as the first process. In an example, the command lsof-i can be used. The -i option of lsof can be used to list all processes that have created a socket. The listed information includes the process ID of the process and the corresponding socket created If the socket index is specified, the process corresponding to the process identifier listed in the lsof-i command can be used as the first process, so that the first process can be found. Among them, the socket index is used to uniquely identify a socket. For example, the socket index may be the index node (inode) of the socket. In other examples, other commands may also be used to directly search for the first process, which is not limited in this embodiment.
S420:从第一进程中确定候选进程。S420: Determine a candidate process from the first process.
在一些可能的实施例中,可以直接将第一进程作为候选进程。也就是说,将只要创建了socket的进程都确定为候选进程。由于确定候选进程后,根据候选进程确定目标进程时,可通过检测connect()筛除掉仅创建了socket但未使用的这部分进程,甚至如果这部分进程未被筛除掉,仍然被确定为目标进程时,也可以在之后的系统调用操作匹配时,将这部分进程筛除掉,因此直接将第一进程作为候选进程,可实现对恶意进程的检测。In some possible embodiments, the first process can be directly used as a candidate process. In other words, all processes that have created sockets are determined as candidate processes. After the candidate process is determined, when the target process is determined according to the candidate process, the part of the process that only created the socket but is not used can be filtered out by detecting connect(). Even if this part of the process is not filtered out, it is still determined as When the target process is the target process, this part of the process can also be filtered out when the subsequent system call operation matches. Therefore, the first process is directly used as the candidate process to realize the detection of the malicious process.
具体地,由于一般情况下如果没有bind()、listen()或connect(),则不会进入后续的socket I/O调用,则可将创建了socket的进程就直接确定为候选进程,则在后续从候选进程中确定目标进程时,或根据系统调用操作进行匹配时,仍可将仅创建但是未使用socket的这部分进程筛除掉,从而仍可有效检测出不仅创建而且使用了socket,并且具体是使用socket来请求对外连接的恶意进程。因此,在一些可能的实施例中,可直接将第一进程确定为候选进程,此时仍可实现对恶意进程的检测。Specifically, because under normal circumstances, if there is no bind(), listen() or connect(), then subsequent socket I/O calls will not be entered, so the process that created the socket can be directly determined as a candidate process, then When the target process is subsequently determined from the candidate processes, or when the matching is performed according to the system call operation, the part of the process that only creates but does not use the socket can still be filtered out, so that it can still effectively detect that not only the socket is created but also used, and Specifically, it is a malicious process that uses sockets to request external connections. Therefore, in some possible embodiments, the first process can be directly determined as a candidate process, and the malicious process can still be detected at this time.
另外,在一些实施例中,查找到第一进程后也可先检测第一进程的数量是否过超过指定阈值,以在第一进程的数量超过指定阈值时才从第一进程中筛选出候选进程,而在未超过指定阈值时可直接将第一进程作为候选进程,由此,可在第一进程的数量较少,即建立了socket的进程较少时,直接将第一进程作为候选进程来进行后续检测,减少操作步骤,从而有利于提高检测效率。具体地,请参阅图8,图8示出了图7中步骤S420在本申请一个示例性实施例的流程示意图,在该实施例中步骤S420可包括:In addition, in some embodiments, after the first process is found, whether the number of the first process exceeds the specified threshold can be detected first, so that when the number of the first process exceeds the specified threshold, the candidate process can be selected from the first process. , And when the specified threshold is not exceeded, the first process can be directly used as a candidate process. Therefore, when the number of first processes is small, that is, when there are fewer processes that have established sockets, the first process can be directly used as a candidate process. Perform follow-up inspections and reduce operation steps, thereby helping to improve inspection efficiency. Specifically, please refer to FIG. 8. FIG. 8 shows a schematic flowchart of step S420 in FIG. 7 in an exemplary embodiment of the present application. In this embodiment, step S420 may include:
S421:检测第一进程的数量是否超过指定阈值。S421: Detect whether the number of first processes exceeds a specified threshold.
其中,指定阈值可以根据实际需求确定,也可以是系统预设,还可以是用户自定义的,本实施例对此不作限定。在一些实施方式中,指定阈值可由CPU占用率确定,随着CPU占用率的提高,指定阈值可降低,从而可根据当前的系统运行效率调整指定阈值,控制第一进程的数量。The specified threshold may be determined according to actual needs, may also be preset by the system, or may be user-defined, which is not limited in this embodiment. In some embodiments, the specified threshold may be determined by the CPU usage rate. As the CPU usage rate increases, the specified threshold value may be reduced, so that the specified threshold value can be adjusted according to the current system operating efficiency to control the number of first processes.
在一些实施例中,指定阈值大于或等于指定监控数量,以在后续基于指定监控数量控制同时监控的候选进程的数量之前,可先控制第一进程的数量,以避免由第一进程确定的候选进程的数量过多,导致系统运行效率降低。In some embodiments, the specified threshold is greater than or equal to the specified monitoring quantity, so that the number of the first process can be controlled first before the subsequent control of the number of candidate processes monitored at the same time based on the specified monitoring quantity, so as to avoid candidates determined by the first process The number of processes is too large, which reduces the efficiency of the system.
在一些实施例中,检测第一进程的数量是否超过指定阈值,若第一进程的数量超过指定阈值,可执行步骤S422,若第一进程的数量未超过指定阈值,可直接将第一进程作为候选进程,具体实施方式可见步骤S420,在此不再赘述。由此,可在第一进程的数量未超过指定阈值,即创建了socket的进程比较少时,直接将第一进程作为候选进程来进行后续的检测,减少操作步骤,从而有利于提高检测效率。In some embodiments, it is detected whether the number of first processes exceeds a specified threshold. If the number of first processes exceeds the specified threshold, step S422 may be executed. If the number of first processes does not exceed the specified threshold, the first process may be directly used as For the candidate process, the specific implementation can be seen in step S420, which will not be repeated here. As a result, when the number of the first processes does not exceed the specified threshold, that is, when there are fewer processes that have created sockets, the first process can be directly used as a candidate process for subsequent detection, reducing operation steps, thereby helping to improve detection efficiency.
S422:若第一进程的数量超过指定阈值,从第一进程中确定候选进程。S422: If the number of the first process exceeds the specified threshold, determine the candidate process from the first process.
在一些实施方式中,若第一进程的数量超过指定阈值,从第一进程中确定候选进程的具体实施 方式可以为:从第一进程中,查找基于套接字进行网络通信的进程,作为候选进程。具体可见后述实施例,在此不再赘述。In some implementation manners, if the number of the first process exceeds the specified threshold, the specific implementation manner of determining the candidate process from the first process may be: from the first process, find the process that performs network communication based on the socket as a candidate process. The details can be seen in the following embodiments, which will not be repeated here.
S430:根据候选进程确定目标进程。S430: Determine the target process according to the candidate process.
S440:获取目标进程的系统调用操作。S440: Obtain the system call operation of the target process.
S450:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S450: If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
在一些实施例中,可先从第一进程中找到使用了套接字的进程,再将这部分进程确定为候选进程。具体地,请参阅图9,图9示出了本申请还一个实施例提供的恶意进程的检测方法,该方法可包括:In some embodiments, the process using the socket may be found from the first process, and then these processes are determined as candidate processes. Specifically, please refer to FIG. 9. FIG. 9 shows a method for detecting a malicious process according to another embodiment of the present application. The method may include:
S510:获取所有进程对应的进程信息。S510: Acquire process information corresponding to all processes.
其中,进程信息用于记录进程所打开的文件,可包括进程标识以及至少一个文件描述符(file descriptor,fd)信息,每个文件描述符信息中可包括:文件描述符0,1,2……和对象属性。其中,每个文件描述符与对象属性具有一种对应关系,该对象属性可包括对象类型和对象标识。其中,对象类型可包括套接字(socket)、管道(pipe)等,对象标识可包括套接字索引、管道索引(pipe ID或pipe inode)等。Among them, the process information is used to record the files opened by the process, and may include the process identifier and at least one file descriptor (file descriptor, fd) information, and each file descriptor information may include: file descriptors 0, 1, 2,... …And object properties. Among them, each file descriptor has a corresponding relationship with an object attribute, and the object attribute may include an object type and an object identifier. Among them, the object type may include socket, pipe, etc., and the object identifier may include socket index, pipe index (pipe ID or pipe inode), etc.
在一些实施例中,若进程有创建过套接字,对象类型可以为套接字,对象标识可以为该套接字对应的套接字索引,则该进程的进程信息中可包含套接字标识。在一个示例中,套接字标识可以为字段“socket”。In some embodiments, if the process has created a socket, the object type may be a socket, and the object identifier may be the socket index corresponding to the socket, and the process information of the process may include the socket Logo. In one example, the socket identifier may be the field "socket".
另外,进程信息中还可包含套接字标识对应的套接字索引。在一个示例中,套接字索引可以为“socket”后的数字,即若进程创建了socket,其进程信息可包括“socket:[435473]”,其中“435473”为该进程所创建socket的套接字索引。In addition, the process information may also include the socket index corresponding to the socket identifier. In an example, the socket index can be a number after "socket", that is, if a process creates a socket, its process information can include "socket: [435473]", where "435473" is the socket socket created by the process Connector index.
在一个示例中,可通过命令ls-la/proc/pid/fd,获取所有进程对应的进程信息。其中,在Linux系统中的所有进程的全部信息都保存在/proc目录中。In an example, the process information corresponding to all processes can be obtained through the command ls-la/proc/pid/fd. Among them, all the information of all processes in the Linux system are stored in the /proc directory.
S520:获取进程信息中包含套接字标识的进程作为第一进程。S520: Acquire a process including the socket identifier in the process information as the first process.
在一些实施例中,若进程有创建过套接字,该进程的进程信息可包含套接字标识,因此可获取进程信息中包含套接字标识的进程作为第一进程,即创建了套接字的进程。In some embodiments, if the process has created a socket, the process information of the process may include the socket identifier, so the process that contains the socket identifier in the process information can be obtained as the first process, that is, the socket is created Word process.
需要说明的是,第一进程可以只是对一种进程的称谓,这种进程的进程信息中包含socket标识,即主机并不必须要执行获取第一进程的操作,可以只是获取所有进程的进程信息,这些进程信息中存在socket标识和进程标识,则进程信息中包含socket标识的进程可命名为第一进程,该进程的进程标识可记为第一进程的进程标识。It should be noted that the first process can only be a name for a process, and the process information of this process contains the socket identifier, that is, the host does not have to perform the operation of obtaining the first process, but can just obtain the process information of all processes. If the socket identification and the process identification exist in the process information, the process containing the socket identification in the process information can be named the first process, and the process identification of the process can be recorded as the process identification of the first process.
S530:从第一进程中,查找基于套接字进行网络通信的进程,作为候选进程。S530: From the first process, search for a process that performs network communication based on a socket, as a candidate process.
在一些实施例中,从第一进程中,查找基于套接字进行网络通信的进程,作为候选进程时,可以先查找所有进程的进程信息和有被使用过的套接字,再根据二者匹配,确定出使用过套接字建立网络链路的进程,作为候选进程。具体地,请参阅图10,图10示出了图9中步骤S530在本申请一个示例性实施例的流程示意图,在该实施例中步骤S530可包括:In some embodiments, from the first process, search for processes that perform network communication based on sockets. As a candidate process, you can first search for process information of all processes and sockets that have been used, and then according to both Match, determine the process that has used the socket to establish a network link, as a candidate process. Specifically, please refer to FIG. 10, which shows a schematic flowchart of step S530 in FIG. 9 in an exemplary embodiment of the present application. In this embodiment, step S530 may include:
S531:获取用于建立网络链路进行网络通信的套接字对应的第一套接字索引。S531: Acquire a first socket index corresponding to a socket used to establish a network link for network communication.
其中,用于建立网络链路进行网络通信的套接字为有使用过的套接字,即不包含仅创建但未被使用的套接字。在一些实施例中,这类套接字有通过bind()绑定端口,或有通过connect()发送连接请求。因此,通过获取这类套接字的套接字索引作为第一套接字索引,可用于筛除掉建立了套接字但未使用的第一进程,使得从第一进程中确定的候选进程不包含仅创建了套接字但未使用的进程。Among them, sockets used to establish network links for network communication are used sockets, that is, sockets that are only created but not used are not included. In some embodiments, this type of socket binds a port through bind(), or sends a connection request through connect(). Therefore, by obtaining the socket index of this type of socket as the first socket index, it can be used to filter out the first process that has established a socket but is not used, so that the candidate process is determined from the first process Processes that only created sockets but are not used are not included.
在一个示例中,可采用命令cat/proc/net/tcp来获取用于建立网络链路进行网络通信的套接字,在/proc/net/tcp目录下包含的不仅是创建了socket而且是有使用socket的socket信息,socket信息中包含套接字的套接字索引,可将用于建立网络链路进行网络通信的套接字对应的套接字索引记为第一套接字索引。In an example, the command cat/proc/net/tcp can be used to obtain the socket used to establish a network link for network communication. The /proc/net/tcp directory contains not only the creation of the socket but also the Using the socket information of the socket, the socket information contains the socket index of the socket, and the socket index corresponding to the socket used to establish a network link for network communication can be recorded as the first socket index.
S532:获取第一进程创建的套接字对应的第二套接字索引。S532: Obtain a second socket index corresponding to the socket created by the first process.
在一些实施例中,在步骤S532之前,可获取所有进程的进程信息,并获取进程信息中包含套接 字标识的进程作为第一进程,第一进程的进程信息中还包含套接字标识对应的套接字索引,因此,可基于所有进程的进程信息,获取第一进程创建的套接字对应的套接字索引作为第二套接字索引。In some embodiments, before step S532, the process information of all processes can be obtained, and the process that contains the socket identifier in the process information is obtained as the first process, and the process information of the first process also includes the corresponding socket identifier. Therefore, based on the process information of all processes, the socket index corresponding to the socket created by the first process can be obtained as the second socket index.
由于进程信息中包含进程标识即pid、套接字标识以及套接字索引,但进程信息中的套接字标识所对应的套接字可能只是创建了但未被使用,因此还需要将第二套接字索引与第一套接字索引进行匹配,以从第一进程中确定出使用了套接字的候选进程。Since the process information contains the process ID, namely the pid, the socket ID, and the socket index, the socket corresponding to the socket ID in the process information may have only been created but not used, so the second The socket index is matched with the first socket index to determine a candidate process that uses the socket from the first process.
S533:将第一套接字索引与第二套接字索引进行匹配,获取基于套接字进行网络通信的进程,作为候选进程。S533: The first socket index is matched with the second socket index, and a process that performs network communication based on the socket is obtained as a candidate process.
根据前述说明,第一套接字索引对应的套接字为不仅创建了而且有使用的套接字,第二套接字索引对应的套接字为创建了套接字但不一定有使用过的套接字,因此为了得到有使用过套接字的候选进程,可将第一套接字索引与第二套接字索引进行匹配,将与第一套接字索引匹配的第二套接字索引对应的进程作为候选进程。According to the foregoing description, the socket corresponding to the first socket index is a socket that is not only created but also used, and the socket corresponding to the second socket index is a socket created but not necessarily used Socket, so in order to get candidate processes that have used sockets, the first socket index can be matched with the second socket index, and the second socket that matches the first socket index The process corresponding to the word index is used as a candidate process.
在一个示例中,可通过命令ls-la/proc/pid/fd获取所有进程的进程信息,通过命令cat/proc/net/tcp获取套接字的inode编号作为第一套接字索引,再通过inode编号在进程信息中找到inode编号对应的pid,将pid对应的进程确定为候选进程。In an example, the process information of all processes can be obtained by the command ls-la/proc/pid/fd, and the inode number of the socket can be obtained by the command cat/proc/net/tcp as the first socket index, and then pass Inode number Find the pid corresponding to the inode number in the process information, and determine the process corresponding to the pid as a candidate process.
在另一个示例中,可基于前述获取所有进程的进程信息的命令基础上,通过关键字筛选,例如可以将套接字标识作为关键字段,利用grep管道过滤出想要的关键字段,获取进程信息中包含套接字标识的进程,得到第一进程的进程信息,将其中套接字标识对应的inode编号作为第二套接字索引,通过命令cat/proc/net/tcp获取套接字的inode编号作为第一套接字索引,将第一套接字索引与第二套接字索引进行匹配,得到与第一套接字索引匹配的第二套接字索引对应的pid,将pid对应的进程确定为候选进程。In another example, you can filter by keywords based on the aforementioned command to obtain process information of all processes. For example, you can use the socket identifier as the key field, and use the grep pipeline to filter out the key fields you want to obtain The process information contains the socket ID process, get the process information of the first process, use the inode number corresponding to the socket ID as the second socket index, and get the socket through the command cat/proc/net/tcp The inode number is used as the first socket index, the first socket index is matched with the second socket index, and the pid corresponding to the second socket index matching the first socket index is obtained, and the pid The corresponding process is determined as a candidate process.
以上仅为示例,在其他示例中还可采用其他的命令,本实施例对此不作限定。The above are only examples, and other commands may be used in other examples, which is not limited in this embodiment.
S540:根据候选进程确定目标进程。S540: Determine the target process according to the candidate process.
S550:获取目标进程的系统调用操作。S550: Obtain a system call operation of the target process.
S560:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S560: If the system call operation matches the target system call operation, determine that the target process is a malicious process.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
另外,在一些实施例中,可以直接查找到基于套接字进行网络通信的进程,即使用了套接字的进程,作为候选进程,由此,可以无需先查找建立了socket的进程,再检测socket是否有被使用来确定候选进程,减少检测步骤,大大提高检测效率,有利于更快更及时地检测出恶意进程,以便及时阻止恶意进程的继续攻击。具体地,请参阅图11,图11示出了本申请又另一个实施例提供的恶意进程的检测方法,该方法可包括:In addition, in some embodiments, the process of network communication based on sockets can be directly found, that is, processes that use sockets are used as candidate processes. Therefore, there is no need to find processes that have established sockets first, and then detect Whether the socket is used to determine the candidate process, reduce the detection steps, greatly improve the detection efficiency, and help to detect the malicious process faster and in time, so as to prevent the malicious process from continuing attacks in time. Specifically, please refer to FIG. 11. FIG. 11 shows a method for detecting a malicious process according to yet another embodiment of the present application. The method may include:
S610:查找基于套接字进行网络通信的进程,作为候选进程。S610: Find a process that performs network communication based on a socket, as a candidate process.
在一些实施例中,可通过命令netstat查找到基于套接字进行网络通信的进程,该命令一般可用于检验本机各端口的网络连接情况。。在一个示例中,可通过命令netstat-tunpa来查找得到。In some embodiments, the process of network communication based on sockets can be found through the command netstat. This command can generally be used to check the network connection of each port of the machine. . In an example, it can be found through the command netstat-tunpa.
由于通过netstat命令得到的信息可以包括存在TCP、UDP连接的进程pid,而netstat命令不会统计只是创建却没有使用(bind或connect)的socket,因此,可以直接查找到有使用socket进行网络通信的进程,作为候选进程。Since the information obtained through the netstat command can include the process pids that have TCP and UDP connections, the netstat command will not count sockets that are just created but not used (bind or connect), so you can directly find the sockets for network communication. Process, as a candidate process.
另外,在一些实施例中,由于第一主机和第二主机基于UDP行通信时,第一主机发送的信息可能没有被第二主机接收到,或者第二主机发送的信息可能没被第一主机接收到,即可能出现信息传输丢失,导致部分攻击的命令没有被第一主机接收到。因此,可以通过先检测基于TCP通信协议进行网络通信的进程,可先检测出威胁程度更高的恶意进程,以便更及时作出处理,以及时解决安全威胁。In addition, in some embodiments, when the first host and the second host communicate based on UDP, the information sent by the first host may not be received by the second host, or the information sent by the second host may not be received by the first host. If it is received, there may be a loss of information transmission, causing part of the attack command to not be received by the first host. Therefore, by first detecting the process of network communication based on the TCP communication protocol, the malicious process with a higher degree of threat can be detected first, so that it can be dealt with in a more timely manner and the security threat can be solved in a timely manner.
作为一种实施方式,步骤S610的具体实施方式可以为:查找基于TCP进行网络通信的进程,作为候选进程。As an implementation manner, a specific implementation manner of step S610 may be: searching for a process that performs network communication based on TCP as a candidate process.
作为另一种实施方式,也可先检测基于TCP进行网络通信的进程,再检测基于UDP进行网络通信的进程,以先检测威胁程度更高的恶意进程,再检测威胁程度较低的恶意进程,从而在对恶意进程实现检测的基础上,还兼顾威胁程度和检测效率,使得威胁程度更高的恶意进程可以被更早或更 及时检测出来,以阻止该恶意进程的继续攻击,及时避免给被入侵主机带来更大的损害。As another implementation manner, it is also possible to first detect the process of network communication based on TCP, and then detect the process of network communication based on UDP, so as to detect malicious processes with a higher degree of threat first, and then detect malicious processes with a lower degree of threat. Therefore, in addition to the detection of malicious processes, the threat level and detection efficiency are also taken into consideration, so that malicious processes with higher threat levels can be detected earlier or in time, so as to prevent the continued attacks of the malicious process and avoid being victimized in time. Invading the host brings greater damage.
S620:根据候选进程确定目标进程。S620: Determine the target process according to the candidate process.
S630:获取目标进程的系统调用操作。S630: Obtain a system call operation of the target process.
S640:若系统调用操作与目标系统调用操作匹配,确定目标进程为恶意进程。S640: If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
需要说明的是,上述步骤中未详细描述的部分,可参考前述实施例,在此不再赘述。It should be noted that, for the parts that are not described in detail in the foregoing steps, reference may be made to the foregoing embodiments, and details are not described herein again.
下面以图12为例,对基于本申请一个示例性实施例提供的恶意进程的检测方法,实现对反弹shell进程的检测进行说明。具体如下:Hereinafter, taking FIG. 12 as an example, the method for detecting a malicious process provided by an exemplary embodiment of the present application will be described to realize the detection of a rebound shell process. details as follows:
该方法可应用于主机,并具体地,主机运行有反弹shell检测模块,反弹shell检测模块可用于执行本申请实施例提供的方法。This method can be applied to the host, and specifically, the host runs a rebound shell detection module, and the rebound shell detection module can be used to execute the method provided in the embodiments of the present application.
反弹shell检测模块启动后会通过遍历主机/proc目录,获取所有的进程信息,其中,进程信息包括进程标识即pid以及对外连接信息,对外连接信息可包括socket标识和socket标识对应的inode编号。在一个示例中,获取所有进程信息的方式可以是通过命令:ls-la/proc/pid/fd。After the rebound shell detection module is started, it will obtain all process information by traversing the host /proc directory. Among them, the process information includes the process ID (pid) and external connection information, and the external connection information can include the socket ID and the inode number corresponding to the socket ID. In an example, the way to obtain all process information can be through the command: ls-la/proc/pid/fd.
然后关联进程和对外连接信息,只关注存在对外连接信息的进程,具体地,可通过命令cat/proc/net/tcp找到inode编号,再通过inode编号找到pid对应的进程。Then associate the process and external connection information, and only focus on the process with external connection information. Specifically, the inode number can be found through the command cat/proc/net/tcp, and then the process corresponding to the pid can be found through the inode number.
S1:对此类进程使用audit监控connect事件。S1: Use audit to monitor connect events for such processes.
S2:查看是否有使用socket主动建立对外网的连接S2: Check whether there is an active connection to the external network using socket
S3:若有进程主动建立对外网的连接,则监控该进程的文件和socket IO函数,由此监控socket的IO调用,可得到该进程的系统调用操作。S3: If a process actively establishes a connection to the external network, monitor the file and socket IO function of the process, and thus monitor the IO call of the socket, and obtain the system call operation of the process.
S4:记录并分析该进程的系统调用序列,一般shell进程的系统调用序列会满足如下特点:S4: Record and analyze the system call sequence of the process. Generally, the system call sequence of the shell process will meet the following characteristics:
等待socket上的数据->读socket->执行命令->写socket->->等待socket上的数据。(即前述系统调用序列为shell进程的系统调用序列)Waiting for data on socket->read socket->execute command->write socket->->wait for data on socket. (That is, the aforementioned system call sequence is the system call sequence of the shell process)
S5:若该进程的系统调用序列与shell进程的系统调用序列匹配,即该进程的系统调用序列的规律符合shell进程的系统调用序列的规律,可判定该进程为反弹shell进程。S5: If the system call sequence of the process matches the system call sequence of the shell process, that is, the law of the system call sequence of the process conforms to the law of the system call sequence of the shell process, it can be determined that the process is a reverse shell process.
S6:若该进程的系统调用序列与shell进程的系统调用序列不匹配,即该进程的系统调用序列的规律不符合shell进程的系统调用序列的规律,可判定该进程为非反弹shell进程,在一些实施例中,也可称为正常进程。S6: If the system call sequence of the process does not match the system call sequence of the shell process, that is, the law of the system call sequence of the process does not conform to the law of the system call sequence of the shell process, it can be determined that the process is a non-reverse shell process. In some embodiments, it may also be referred to as a normal process.
由此本实施例通过监控进程的对外网络连接,获取存在对外网络连接的进程,再通过检测该进程的系统调用序列是否符合shell进程的系统调用序列的规律,来判断该进程是否为反弹shell进程。从而可以有效检测各种不使用系统自带的shell所建立的反弹shell进程,如对于metasploit等黑客工具生成的或者黑客编写的命令解释器等所建立的反弹shell程序均有很好的识别效果。再者由于一般情况下,服务器对外连接事件的数量比shell进程的创建数量更少,因此模块检测效率更高,检测性能也会更优。Therefore, this embodiment monitors the external network connection of the process to obtain the process with external network connection, and then determines whether the process is a rebound shell process by detecting whether the system call sequence of the process conforms to the law of the system call sequence of the shell process . So it can effectively detect all kinds of reverse shell processes that do not use the shell that comes with the system, such as those generated by hacker tools such as Metasploit or command interpreters written by hackers, etc., which have a good recognition effect. Moreover, since the number of external connection events of the server is generally less than the number of creation of shell processes, the detection efficiency of the module is higher, and the detection performance will be better.
请参阅图13,其示出了本申请实施例提供的一种恶意进程的检测装置的结构框图,该恶意进程的检测装置1300可以包括:进程获取模块1310、操作获取模块1320以及操作匹配模块1330。Please refer to FIG. 13, which shows a structural block diagram of a malicious process detection apparatus provided by an embodiment of the present application. The malicious process detection apparatus 1300 may include: a process acquisition module 1310, an operation acquisition module 1320, and an operation matching module 1330 .
进程获取模块1310,用于获取请求网络连接的目标进程;The process acquisition module 1310 is used to acquire the target process requesting network connection;
操作获取模块1320,用于获取所述目标进程的系统调用操作;The operation acquisition module 1320 is used to acquire the system call operation of the target process;
操作匹配模块1330,用于若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程。The operation matching module 1330 is configured to determine that the target process is a malicious process if the system call operation matches the target system call operation.
进一步地,所述系统调用操作的数量为多个,所述目标系统调用操作的数量为多个,所述操作匹配模块1330包括:次序匹配子模块,其中:Further, the number of the system call operations is multiple, the number of the target system call operations is multiple, and the operation matching module 1330 includes: an order matching submodule, wherein:
次序匹配子模块,用于若多个所述系统调用操作的执行次序与多个所述目标系统调用操作的执行次序匹配,确定所述目标进程为恶意进程。The order matching sub-module is configured to determine that the target process is a malicious process if the execution order of the multiple system call operations matches the execution order of the multiple target system call operations.
进一步地,多个所述目标系统调用操作的执行次序由shell进程依次序执行的系统调用操作确定。Further, the execution order of the multiple target system call operations is determined by the system call operations executed sequentially by the shell process.
进一步地,多个所述目标系统调用操作依次序包括:等待套接字上的数据、读数据、执行命令、写数据、等待套接字上的数据。Further, the sequence of the multiple target system call operations includes: waiting for data on the socket, reading data, executing a command, writing data, and waiting for data on the socket.
进一步地,所述进程获取模块1310包括:候选进程获取子模块以及目标进程确定子模块,其中:Further, the process acquisition module 1310 includes: a candidate process acquisition sub-module and a target process determination sub-module, wherein:
候选进程获取子模块,用于获取候选进程,所述候选进程为基于套接字进行网络通信的进程;Candidate process acquisition sub-module for acquiring candidate processes, the candidate process being a process that performs network communication based on a socket;
目标进程确定子模块,用于根据所述候选进程确定目标进程,所述目标进程为基于套接字请求网络连接的进程。The target process determining sub-module is configured to determine a target process according to the candidate process, and the target process is a process that requests a network connection based on a socket.
进一步地,所述目标进程确定子模块还包括:连接事件监控单元以及目标进程获取单元,其中:Further, the target process determining submodule further includes: a connection event monitoring unit and a target process acquiring unit, wherein:
连接事件监控单元,用于监控所述候选进程的连接事件,所述连接事件用于请求网络连接;The connection event monitoring unit is used to monitor the connection event of the candidate process, and the connection event is used to request a network connection;
目标进程获取单元,用于若监控到所述候选进程的连接事件发生,获取所述候选进程作为目标进程。The target process obtaining unit is configured to obtain the candidate process as the target process if the connection event of the candidate process is monitored.
进一步地,所述连接事件监控单元包括:监控数量检测子单元、待监控进程确定子单元以及进程监控子单元,其中:Further, the connection event monitoring unit includes: a monitoring quantity detection subunit, a process to be monitored determination subunit, and a process monitoring subunit, wherein:
监控数量检测子单元,用于检测所述候选进程的数量是否超过指定监控数量;The monitoring quantity detection subunit is used to detect whether the number of the candidate processes exceeds the specified monitoring quantity;
待监控进程确定子单元,用于若所述候选进程的数量超过指定监控数量,从所述候选进程中确定待监控候选进程;The process to be monitored determination subunit is configured to determine the candidate process to be monitored from the candidate processes if the number of the candidate processes exceeds the specified monitoring number;
进程监控子单元,用于确定监控所述待监控候选进程的连接事件。The process monitoring subunit is used to determine and monitor the connection event of the candidate process to be monitored.
进一步地,所述候选进程获取子模块包括:第一进程查找单元以及第一候选确定单元,其中:Further, the candidate process acquisition sub-module includes: a first process search unit and a first candidate determination unit, wherein:
第一进程查找单元,用于查找第一进程,所述第一进程为创建套接字的进程;The first process search unit is configured to search for a first process, and the first process is a process that creates a socket;
第一候选确定单元,用于从所述第一进程中确定候选进程。The first candidate determining unit is configured to determine a candidate process from the first process.
进一步地,所述第一进程查找单元包括:进程信息获取子单元以及套接字标识确定子单元,其中:Further, the first process searching unit includes: a process information acquiring subunit and a socket identification determining subunit, wherein:
进程信息获取子单元,用于获取所有进程对应的进程信息,所述进程信息用于记录该进程所打开的文件;The process information obtaining subunit is used to obtain process information corresponding to all processes, and the process information is used to record the files opened by the process;
第一进程确定子单元,用于获取所述进程信息中包含套接字标识的进程作为第一进程。The first process determining subunit is used to obtain the process containing the socket identifier in the process information as the first process.
进一步地,所述第一候选确定单元包括:第一候选确定子单元,其中:Further, the first candidate determining unit includes: a first candidate determining subunit, wherein:
第一候选确定子单元,用于从所述第一进程中,查找基于套接字进行网络通信的进程,作为候选进程。The first candidate determination subunit is configured to search for a socket-based network communication process from the first process as a candidate process.
进一步地,所述第一候选确定子单元包括:第一索引获取次子单元、第二索引获取次子单元以及索引匹配次子单元,其中:Further, the first candidate determining subunit includes: a first index obtaining subunit, a second index obtaining subunit, and an index matching subunit, wherein:
第一索引获取次子单元,用于获取用于建立网络链路进行网络通信的套接字对应的第一套接字索引;The first index obtaining sub-unit is used to obtain the first socket index corresponding to the socket used to establish a network link for network communication;
第二索引获取次子单元,用于获取所述第一进程创建的套接字对应的第二套接字索引;The second index obtaining sub-unit is used to obtain the second socket index corresponding to the socket created by the first process;
索引匹配次子单元,用于将所述第一套接字索引与所述第二套接字索引进行匹配,获取基于套接字进行网络通信的进程,作为候选进程。The index matching subunit is used to match the first socket index with the second socket index, and obtain a socket-based network communication process as a candidate process.
进一步地,所述第一候选确定单元包括:第二候选确定子单元,其中:Further, the first candidate determining unit includes: a second candidate determining subunit, wherein:
所述第二候选确定子单元,用于查找基于套接字进行网络通信的进程,作为候选进程。The second candidate determination subunit is used to search for a socket-based network communication process as a candidate process.
进一步地,所述候选进程获取子模块包括:第二候选确定单元,其中:Further, the candidate process acquiring submodule includes: a second candidate determining unit, wherein:
所述第二候选确定单元,用于查找基于套接字进行网络通信的进程,作为候选进程。The second candidate determining unit is used to search for a process that performs network communication based on a socket, as a candidate process.
进一步地,所述第二候选确定单元包括:第三候选确定子单元,其中:Further, the second candidate determining unit includes: a third candidate determining subunit, wherein:
所述第三候选确定子单元,用于查找基于TCP通信协议进行网络通信的进程,作为候选进程。The third candidate determination subunit is used to find a process for network communication based on the TCP communication protocol as a candidate process.
进一步地,所述恶意进程的检测装置1300还包括:进程终止模块,其中:Further, the device 1300 for detecting a malicious process further includes: a process termination module, wherein:
进程终止模块,用于对恶意进程执行终止处理。The process termination module is used to perform termination processing on the malicious process.
本申请实施例提供的恶意进程的检测装置用于实现前述方法实施例中相应的恶意进程的检测方法,并具有相应的方法实施例的有益效果,在此不再赘述。The malicious process detection apparatus provided in the embodiment of the present application is used to implement the corresponding malicious process detection method in the foregoing method embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the device and module described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。In the several embodiments provided in this application, the coupling between the modules may be electrical, mechanical or other forms of coupling.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
请参考图14,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设备1400可以是智能手机、平板电脑、电子书、个人计算机、服务器等能够运行应用程序的电子设备。本申请中的电子设备1400可以包括一个或多个如下部件:处理器1410、存储器1420、以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器1420中并被配置为由一个或多个处理器1410执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。Please refer to FIG. 14, which shows a structural block diagram of an electronic device provided by an embodiment of the present application. The electronic device 1400 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, an e-book, a personal computer, or a server. The electronic device 1400 in this application may include one or more of the following components: a processor 1410, a memory 1420, and one or more application programs, where one or more application programs may be stored in the memory 1420 and configured to be configured by One or more processors 1410 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
处理器1410可以包括一个或者多个处理核。处理器1410利用各种接口和线路连接整个电子设备1400内的各个部分,通过运行或执行存储在存储器1420内的指令、程序、代码集或指令集,以及调用存储在存储器1420内的数据,执行电子设备1400的各种功能和处理数据。可选地,处理器1410可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1410可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1410中,单独通过一块通信芯片进行实现。The processor 1410 may include one or more processing cores. The processor 1410 uses various interfaces and lines to connect various parts of the entire electronic device 1400, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1420, and calling data stored in the memory 1420. Various functions and processing data of the electronic device 1400. Optionally, the processor 1410 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). A kind of hardware form to realize. The processor 1410 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor 1410, but may be implemented by a communication chip alone.
进一步地,处理器1410还包括:外部存储设备管理模块1411以及存储管理服务模块1414。其中,外部存储设备管理模块1411可以是安卓(Android)平台中外部存储系统的管控中心,是管理和控制Android平台外部存储设备的后台进程。其功能主要包括:外部存储设备的插拔事件检测、外部存储设备的挂载、卸载、格式化等;存储管理服务模块1414为Android系统框架层与外部存储设备管理模块1411进行通信的模块,同时存储管理服务模块1414也是向应用提供存储访问接口及存储挂载消息广播的模块。进一步地,在一种实施方式中,外部存储设备管理模块1411与存储管理服务模块1414可以基于Binder通信机制进行通信。Further, the processor 1410 further includes: an external storage device management module 1411 and a storage management service module 1414. Wherein, the external storage device management module 1411 may be the management and control center of the external storage system in the Android platform, and is a background process for managing and controlling the external storage device of the Android platform. Its functions mainly include: external storage device plug-in event detection, external storage device mounting, unloading, formatting, etc.; storage management service module 1414 is a module for the Android system framework layer to communicate with the external storage device management module 1411, and at the same time The storage management service module 1414 is also a module that provides storage access interfaces and storage mounting message broadcasts to applications. Further, in an implementation manner, the external storage device management module 1411 and the storage management service module 1414 may communicate based on the Binder communication mechanism.
存储器1420可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器1420可用于存储指令、程序、代码、代码集或指令集。存储器1420可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备1400在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 1420 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 1420 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1420 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc. The data storage area can also store data created by the electronic device 1400 during use (such as phone book, audio and video data, chat record data) and the like.
则如果上述图13所示的恶意进程的检测装置中的各个单元作为程序包等函数模块的话,该恶意进程的检测装置内的各个单元存储在存储器1420内,能够被处理器调用,并执行对应的功能。If each unit in the malicious process detection device shown in FIG. 13 is used as a function module such as a program package, each unit in the malicious process detection device is stored in the memory 1420 and can be called by the processor and executes the corresponding Function.
请参考图15,其示出了本申请实施例提供的一种计算机可读取存储介质的结构框图。该计算机可读取存储介质1500中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 15, which shows a structural block diagram of a computer readable storage medium provided by an embodiment of the present application. The computer readable storage medium 1500 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
计算机可读取存储介质1500可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读取存储介质1500包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读取存储介质1500具有执行上述方法中的任何方法步骤的程序代码1510的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1510可以例如以适当形式进行压缩。The computer readable storage medium 1500 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1500 includes a non-transitory computer-readable storage medium. The computer readable storage medium 1500 has storage space for the program code 1510 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products. The program code 1510 may be compressed in an appropriate form, for example.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features thereof are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种恶意进程的检测方法,其特征在于,所述方法包括:A method for detecting malicious processes, characterized in that the method includes:
    获取请求网络连接的目标进程;Obtain the target process requesting a network connection;
    获取所述目标进程的系统调用操作;Acquiring the system call operation of the target process;
    若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程。If the system call operation matches the target system call operation, it is determined that the target process is a malicious process.
  2. 根据权利要求1所述的方法,其特征在于,所述系统调用操作的数量为多个,所述目标系统调用操作的数量为多个,所述根据所述系统调用操作是否与目标系统调用操作匹配,确定所述目标进程为恶意进程,包括:The method according to claim 1, wherein the number of the system call operation is multiple, the number of the target system call operation is multiple, and the system call operation is based on whether the system call operation is the same as the target system call operation. Matching, determining that the target process is a malicious process, including:
    若多个所述系统调用操作的执行次序与多个所述目标系统调用操作的执行次序匹配,确定所述目标进程为恶意进程。If the execution order of the multiple system call operations matches the execution order of the multiple target system call operations, it is determined that the target process is a malicious process.
  3. 根据权利要求2所述的方法,其特征在于,多个所述目标系统调用操作的执行次序由shell进程依次序执行的系统调用操作确定。The method according to claim 2, wherein the execution order of the multiple target system call operations is determined by the system call operations executed sequentially by the shell process.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,多个所述目标系统调用操作依次序包括:等待套接字上的数据、读数据、执行命令、写数据、等待套接字上的数据。The method according to any one of claims 1-3, wherein the sequence of a plurality of the target system call operations includes: waiting for data on the socket, reading data, executing commands, writing data, waiting for the socket Data on the word.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述获取请求网络连接的目标进程,包括:The method according to any one of claims 1 to 4, wherein said acquiring a target process requesting a network connection comprises:
    获取候选进程,所述候选进程为基于套接字进行网络通信的进程;Acquiring a candidate process, where the candidate process is a process that performs network communication based on a socket;
    根据所述候选进程确定目标进程,所述目标进程为基于套接字请求网络连接的进程。A target process is determined according to the candidate process, and the target process is a process that requests a network connection based on a socket.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述候选进程确定目标进程,包括:The method according to claim 5, wherein the determining a target process according to the candidate process comprises:
    监控所述候选进程的连接事件,所述连接事件用于请求网络连接;Monitoring the connection event of the candidate process, the connection event is used to request a network connection;
    若监控到所述候选进程的连接事件发生,获取所述候选进程作为目标进程。If it is monitored that the connection event of the candidate process occurs, the candidate process is acquired as the target process.
  7. 根据权利要求6所述的方法,其特征在于,所述监控所述候选进程的连接事件,包括:The method according to claim 6, wherein the monitoring the connection event of the candidate process comprises:
    检测所述候选进程的数量是否超过指定监控数量;Detecting whether the number of candidate processes exceeds a specified monitoring number;
    若所述候选进程的数量超过指定监控数量,从所述候选进程中确定待监控候选进程;If the number of the candidate processes exceeds the designated monitoring quantity, determine the candidate processes to be monitored from the candidate processes;
    监控所述待监控候选进程的连接事件。Monitor the connection event of the candidate process to be monitored.
  8. 根据权利要求5-7任一项所述的方法,其特征在于,所述获取候选进程,包括:The method according to any one of claims 5-7, wherein said obtaining candidate processes comprises:
    查找第一进程,所述第一进程为创建套接字的进程;Find a first process, where the first process is a process that creates a socket;
    从所述第一进程中确定候选进程。A candidate process is determined from the first process.
  9. 根据权利要求8所述的方法,其特征在于,所述查找第一进程,包括:The method according to claim 8, wherein said searching for the first process comprises:
    获取所有进程对应的进程信息,所述进程信息用于记录该进程所打开的文件;Acquiring process information corresponding to all processes, where the process information is used to record files opened by the process;
    获取所述进程信息中包含套接字标识的进程作为第一进程。The process that contains the socket identifier in the process information is acquired as the first process.
  10. 根据权利要求8或9所述的方法,其特征在于,所述从所述第一进程中确定候选进程,包括:The method according to claim 8 or 9, wherein the determining a candidate process from the first process comprises:
    检测所述第一进程的数量是否超过指定阈值,所述指定阈值大于或等于指定监控数量;Detecting whether the number of the first processes exceeds a specified threshold, and the specified threshold is greater than or equal to a specified monitoring number;
    若所述第一进程的数量超过所述指定阈值,从所述第一进程中确定候选进程。If the number of the first process exceeds the specified threshold, a candidate process is determined from the first process.
  11. 根据权利要求8-10任一项所述的方法,其特征在于,所述从所述第一进程中确定候选进程,包括:The method according to any one of claims 8-10, wherein the determining a candidate process from the first process comprises:
    从所述第一进程中,查找基于套接字进行网络通信的进程,作为候选进程。From the first process, a process that performs network communication based on a socket is searched for as a candidate process.
  12. 根据权利要求11所述的方法,其特征在于,所述从所述第一进程中,查找基于套接字进行网络通信的进程,作为候选进程,包括:The method according to claim 11, wherein the searching for a socket-based network communication process from the first process as a candidate process comprises:
    获取用于建立网络链路进行网络通信的套接字对应的第一套接字索引;Obtaining a first socket index corresponding to a socket used to establish a network link for network communication;
    获取所述第一进程创建的套接字对应的第二套接字索引;Acquiring a second socket index corresponding to the socket created by the first process;
    将所述第一套接字索引与所述第二套接字索引进行匹配,获取基于套接字进行网络通信的进程,作为候选进程。The first socket index is matched with the second socket index, and the process of network communication based on the socket is obtained as a candidate process.
  13. 根据权利要求8或9所述的方法,其特征在于,所述从所述第一进程中确定候选进程,包括:The method according to claim 8 or 9, wherein the determining a candidate process from the first process comprises:
    将所述第一进程作为候选进程。Use the first process as a candidate process.
  14. 根据权利要求4-7任一项所述的方法,其特征在于,所述获取候选进程,包括:The method according to any one of claims 4-7, wherein said obtaining candidate processes comprises:
    查找基于套接字进行网络通信的进程,作为候选进程。Find the process based on socket for network communication, as a candidate process.
  15. 根据权利要求11-14任一项所述的方法,其特征在于,所述查找基于套接字进行网络通信的进程,作为候选进程,包括:The method according to any one of claims 11-14, wherein the searching for a socket-based network communication process as a candidate process comprises:
    查找基于TCP通信协议进行网络通信的进程,作为候选进程。Find the process of network communication based on the TCP communication protocol as a candidate process.
  16. 根据权利要求1-15任一项所述的方法,其特征在于,所述若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程之后,所述方法还包括:The method according to any one of claims 1-15, wherein if the system call operation matches a target system call operation, after determining that the target process is a malicious process, the method further comprises:
    对恶意进程执行终止处理。Perform termination processing on the malicious process.
  17. 一种恶意进程的检测装置,其特征在于,所述装置包括:A detection device for malicious processes, characterized in that the device includes:
    进程获取模块,用于获取请求网络连接的目标进程;Process acquisition module, used to acquire the target process requesting network connection;
    操作获取模块,用于获取所述目标进程的系统调用操作;The operation acquisition module is used to acquire the system call operation of the target process;
    操作匹配模块,用于若所述系统调用操作与目标系统调用操作匹配,确定所述目标进程为恶意进程。The operation matching module is configured to determine that the target process is a malicious process if the system call operation matches the target system call operation.
  18. 根据权利要求17所述的装置,其特征在于,所述进程获取模块,包括:The device according to claim 17, wherein the process acquisition module comprises:
    候选进程获取子模块,用于获取候选进程,所述候选进程为基于套接字进行网络通信的进程;Candidate process acquisition sub-module for acquiring candidate processes, the candidate process being a process that performs network communication based on a socket;
    连接事件监控子模块,用于监控所述候选进程的连接事件,所述连接事件用于请求网络连接;The connection event monitoring sub-module is used to monitor the connection event of the candidate process, and the connection event is used to request a network connection;
    目标进程获取子模块,用于若监控到所述候选进程的连接事件发生,获取所述候选进程作为目标进程。The target process acquisition sub-module is configured to acquire the candidate process as the target process if the connection event of the candidate process is monitored.
  19. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储器;Memory
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1-16任一项所述的方法。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute such as The method of any one of claims 1-16.
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-16任一项所述的方法。A computer readable storage medium, wherein the computer readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1-16 .
PCT/CN2020/080922 2020-03-24 2020-03-24 Malicious process detection method and apparatus, electronic device, and storage medium WO2021189257A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080094694.3A CN115023699A (en) 2020-03-24 2020-03-24 Malicious process detection method and device, electronic device and storage medium
PCT/CN2020/080922 WO2021189257A1 (en) 2020-03-24 2020-03-24 Malicious process detection method and apparatus, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/080922 WO2021189257A1 (en) 2020-03-24 2020-03-24 Malicious process detection method and apparatus, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2021189257A1 true WO2021189257A1 (en) 2021-09-30

Family

ID=77890894

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080922 WO2021189257A1 (en) 2020-03-24 2020-03-24 Malicious process detection method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN115023699A (en)
WO (1) WO2021189257A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285621A (en) * 2021-12-20 2022-04-05 北京安天网络安全技术有限公司 Network threat monitoring method and device and electronic equipment
CN115002186A (en) * 2022-05-17 2022-09-02 深信服科技股份有限公司 Network information acquisition method and device, electronic equipment and readable storage medium
CN116112295A (en) * 2023-04-12 2023-05-12 北京长亭未来科技有限公司 Method and device for researching and judging external connection type attack result
CN116484364A (en) * 2023-02-03 2023-07-25 安芯网盾(北京)科技有限公司 Hidden port detection method and device based on Linux kernel

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350052A (en) * 2007-10-15 2009-01-21 北京瑞星国际软件有限公司 Method and apparatus for discovering malignancy of computer program
CN103023912A (en) * 2012-12-26 2013-04-03 蓝盾信息安全技术股份有限公司 Method for preventing network attacks based on virtual machines
CN103839005A (en) * 2013-11-22 2014-06-04 北京智谷睿拓技术服务有限公司 Malware detection method and malware detection system of mobile operating system
CN106033511A (en) * 2015-03-17 2016-10-19 阿里巴巴集团控股有限公司 Method and device for preventing website data from leaking
US20180357413A1 (en) * 2017-05-31 2018-12-13 Paul A. Rivera Methods and Systems for the Active Defense of a Computing System Against Malware
CN110493165A (en) * 2018-06-29 2019-11-22 厦门白山耘科技有限公司 Automatically determine the method, apparatus and Network Intrusion Detection System of hostile network process

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350052A (en) * 2007-10-15 2009-01-21 北京瑞星国际软件有限公司 Method and apparatus for discovering malignancy of computer program
CN103023912A (en) * 2012-12-26 2013-04-03 蓝盾信息安全技术股份有限公司 Method for preventing network attacks based on virtual machines
CN103839005A (en) * 2013-11-22 2014-06-04 北京智谷睿拓技术服务有限公司 Malware detection method and malware detection system of mobile operating system
CN106033511A (en) * 2015-03-17 2016-10-19 阿里巴巴集团控股有限公司 Method and device for preventing website data from leaking
US20180357413A1 (en) * 2017-05-31 2018-12-13 Paul A. Rivera Methods and Systems for the Active Defense of a Computing System Against Malware
CN110493165A (en) * 2018-06-29 2019-11-22 厦门白山耘科技有限公司 Automatically determine the method, apparatus and Network Intrusion Detection System of hostile network process

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285621A (en) * 2021-12-20 2022-04-05 北京安天网络安全技术有限公司 Network threat monitoring method and device and electronic equipment
CN115002186A (en) * 2022-05-17 2022-09-02 深信服科技股份有限公司 Network information acquisition method and device, electronic equipment and readable storage medium
CN116484364A (en) * 2023-02-03 2023-07-25 安芯网盾(北京)科技有限公司 Hidden port detection method and device based on Linux kernel
CN116484364B (en) * 2023-02-03 2024-01-26 安芯网盾(北京)科技有限公司 Hidden port detection method and device based on Linux kernel
CN116112295A (en) * 2023-04-12 2023-05-12 北京长亭未来科技有限公司 Method and device for researching and judging external connection type attack result
CN116112295B (en) * 2023-04-12 2023-07-04 北京长亭未来科技有限公司 Method and device for researching and judging external connection type attack result

Also Published As

Publication number Publication date
CN115023699A (en) 2022-09-06

Similar Documents

Publication Publication Date Title
WO2021189257A1 (en) Malicious process detection method and apparatus, electronic device, and storage medium
US10552348B2 (en) USB device access method, apparatus and system, a terminal, and a server
US9870303B2 (en) Monitoring and correlating a binary process in a distributed business transaction
US20220391489A1 (en) Data processing method and apparatus, computer device, and storage medium
CN107135249B (en) Data downloading method and device
US10623450B2 (en) Access to data on a remote device
CN111193633B (en) Method and device for detecting abnormal network connection
CN109831351B (en) Link tracking method, device, terminal and storage medium
US10007562B2 (en) Business transaction context for call graph
US10067862B2 (en) Tracking asynchronous entry points for an application
CN111447201A (en) Scanning behavior recognition method and device, electronic equipment and storage medium
CN114726633B (en) Traffic data processing method and device, storage medium and electronic equipment
CN110881224B (en) Network long connection method, device, equipment and storage medium
CN116582365B (en) Network traffic safety control method and device and computer equipment
CN111371783B (en) SQL injection attack detection method, device, equipment and storage medium
WO2021097713A1 (en) Distributed security testing system, method and device, and storage medium
CN116028917A (en) Authority detection method and device, storage medium and electronic equipment
CN115828256A (en) Unauthorized and unauthorized logic vulnerability detection method
CN114462030A (en) Privacy policy processing and evidence obtaining method, device, equipment and storage medium
CN114461909A (en) Information processing method, information processing apparatus, electronic device, and storage medium
CN113765924A (en) Safety monitoring method, terminal and equipment based on cross-server access of user
CN109068170B (en) Storage method, device, terminal and storage medium for barrage message
CN116938605B (en) Network attack protection method and device, electronic equipment and readable storage medium
CN115038089B (en) Multi-terminal data monitoring and collecting method based on information extraction
CN116915860B (en) Instruction transmission method, device, equipment and medium based on UDP

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20927474

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24.02.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20927474

Country of ref document: EP

Kind code of ref document: A1