Detailed Description
In order to better understand the technical solution provided by the embodiments of the present application and make the above objects, features and advantages of the embodiments of the present application more obvious, the technical solution in the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, a flow chart of an internet of things device security protection method based on a behavior baseline provided by an embodiment of the present application is provided, where the internet of things device security protection method based on a behavior baseline may be applied to an internet of things device, as shown in fig. 1, and the internet of things device security protection method based on a behavior baseline may include the following steps:
And step 100, monitoring target behaviors in the running process of the Internet of things equipment, wherein the target behaviors comprise behaviors related to execution of the executable file.
In the embodiment of the application, in order to prevent a malicious program from being executed in the internet of things device, a specific behavior (which may be referred to as a target behavior) related to the execution of an executable file in the internet of things device may be monitored.
For example, for the internet of things device, the executable file needs to set executable rights in the internet of things device, and for the executable file with executable rights, the executable file needs to be executed by starting a process.
Accordingly, actions related to execution of the executable file may include, but are not limited to, some or all of the file rights modification action (INOTIFY) and the process initiation action (NETLINK), among others.
Step S110, under the condition that the target behavior is monitored, determining a target executable file associated with the target behavior, and determining a uniqueness check value of the target executable file by using a preset algorithm.
Step S120, the uniqueness check value of the target executable file is matched with the uniqueness check value of the executable file stored in the equipment firmware of the Internet of things equipment, wherein the uniqueness check value of the executable file stored in the equipment firmware of the Internet of things equipment comprises the uniqueness check value of each executable file in all executable files generated in the equipment firmware construction process, and the uniqueness check value of the executable file is determined by a preset algorithm.
In the embodiment of the application, in order to prevent malicious programs from being executed in the internet of things equipment, the unique check value of each executable file in all executable files generated in the equipment firmware construction process can be predetermined and stored, and the unique check value can be used for carrying out validity check on the executable files possibly executed in the operation process of the internet of things equipment.
Illustratively, the executable file's unique check value may be used to uniquely identify an executable file, which may include, but is not limited to, a hash value, a content fingerprint, or a digital signature value, among others.
In one example, given that resources of an internet of things device are typically relatively limited, the uniqueness check value of the executable file may choose to calculate a hash value that requires relatively low resources.
Accordingly, in the case that the target behavior is monitored, an executable file (which may be referred to as a target executable file) associated with the target behavior may be determined, and a unique check value of the target executable file is determined using a preset algorithm.
Under the condition that the unique check value of the target executable file is determined, the unique check value of the target executable file can be matched with the unique check value of the executable file stored in the device firmware of the internet of things device.
The unique check value of the target executable file can be compared with the unique check value of each executable file stored in the device firmware of the internet of things device, and whether the unique check value (which can be called as the target unique check value) which is the same as the unique check value of the target executable file exists in the unique check value of each executable file stored in the device firmware of the internet of things device or not is determined.
And under the condition that the target unique check value exists in the unique check values of the executable files stored in the equipment firmware of the Internet of things equipment, the successful matching can be determined. In this case, the target executable file may be determined to be a legal executable file, such as an executable file of the system itself.
And under the condition that the target unique check value does not exist in the unique check values of the executable files stored in the equipment firmware of the Internet of things equipment, determining that the matching fails. In this case, the target executable file may be determined to be an illegitimate executable file, such as an executable file of a malicious program.
Step S130, allowing the target behavior to occur under the condition that the matching is successful.
In the embodiment of the application, when the unique check value of the target executable file is successfully matched with the unique check value of the executable file stored in the equipment firmware of the Internet of things equipment, namely, the unique check value of each executable file stored in the equipment firmware of the Internet of things equipment has the target unique check value, the target behavior can be allowed to occur, namely, the target behavior is normally responded.
And step 140, blocking the target behavior under the condition of failure of matching.
In the embodiment of the application, when the unique check value of the target executable file fails to match the unique check value of the executable file stored in the device firmware of the internet of things device, that is, the unique check value of each executable file stored in the device firmware of the internet of things device does not exist, the target behavior can be blocked, that is, the progress of the target behavior is prevented, and the response to the target behavior is refused.
It can be seen that in the method flow shown in fig. 1, in the running process of the internet of things device, the target behavior is monitored, the target executable file associated with the target behavior is determined under the condition that the target behavior is monitored, and the unique check value of the target executable file is determined by using a preset algorithm, so that the unique check value of the target executable file can be matched with the unique check value of the executable file stored in the device firmware of the internet of things device, the target behavior is allowed to occur under the condition that the matching is successful, the target behavior is blocked under the condition that the matching is failed, the unique check value of each executable file in all executable files generated in the device firmware construction process is determined and stored, the unique check value of all executable files generated in the device firmware construction process is used as a behavior base line, the target executable file associated with the monitored target executable file is checked, the overall performance of the base line is improved by constructing the executable file according to all executable files generated in the device firmware construction process, false alarm occurrence can be effectively reduced, and in addition, the condition that the target executable file related to the execution of the executable file is less frequently consumed in the internet of things device and the program is prevented from being malicious in the internet of things device, and the malicious program is prevented from being executed in the device.
In some embodiments, the target behavior includes a file permission change behavior for the executable file;
The monitoring of the target behavior may include:
Monitoring file authority changing behaviors;
Under the condition that the file permission changing behavior is monitored, determining whether the file aimed at by the file permission changing behavior is an executable file or not;
and determining to monitor the target behavior under the condition that the file aimed at by the file permission changing behavior is an executable file, wherein the target executable file is the file aimed at by the file permission changing behavior.
Taking as an example that the target behavior comprises a file permission change behavior for the executable file.
For example, in the running process of the internet of things device, the file permission changing behavior can be monitored. Under the condition that the file permission changing behavior is monitored, a file aimed at by the file permission changing behavior can be obtained, and whether the file is an executable file or not is determined.
In the case where the file is an executable file, the file permission change behavior may be determined to be a target behavior.
It should be noted that, in the embodiment of the present application, when the file permission changing behavior is monitored, but the file for which the permission changing behavior is specific is not an executable file, special processing of the permission changing behavior is not required, that is, normal running of the permission changing behavior is not disturbed.
In one example, blocking the target behavior may include:
And refusing to carry out authority change on the target executable file, and deleting the target executable file.
For example, when a file permission modification behavior for an executable file is detected, and a uniqueness check value of a target executable file (the executable file for which the file permission modification behavior is intended) fails to match a uniqueness check value of an executable file stored in device firmware of the internet of things device, it may be determined that the target executable file is an executable file corresponding to a malicious program, and in order to avoid an influence of execution of the executable file on security of the internet of things device, permission modification of the target executable file may be refused. In addition, the target executable file can be deleted, so that the safety of the Internet of things equipment is further improved.
In some embodiments, the target behavior comprises a process start behavior;
in the case that the target behavior is monitored, determining the target executable file associated with the target behavior includes:
Under the condition that the starting behavior of the process is monitored, determining an executable file corresponding to the currently started process as a target executable file;
The allowing the target behavior to occur includes:
Allowing a currently started process to run;
Blocking the target behavior includes:
And stopping the currently started process.
Taking the example that the target behavior includes a process start behavior.
For example, during the operation of the internet of things device, the process start behavior may be monitored.
Under the condition that the starting behavior of the process is monitored, an executable file corresponding to the currently started process can be determined to be a target executable file, and a unique check value of the target executable file is determined by utilizing a preset algorithm.
In the case where the unique check value of the target executable file is determined, the unique check value of the target executable file may be matched in the manner described in the above embodiments.
In the case that the match is successful, the currently started process may be allowed to run.
In case of a failure of the match, the currently started process may be terminated, i.e. the currently started process is prohibited from running.
In some embodiments, the unique check value of the executable file stored in the device firmware of the internet of things device is stored in a security component of the internet of things device, and the security component is constructed by taking the unique check value of all executable files generated in the construction process of other sub-components except the security component in the construction process of the device firmware as a construction dependency.
For example, in the construction process of the device firmware of the internet of things device, a security component may be additionally added, where the security component may use the unique check value of each executable file in the executable files generated in the construction process of all sub-components except the security component in the construction process of the device firmware as a construction dependency, that is, in the construction process of the security component, the unique check value of each executable file in the executable files generated in the construction process of all other sub-components in the construction process of the device firmware needs to be acquired, and the acquired unique check value of each executable file is used as the construction dependency of the security component.
By constructing the security component in the above manner, the security component can acquire the unique check value of each executable file in all executable files generated in the construction process of other sub-components, and store the unique check value of each executable file in all executable files generated in the construction process of the security component together with the unique check value of the executable file generated in the construction process of the component (security component), so that the security component can store the unique check value of each executable file in all executable files generated in the construction process of the device firmware.
It should be noted that, in the embodiment of the present application, in addition to the secure component construction may be performed in the above manner to obtain and store the unique check value of each executable file in all executable files generated in the device firmware construction process, the unique check value of each executable file generated in the device firmware construction process may also be obtained in the device firmware construction process, and stored in the designated storage space of the device firmware.
However, under the condition that security measures are taken on the internet of things device, a security component is generally required to be set in the device firmware (the security component can execute processing operations related to security protection in the operation process of the internet of things device), so that the collection and storage of the unique check value of each executable file in all executable files generated in the construction process of the device firmware can be realized without excessively changing the construction logic of the device firmware by taking the unique check value of each executable file in all executable files generated in the construction process of the device firmware as the construction dependence of the security component.
In the embodiment of the present application, when the security component is constructed in the above manner, the security protection processing flow described in the above embodiment may be implemented by the security component in the process of operating the device of the internet of things, and the unique verification value of each executable file in all executable files generated in the process of constructing the firmware of the device is used as a behavior baseline to verify the target executable file associated with the monitored target behavior.
In some embodiments, the unique check value of the executable file stored in the device firmware of the internet of things device is obtained by:
For any encapsulation tool chain in the encapsulation tool chain set, in the process of calling the encapsulation tool chain to construct a sub-component, the encapsulation tool chain is used for transmitting the construction parameters to the tool chain corresponding to the encapsulation tool chain, and the encapsulation tool chain is called to compile the construction parameters, wherein the encapsulation tool chain set is obtained by encapsulating each tool chain in the tool chain set in the equipment firmware construction process;
Scanning a construction result generated by the tool chain through the packaging tool chain to acquire an executable file included in the construction result generated by the tool chain;
Based on the executable files obtained through the packaging tool chains, a preset algorithm is utilized to determine the uniqueness check value of the executable files.
For example, in the process of building device firmware, it is generally necessary to build multiple sub-components, and based on the multiple sub-components, implement the building of the device firmware by using the multiple sub-components as the building dependencies of the device firmware.
In view of the fact that the executable files generated in the construction process may be packaged or encrypted when the device firmware is constructed, all the executable files generated in the construction process may not be acquired when the device firmware is constructed.
Based on this, in order to more fully collect executable files generated during the device firmware build process, the executable files may be collected during the compilation stage in the subcomponent build composition, i.e., during the compilation of build parameters using the tool chain.
In the process of constructing the device firmware, for any sub-component, the system (such as a continuous integrated system) can acquire construction parameters required for constructing the sub-component in the process of constructing the sub-component, and call a tool chain to compile the construction parameters so as to construct the sub-component.
In the process of compiling the construction parameters by calling the tool chain, an executable file is generated, and the generated executable file is contained in a construction result.
In order to achieve the above objective, in the embodiment of the present application, each tool chain in a tool chain set in a device firmware construction process may be encapsulated to obtain an encapsulated tool chain set.
Illustratively, encapsulating a tool chain may be understood as adding an encapsulation layer outside the tool chain that can transparent to build parameters and can scan executable files for build results produced by the tool chain.
Correspondingly, for any encapsulation tool chain in the encapsulation tool chain set, in the process of calling the encapsulation tool chain to construct the sub-component, the encapsulation tool chain can be used for transmitting the construction parameters to the tool chain corresponding to the encapsulation tool chain, calling the tool chain to compile the construction parameters, and scanning the construction result generated by the tool chain through the encapsulation tool chain to acquire the executable file included in the construction result generated by the tool chain.
For example, for executable files obtained through each encapsulation tool chain, a preset algorithm may be used to determine a unique verification value for the executable file.
In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the technical solutions provided by the embodiments of the present application are described below with reference to specific examples.
The device firmware of the internet of things device is generally composed of a plurality of sub-components, each sub-component can comprise different executable file sets, the sub-components are mutually dependent, the sub-components are finally packaged into the whole device firmware after being built, and the whole device firmware is burnt into the device, and is rarely changed once the whole device firmware is burnt.
For example, a process of constructing an individual sub-assembly may be seen in fig. 2.
As shown in FIG. 2, the build behavior of a sub-component may be described as a process of generating a build product using source code and build dependencies within a build process.
During the build process, the tool chain used (e.g., gcc/clang), the build system (e.g., cmake/make), and some build parameters (e.g., whether to turn on certain specific functions, default log levels, etc.) are typically involved.
It should be noted that, in an embedded system, the build system and build parameters for compiling the different sub-components may be different, but the tool chain is typically the same.
Based on fig. 2, the entire device firmware build flow can be seen in fig. 3.
As shown in FIG. 3, the build of the entire device firmware may be described as a sub-component build with multiple levels of dependencies. During the entire build process, all executable files that may be executed during subsequent device operations are generated.
Based on this, in this embodiment, a build process of all sub-components may be interposed, and in the process of generating a build product, executable files therein are extracted, and hash values are calculated.
In this embodiment, as shown in fig. 4, a new sub-component (may be referred to as a security component) is added in the building process of the device firmware, and the security component may use hash values of all executable files generated by other sub-components in the building process as a building dependency, so that the hash values of the executable files generated in the building process are used as a behavior baseline in the subsequent device operation stage, and validity check is performed on the executable files in the operation stage.
In this embodiment, the implementation procedure for obtaining the hash value of each executable file in all executable files generated in the device firmware construction process may include:
And S0, packaging the tool chain set (T0, T1..Tn) in the equipment firmware construction process to obtain a packaged tool chain set (W0, W1..Wn).
The tool chain Ti is illustratively encapsulated to yield an encapsulated tool chain Wi, where i=0, 1.
S1, in the process of calling the packaging tool chain Wi to construct the sub-component, the packaging tool chain Wi can transmit the construction parameters to Ti, and the Ti is called to compile.
S2, under the condition that Ti compiling is finished, the construction result generated by the tool chain Ti can be scanned through the packaging tool chain Wi, and an executable file set included in the construction result generated by the tool chain is obtained.
S3, performing hash value calculation on each executable file in the executable file set.
S4, repeating the process for all other sub-components until all other sub-components are constructed, obtaining hash values (which can be recorded as B1) of all executable files, transmitting the hash values to the security component as construction dependencies, and storing the obtained hash values of the executable files of all other sub-components and the hash values of the executable files generated in the construction process of the security component in the security component.
It should be noted that, the construction of the security component may include other information besides the hash value of each executable file in all the executable files, which is not limited in this embodiment of the present application.
In this embodiment, under the condition that the construction of the device firmware is completed according to the above, in the operation process of the internet of things device, the internet of things device may obtain the hash values of each execution file in all executable files generated in the device firmware process from the security component, and may automatically identify the malicious program by using the hash values of each execution file in all executable files generated in the device firmware process as a behavior baseline, so as to implement security protection.
For example, the safety protection implementation flow in the running process of the device may include:
s1, monitoring file permission changing behaviors and process starting behaviors in a system in the running process of the Internet of things equipment.
S2, under the condition that the file permission changing behavior is monitored, determining whether the file aimed at by the file permission changing behavior is an executable file, if so, turning to S3, otherwise, turning to S1.
S3, carrying out hash value calculation on the executable file, and matching the hash value of the executable file in B1. If the matching is successful, the method goes to S1, and if the matching is failed, the method goes to S4.
S4, deleting the executable file, recording the event, and turning to S1.
S5, under the condition that the starting behavior of the process is monitored, carrying out hash value calculation on an executable file corresponding to the currently started process, and matching the hash value of the executable file in the B1. If the matching is successful, the process goes to S6, and if the matching is failed, the process goes to S7.
S6, releasing the process, and turning to S1.
And S7, terminating the process, and turning to S1.
The method provided by the application is described above. The device provided by the application is described below:
referring to fig. 5, a schematic structural diagram of an internet of things device security protection apparatus based on a behavior baseline according to an embodiment of the present application is shown in fig. 5, where the internet of things device security protection apparatus based on the behavior baseline may include:
the monitoring unit 510 is configured to monitor a target behavior during an operation process of the internet of things device, where the target behavior includes a behavior related to execution of an executable file;
The determining unit 520 is configured to determine, when a target behavior is monitored, a target executable file associated with the target behavior, and determine, by using a preset algorithm, a unique verification value of each executable file in the target executable file;
the matching unit 530 is configured to match the unique verification value of the target executable file with the unique verification value of the executable file stored in the device firmware of the internet of things device, where the unique verification value of the executable file stored in the device firmware of the internet of things device includes the unique verification values of all executable files generated in the device firmware building process;
And the protection unit 540 is used for allowing the target behavior to occur under the condition that the matching is successful, and blocking the target behavior under the condition that the matching is failed.
In some embodiments, the target behavior comprises a file permission change behavior for an executable file;
the monitoring unit 510 monitors the target behavior, including:
Monitoring file authority changing behaviors;
Under the condition that the file permission changing behavior is monitored, determining whether a file aimed at by the file permission changing behavior is an executable file or not;
And determining to monitor a target behavior under the condition that the file aimed at by the file permission changing behavior is an executable file, wherein the target executable file is the file aimed at by the file permission changing behavior.
In some embodiments, the blocking the target behavior by the guard unit 540 includes:
And refusing to change the authority of the target executable file, and deleting the target executable file.
In some embodiments, the target behavior comprises a process start behavior;
In the case that the target behavior is monitored, determining the target executable file associated with the target behavior comprises the following steps:
Under the condition that the starting behavior of the process is monitored, determining an executable file corresponding to the currently started process as the target executable file;
the allowing the target behavior to occur includes:
Allowing a currently started process to run;
The blocking the target behavior comprises:
And stopping the currently started process.
In some embodiments, the unique check value of the executable file stored in the device firmware of the internet of things device is stored in a security component of the internet of things device, and the security component is constructed by taking the unique check value of each executable file in all executable files generated in the construction process of other sub-components except the security component in the construction process of the device firmware as a construction dependency.
In some embodiments, the unique check value of the executable file stored in the device firmware of the internet of things device is generated by:
For any encapsulation tool chain in an encapsulation tool chain set, in the process of calling the encapsulation tool chain to construct a sub-component, transmitting a construction parameter to the tool chain corresponding to the encapsulation tool chain through the encapsulation tool chain, and calling the tool chain to compile the construction parameter, wherein the encapsulation tool chain set is obtained by encapsulating each tool chain in the tool chain set in the equipment firmware construction process;
Scanning a construction result generated by the tool chain through the packaging tool chain to acquire an executable file included in the construction result generated by the tool chain;
and determining the uniqueness check value of the executable file by utilizing the preset algorithm based on the executable file acquired through each packaging tool chain.
In some embodiments, the preset algorithm is a hash algorithm, and the unique check value is a hash value.
The embodiment of the application also provides the electronic equipment, which comprises a processor and a memory, wherein the memory is used for storing the computer program, and the processor is used for realizing the Internet of things equipment safety protection method based on the behavior baseline when executing the program stored on the memory.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. The electronic device may include a processor 601, a memory 602 storing machine-executable instructions. The processor 601 and memory 602 may communicate via a system bus 603. And, by reading and executing the machine executable instructions corresponding to the internet of things device security protection logic based on the behavior baseline in the memory 602, the processor 601 may execute the internet of things device security protection method based on the behavior baseline described above.
The memory 602 referred to herein may be any electronic, magnetic, optical, or other physical storage device that may contain or store information, such as executable instructions, data, or the like. For example, the machine-readable storage medium may be RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, a storage drive (e.g., hard drive), a solid state disk, any type of storage disk (e.g., optical disk, dvd, etc.), or a similar storage medium, or a combination thereof.
In some embodiments, a machine-readable storage medium, such as memory 602 in fig. 6, is also provided, having stored therein machine-executable instructions that when executed by a processor implement the above-described behavior baseline-based internet of things device security protection method. For example, the machine-readable storage medium may be ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
The embodiment of the application also provides a computer program product, which stores a computer program and causes a processor to execute the method for protecting the Internet of things equipment based on the behavior baseline.
The embodiment of the application also provides an Internet of things equipment safety protection system based on the behavior baseline, which comprises a continuous integrated system and Internet of things equipment, wherein:
the continuous integrated system is used for acquiring all the generated executable files in the construction process of the equipment firmware, determining the unique check value of each executable file by utilizing a preset algorithm, and storing the unique check value of each executable file in the equipment firmware;
the internet of things device is used for monitoring target behaviors in a device running process, wherein the target behaviors comprise behaviors related to execution of executable files, the target executable files related to the target behaviors are determined under the condition that the target behaviors are monitored, the unique check values of the target executable files are determined by means of a preset algorithm, the unique check values of the target executable files are matched with the unique check values of the executable files stored in device firmware of the internet of things device, the unique check values of the executable files stored in the device firmware of the internet of things device comprise the unique check values of all executable files generated in a device firmware building process, the unique check values of the executable files are determined by means of the preset algorithm, under the condition that matching is successful, the target behaviors are allowed to occur, and under the condition that matching is failed, the target behaviors are blocked.
The continuous integrated system is a system independent of the internet of things device and is used for generating device firmware of the internet of things device.
For example, a specific implementation of the persistent integrated system to determine the unique check value of each executable file in all executable files generated in the device firmware construction process may be referred to the related description in the above embodiment.
By way of example, the internet of things device may implement security protection in the manner described in the above embodiments.