File detection method, device, terminal and storage medium

By comparing the file characteristic value and the installation package characteristic value when the application loads the file, it is detected in real time whether the application has loaded the file downloaded from the network, which solves the problem of insufficient security verification in the existing technology and ensures the security of the application. Efficient and safe operation.

CN113127418BActive Publication Date: 2024-08-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911390046.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-30
Publication Date
2024-08-27
Estimated Expiration
2039-12-30

AI Technical Summary

Technical Problem

The existing technology fails to detect in real time whether files downloaded from the network are loaded during the running of the application, resulting in insufficient security verification and certain risks.

Method used

When the application loads a file, the characteristic value of the file is obtained and compared with the characteristic value of the file in the installation package. If they are not the same, it is determined to be a file downloaded from the network, providing a basis for security detection.

Benefits of technology

It realizes real-time detection of files during the running of the application, ensures the efficient and safe operation of the application, and provides the basis for targeted security detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113127418B
    Figure CN113127418B
Patent Text Reader

Abstract

The embodiment of the present application provides a file detection method, device, terminal and storage medium. The method includes: receiving the storage path of the first file transmitted by the target application; when loading the first file from the storage path of the first file, obtaining the characteristic value of the first file; if there is no second file with the same characteristic value as the first file, determining that the first file is a file downloaded from the network during the operation of the target application; wherein the second file is a file included in the installation package of the target application. In the embodiment of the present application, it is possible to detect in real time whether the file loaded during the operation of the application is a file downloaded from the network, providing a basis for subsequent security detection, thereby ensuring the efficient and secure operation of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a file detection method, device, terminal and storage medium. Background Art

[0002] Currently, in order to make the application more lightweight, some supporting files required to run the application are not encapsulated in the installation package of the application, but are stored in the cloud (eg, a backend server corresponding to the application).

[0003] In the related art, when the above-mentioned supporting files stored in the cloud are needed during the operation of the application, the terminal will download the required supporting files from the cloud in real time. Summary of the invention

[0004] The present application provides a file detection method, device, terminal and storage medium. The technical solution is as follows:

[0005] In a first aspect, a file detection method is provided, the method comprising:

[0006] Receiving a storage path of a first file transmitted by a target application;

[0007] When loading the first file from the storage path of the first file, acquiring a characteristic value of the first file;

[0008] If there is no second file with the same characteristic value as the first file, it is determined that the first file is a file downloaded from the network during the operation of the target application; wherein the second file is a file included in the installation package of the target application. In a second aspect, a file detection device is provided, the device comprising:

[0009] A path receiving module, used for receiving a storage path of a first file transmitted by a target application;

[0010] a feature value acquisition module, configured to acquire a feature value of the first file when the first file is loaded from a storage path of the first file;

[0011] A file detection module is used to determine that the first file is a file downloaded from the network during the operation of the target application if there is no second file whose characteristic value is the same as the characteristic value of the first file; wherein the second file is a file included in the installation package of the target application.

[0012] In a third aspect, a terminal is provided, the terminal comprising a processor and a memory, the memory storing at least one instruction, the instruction being loaded and executed by the processor to implement the file detection method as described in the first aspect.

[0013] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the computer-readable storage medium, and the instruction is loaded and executed by a processor to implement the file detection method as described in the first aspect.

[0014] The technical solution provided in the embodiments of the present application can bring at least the following beneficial effects:

[0015] When an application loads a file, the feature value of the loaded file is compared with the feature value of the file included in the application's installation package. If all the feature values ​​of the files included in the application's installation package are different from the feature values ​​of the loaded file, it is determined that the loaded file is a file downloaded from the Internet during the operation of the application. This allows real-time detection of whether the file loaded during the operation of the application is a file downloaded from the Internet, providing a basis for subsequent security testing and thereby ensuring efficient and secure operation of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a schematic diagram of a file loading process shown in an exemplary embodiment of the present application;

[0017] Figure 2 is a flowchart of a file loading process shown in an exemplary embodiment of the present application;

[0018] Figure 3 is a flowchart of a file loading method shown in another exemplary embodiment of the present application;

[0019] Figure 4 is a structural block diagram of a file loading device shown in an exemplary embodiment of the present application;

[0020] Figure 5 It is a structural block diagram of a terminal shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0022] Applications are usually security-verified when they are installed, so files stored locally on the terminal are usually safe. However, files downloaded from the Internet during the operation of the application have not been security-verified, which poses certain risks. Detecting whether the files loaded during the operation of the application are files downloaded from the Internet and then performing targeted security detection can ensure that the application runs efficiently and safely, but the relevant technology does not provide such a detection solution.

[0023] The technical solution provided in the embodiment of the present application compares the feature value of the loaded file with the feature value of the file included in the installation package of the application when the application loads the file. If all the feature values ​​of the files included in the installation package of the application are different from the feature values ​​of the loaded file, it is determined that the loaded file is a file downloaded from the network during the operation of the application. It can detect in real time whether the file loaded during the operation of the application is a file downloaded from the network, providing a basis for subsequent security detection, thereby ensuring efficient and secure operation of the application.

[0024] During the running of an application, loading a file usually involves the application (Java) layer, the service (Native) layer, and the kernel layer. Figure 1 The file loading process of the Native layer is explained by calling each function of the Native layer.

[0025] Step 101, call the nativeLoad function.

[0026] The doLoad function of the Java layer calls the nativeLoad function, and the file loading process enters the Native layer.

[0027] Step 102, call the LoadNativeLibrary function.

[0028] When the file loading process enters the Native layer, the RuntimenativeLoad function first calls the JVM_NativeLoad function, and then the JVM_NativeLoad function calls the LoadNativeLibrary function. The LoadNativeLibrary function first determines the loading status of the dynamic library file. Specifically, the LoadNativeLibrary function uses libraries->Get(path) to obtain the library. And determine whether the library is empty. If the library is empty, it means that the dynamic library file has not been loaded, and step 105 is executed at this time.

[0029] Step 103, call the FindSymbol function.

[0030] The LoadNativeLibrary function is also used to call the FindSymbol function.

[0031] Step 104, calling the JNI_OnLoad function.

[0032] FindSymbol function The FindSymbol() function searches for the JNI_OnLoad function. If it cannot be found, it means it is statically registered and returns success directly. Otherwise, it means it is dynamically registered through JNIOnLoad.

[0033] Step 105, call the OpenNativeLibrary function.

[0034] The OpenNativeLibrary function is used to open a dynamic library file and return the handle of the opened dynamic library file.

[0035] Step 106, calling the dlOpen function.

[0036] The dlOpen function is used to load a dynamic library file. Specifically, it is used to load the library file into the virtual address space of the calling process, and to load other dynamic library files that the dynamic library file depends on.

[0037] Please refer to Figure 2 , which shows a flowchart of a file detection method shown in an exemplary embodiment of the present application. The method can be applied to an operating system in a terminal. The method includes the following steps:

[0038] Step 201: Receive a storage path of a first file transmitted by a target application.

[0039] The first file refers to a file loaded during the operation of the target application. Optionally, the first file can be a file of a preset type. Exemplarily, the first file is a shared library (shareobject, so) file. The storage path of the first file is also the storage location of the first file locally in the terminal.

[0040] In the embodiment of the present application, since the storage path of the first file has been obtained when the Java layer loads the first file, it can directly receive the storage path of the first file delivered by the target application without obtaining it by itself.

[0041] Step 202: when loading the first file from the storage path of the first file, obtain the characteristic value of the first file.

[0042] After obtaining the storage path of the first file, the target application loads the first file from the storage path. Optionally, the target application calls Figure 1 The dlOpen function in the illustrated embodiment is used to load the first file. The characteristic value of the first file is used to uniquely identify the first file. Optionally, the characteristic value of the first file refers to a hash value of the first file, such as a SHA-256-Hash value.

[0043] Optionally, the target application obtains the feature value of the first file in the following manner:

[0044] Step 202a: when loading the first file, obtain the running information of the target application.

[0045] The target application's running information is used to record the running process of the target application. The target application's running information usually includes the following: stack information, process information, library file information, etc.

[0046] Step 202b: Read the operation parameters from the operation information.

[0047] The above-mentioned operation parameters include one or more combinations of the following: stack information, the process ID of the first process, the process ID of the parent process of the first process, and the storage path of the first file. It should be noted that the first process refers to the running process, and the parent process of the first process refers to the process that creates the first process. The terminal obtains the process ID of the first process and the process ID of the parent process of the first process through the getpid function. The storage path of the first file can be obtained from the path parameter.

[0048] Step 202c: obtaining a first file according to the operating parameters.

[0049] After obtaining the above-mentioned operating parameters, the target application can uniquely obtain the first file.

[0050] Step 202d, calculating the feature value of the first file.

[0051] The terminal reads the text content of the first file, and then processes the first file using a preset function to obtain a feature value of the first file. The preset function may be a hash function. The hash function compresses the text content of the first file into a summary, which can distinguish the first file from other files, and the summary is also the hash value of the first file.

[0052] Step 203: If there is no second file whose characteristic value is the same as the characteristic value of the first file, it is determined that the first file is a file downloaded from the network during the running process of the target application.

[0053] The second file is a file included in the installation package of the target application. The target application is an application currently running on the terminal, which can be a system application or a third-party application. Since system applications are usually trustworthy, in the embodiments of the present application, only the target application is a third-party application as an example for explanation.

[0054] If there is a second file whose characteristic value is the same as the characteristic value of the first file, it is determined that the first file is not a file downloaded from the network during the running process of the target application, but a file included in the installation package of the target application.

[0055] In an embodiment of the present application, when a file is loaded during the running of an application (a file is loaded through the dlOpen function), monitoring is added to obtain the characteristic value of the file. The characteristic value of the file is compared with the characteristic value of the file included in the installation package of the application to detect whether the file is a file downloaded from the network, so as to perform subsequent security verification.

[0056] Optionally, the terminal detects whether the preset feature value list includes the feature value of the first file. If the preset feature value list includes the feature value of the first file, it is determined that there is a second file with the same feature value as the first file; if the preset feature value list does not include the feature value of the first file, it is determined that there is no second file with the same feature value as the first file.

[0057] The preset feature value list includes the feature value of the second file. The preset feature value list may include the feature values ​​of the files included in the installation package of one application, or may include the feature values ​​of the files included in the installation packages of multiple applications. When the preset feature value list includes the feature values ​​of the files included in the installation package of one application, the terminal first obtains the preset feature value list corresponding to the target application, and then detects whether the preset feature value list corresponding to the target application includes the feature value of the first file.

[0058] To summarize, the technical solution provided by the embodiment of the present application compares the feature value of the loaded file with the feature value of the file included in the installation package of the application when the application loads the file. If all the feature values ​​of the files included in the installation package of the application are different from the feature values ​​of the loaded file, it is determined that the loaded file is a file downloaded from the network during the operation of the application. This can detect in real time whether the file loaded during the operation of the application is a file downloaded from the network, providing a basis for subsequent security detection, thereby ensuring efficient and secure operation of the application.

[0059] In the above embodiment, it is mentioned that by comparing whether the feature value of the first file exists in the preset feature value list, it is determined whether the first file is a file downloaded from the network during the operation of the target application. The following is an explanation of the process of obtaining the preset feature value list. Figure 2 In the optional embodiment provided by the illustrated embodiment, before step 203, the file detection method further includes the following steps.

[0060] Step 204: when installing the target application, read the characteristic value of the second file from the designated file included in the installation package of the target application.

[0061] There is a designated file in the installation package of the target application, and the designated file is used to record the characteristic values ​​of the files included in the installation package of the target application. Optionally, the designated file is a MANIFEST.MF file.

[0062] Optionally, when installing the target application, the characteristic value of the second file is read from a specified file included in the installation package of the target application by calling a preset function. Optionally, the preset function is a getminpackageinfo function.

[0063] Step 205: Store the feature value of the second file into a preset feature value list.

[0064] The terminal adds the read feature value of the second file to the preset feature value list. In step 201, it is introduced that the terminal can read the feature value of the second file through the getminpackageinfo function, and the developer can add a code for implementing the write function in the getminpackageinfo function, and store the feature value of the second file in the preset feature value list through the write function to save development costs.

[0065] exist Figure 2 In the embodiments, it is mentioned that the preset feature value list may include the feature values ​​of the files included in the installation package of one application, or may include the feature values ​​of the files included in the installation packages of multiple applications. When the preset feature value list includes the feature values ​​of the files included in the installation package of one application, in this case, there are usually multiple preset feature value lists. When the preset feature value list includes the feature values ​​of the files included in the installation packages of multiple applications, in this case, there is usually one preset feature value list.

[0066] A compressed file is a file that has been compressed by compression software. The compression software searches for repeated bytes in the original file, creates a "dictionary" file of the same bytes, and uses a code to replace the repeated bytes to obtain a compressed file. A compressed file can be a file with the suffix jar, a file with the suffix apk, or a file with the suffix zip.

[0067] Since the content of the compressed file is different from that of the original file, the corresponding feature values ​​of the two are also different. When the installation package of the application includes a compressed file, its designated file usually does not record the feature value of the compressed file. In order to make the feature values ​​recorded in the preset feature value list more comprehensive, the file detection method can also include the following steps:

[0068] Step 206: when installing the target application, if the installation package of the target application includes a compressed file, the compressed file is decompressed to obtain a third file.

[0069] The decompression process is the reverse process of the compression process, that is, restoring the compressed file to the original file. In the embodiment of the present application, the terminal decompresses the compressed file in the installation package of the target application to obtain the third file.

[0070] When a compressed file has a suffix of jar or apk, multiple files can be obtained by decompressing it, which also includes a designated file for recording the characteristic values ​​of the files included in the compressed file (such as the MANIFEST.MF file); when a compressed file has a suffix of zip, only one file is obtained by decompressing it, and the designated file for recording the characteristic values ​​of the file cannot be obtained.

[0071] Step 207: Acquire the feature value of the third file, and store the feature value of the third file in a preset feature value list.

[0072] When the compressed file is a file with a suffix of jar or apk, the feature value of the third file can be directly read from the specified file mentioned in step 206; when the compressed file is a file with a suffix of zip, the feature value of the third file can be calculated by referring to the method in step 202. Storing the feature value of the third file in the preset feature value list can refer to step 302, which will not be described in detail here.

[0073] The technical solution provided in the embodiment of the present application reads and records the characteristic values ​​of the files included in the installation package of the application when installing the application, so that when the file is loaded, the characteristic value of the loaded file can be compared with the recorded characteristic value, and then it is determined that the loaded file is a file downloaded from the network during the operation of the application, providing data support for subsequent file detection.

[0074] In a specific example, combined with reference Figure 3 , which shows a schematic diagram of a file detection method shown in an embodiment of the present application. The file detection method may include the following steps:

[0075] Step 301, install the application.

[0076] Step 302: When installing the application, the characteristic values ​​of the files included in the installation package of the application are stored.

[0077] The characteristic value of the file included in the installation package of the application is the MANIFEST.MF file included in the application.

[0078] Step 303: load the first file.

[0079] Wherein, loading the first file involves the Java layer, the Native layer and the kernel layer.

[0080] Step 304: Obtain the storage path of the first file when the first file is loaded at the Native layer.

[0081] Step 305: Calculate the feature value of the first file.

[0082] Step 306: Detect whether the first file is a file downloaded from the network based on the feature values ​​of the files included in the installation package of the application and the feature values ​​of the first file.

[0083] Since the files downloaded from the network during the operation of the target application have not been tested for security, there may be certain risks. To avoid this risk, after determining that the first file is a file downloaded from the network during the operation of the target application, the terminal can test the security of the first file. Figure 2 In an optional embodiment provided by the illustrated embodiment, the file detection method may further include the following steps:

[0084] Step 401: Detect a first file to determine a security level of the first file.

[0085] The security level of the first file is used to measure the security of the first file. There is a positive correlation between the security level and the security. That is, the higher the security level of the first file, the higher the security of the first file; the lower the security level of the first file, the lower the security of the first file.

[0086] Optionally, the terminal first determines the security score of the first file, and then determines the security level corresponding to the score interval in which the security score is located as the security level of the first file. The security score can be calculated as follows: the terminal detects the first file from at least one dimension, and obtains the security score corresponding to each dimension according to the detection result corresponding to each dimension, and then weights the security scores corresponding to each dimension to obtain the security score of the first file.

[0087] The above-mentioned multiple dimensions may be: detecting whether the first file is packed, detecting whether the first file carries sensitive functions, detecting whether the first file carries malicious programs, and the like.

[0088] File shelling refers to compressing executable binary files, and the shelled files can be run directly without decompression. After some virus files are shelled, they cannot be identified by anti-virus software, so there are great security risks. If the first file sensitive function refers to a function that can have a specified function, the designation may be to view, obtain, use sensitive information, etc. Malicious program refers to program code that can implement malicious functions, and the malicious functions may be functions such as sending text messages and opening data networks, which are not limited in the embodiments of the present application.

[0089] Step 402: When the security level of the first file meets a preset condition, the first file is loaded into the virtual address space of the second process.

[0090] Optionally, the preset condition may be that the security level of the first file reaches a preset level, and the preset level may be set by the user or may be customized by the terminal. The second process refers to a calling process.

[0091] In an embodiment of the present application, when the terminal detects that the security level of the first file meets the preset conditions, that is, when the first file is confirmed to be a safe file, the subsequent file loading steps are executed, which can avoid the situation where the first file is run when the first file is a malicious file, thereby improving security.

[0092] To sum up, the technical solution provided in the embodiment of the present application improves security by detecting the first file after determining that the first file is a file downloaded from the network during the running of the application, and executing subsequent processes when it is determined that the first file is safe, thereby avoiding the situation where the first file is run when it is a malicious file.

[0093] Terminal users grant different permissions to different applications. Some applications have sensitive permissions, such as information permissions, address book permissions, call log permissions, etc. For such applications, there are greater security risks, so it is more necessary to detect whether the files loaded during the operation of such applications are downloaded from the Internet. Figure 2 In an optional embodiment provided by the illustrated embodiment, before obtaining the feature value of the first file, the file detection method further includes:

[0094] Step 403: When loading the first file from the storage path of the first file, detect whether the target application has sensitive permissions.

[0095] Sensitive permissions refer to permissions to access sensitive information. Such sensitive information includes, but is not limited to, location information, address book information, call information, text message content, album content, etc. Such sensitive permissions include, but are not limited to, location information permissions, microphone permissions, address book permissions, information permissions, call log permissions, camera permissions, etc. Sensitive permissions can be pre-set by the user or set by default by the terminal.

[0096] Optionally, the terminal stores a correspondence between permissions and applications, and the terminal queries the correspondence to obtain a list of applications with sensitive permissions, and then detects whether the target application is included in the application list. If the target application is included in the application list, it is determined that the target application has sensitive permissions; if the target application is not included in the application list, it is determined that the target application does not have sensitive permissions.

[0097] If it is detected that the target application has sensitive permissions, the characteristic value of the first file is obtained; if it is detected that the target application does not have sensitive permissions, the process ends.

[0098] Applications with sensitive permissions can obtain sensitive information of terminal users. When there are security risks, the sensitive information of terminal users may be leaked; however, when there are security risks, applications without sensitive permissions will not cause sensitive information leakage. Therefore, in the embodiment of the present application, only the files loaded during the operation of applications with sensitive permissions are detected to see whether they are files downloaded from the network, so as to avoid the terminal from detecting each application. Under the premise of ensuring security, the processing resources of the terminal can be saved.

[0099] To sum up, the technical solution provided in the embodiment of the present application avoids the terminal from detecting each application by detecting whether the file loaded during the operation of an application with sensitive permissions is a file downloaded from the network. This can save the terminal's processing resources while ensuring security.

[0100] The following is an embodiment of the device of the present application. For parts not described in detail in the embodiment of the device, reference may be made to the technical details disclosed in the above method embodiment.

[0101] Please refer to Figure 4 , which shows a block diagram of a file detection device provided by an exemplary embodiment of the present application. The file detection device can be implemented as all or part of the terminal through software, hardware or a combination of both. The file detection device includes:

[0102] The path receiving module 410 is used to receive the storage path of the first file transmitted by the target application.

[0103] The feature value acquisition module 420 is used to acquire the feature value of the first file when the first file is loaded from the storage path of the first file.

[0104] The file detection module 430 is used to determine that the first file is a file downloaded from the network during the operation of the target application if there is no second file whose characteristic value is the same as the characteristic value of the first file; wherein the second file is a file included in the installation package of the target application.

[0105] To summarize, the technical solution provided by the embodiment of the present application compares the feature value of the loaded file with the feature value of the file included in the installation package of the application when the application loads the file. If all the feature values ​​of the files included in the installation package of the application are different from the feature values ​​of the loaded file, it is determined that the loaded file is a file downloaded from the network during the operation of the application. This can detect in real time whether the file loaded during the operation of the application is a file downloaded from the network, providing a basis for subsequent security detection, thereby ensuring efficient and secure operation of the application.

[0106] Based on Figure 4 In the optional embodiment provided by the illustrated embodiment, the feature value acquisition module 420 is used to:

[0107] When loading the first file, obtaining the running information of the target application;

[0108] Reading an operation parameter from the operation information, the operation parameter including a combination of one or more of the following: a process identifier of a target process, a process identifier of a parent process of the target process, and a storage path of the first file;

[0109] Acquire the first file according to the operating parameters;

[0110] Calculate the feature value of the first file.

[0111] Based on Figure 4 In an optional embodiment provided by the illustrated embodiment, the file detection module 430 is further used for:

[0112] Detecting whether a preset feature value list includes the feature value of the first file, the preset feature value list including the feature value of the second file;

[0113] If the preset feature value list includes the feature value of the first file, it is determined that there is a second file whose feature value is the same as the feature value of the first file;

[0114] If the preset feature value list does not include the feature value of the first file, it is determined that there is no feature value of the second file that is the same as the feature value of the first file.

[0115] Optionally, the device further includes: a characteristic value storage module (not shown in the figure).

[0116] The characteristic value storage module is used for:

[0117] When installing the target application, reading the characteristic value of the second file from a designated file included in the installation package of the target application;

[0118] The feature value of the second file is stored in the preset feature value list.

[0119] Optionally, the characteristic value storage module is further used to:

[0120] When installing the target application, if the installation package of the target application includes a compressed file, decompressing the compressed file to obtain a third file;

[0121] Acquire the feature value of the third file, and store the feature value of the third file in the preset feature value list.

[0122] Based on Figure 4 In an optional embodiment provided by the illustrated embodiment, the device further comprises: a safety detection module (not shown in the figure).

[0123] The safety detection module is used to:

[0124] Detecting the first file to determine a security level of the first file;

[0125] When the security level of the first file meets a preset condition, the first file is loaded into the virtual address space of the second process.

[0126] Based on Figure 4 In an optional embodiment provided by the illustrated embodiment, the device further includes: a permission detection module (not shown in the figure).

[0127] The permission detection module is used to:

[0128] Detecting whether the target application has sensitive permissions, where the sensitive permissions refer to permissions to access sensitive information;

[0129] If the target application has the sensitive permission, the step of obtaining the characteristic value of the first file is performed.

[0130] It should be noted that the device provided in the above embodiment only uses the division of the above functional modules as an example to implement its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0131] refer to Figure 5 , which shows a block diagram of a terminal provided by an exemplary embodiment of the present application. The terminal in the present application may include one or more of the following components: a processor 510 and a memory 520.

[0132] The processor 510 may include one or more processing cores. The processor 510 uses various interfaces and lines to connect various parts in the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 520, and calling data stored in the memory 520. Optionally, the processor 510 can be implemented in at least one hardware form 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). The processor 510 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU) and a modem. Among them, the CPU mainly processes the operating system and application programs, etc.; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 510, and it can be implemented separately through a chip.

[0133] Optionally, when the processor 510 executes the program instructions in the memory 520 , the file detection method provided by each of the above method embodiments is implemented.

[0134] The memory 520 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 520 includes a non-transitory computer-readable storage medium. The memory 520 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data created according to the use of the terminal, etc.

[0135] The structure of the above terminal is only illustrative. In actual implementation, the terminal may include more or fewer components, such as a camera, etc., which is not limited in this embodiment.

[0136] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the terminal 500, and the terminal 500 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0137] In an exemplary embodiment, a computer-readable storage medium is also provided, wherein at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor of a terminal to implement the file detection method in the above method embodiment. Optionally, the above computer-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0138] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed, it is used to implement the file detection method provided in the above method embodiment.

[0139] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. The words "first", "second" and similar terms used in this article do not indicate any order, quantity or importance, but are only used to distinguish different components.

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

[0141] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A file detection method, characterized in that: The method comprises: When installing a target application, reading a characteristic value of a second file from a designated file included in an installation package of the target application, wherein the designated file is used to record characteristic values ​​of files included in the installation package of the target application; During the running of the target application, receiving a storage path of a first file transmitted by the target application; When loading the first file from the storage path of the first file, acquiring a characteristic value of the first file; If there is no second file whose characteristic value is the same as the characteristic value of the first file, it is determined that the first file is a file downloaded from the network during the running process of the target application; wherein the second file is a file included in the installation package of the target application; Detect the first file from at least one dimension to obtain a security score of the first file, wherein the at least one dimension includes at least one of detecting whether the first file is packed, detecting whether the first file carries sensitive functions, and detecting whether the first file carries malicious programs, and the security score of the first file is obtained by weighting the security score corresponding to each dimension, and the security score corresponding to each dimension is obtained according to the detection result corresponding to each dimension; determining a security level corresponding to a score interval in which the security score of the first file falls as the security level of the first file; When the security level of the first file meets a preset condition, the first file is loaded into the virtual address space of the second process.

2. The method according to claim 1, characterized in that The obtaining the characteristic value of the first file includes: When loading the first file, obtaining the running information of the target application; Reading an operation parameter from the operation information, where the operation parameter includes a combination of one or more of the following: a process identifier of the first process, a process identifier of a parent process of the first process, and a storage path of the first file; Acquire the first file according to the operating parameters; Calculate the feature value of the first file.

3. The method according to claim 1, characterized in that: Before determining that the first file is a file downloaded from the network during the running process of the target application, the method further includes: Detecting whether a preset feature value list includes the feature value of the first file, the preset feature value list including the feature value of the second file; If the preset feature value list includes the feature value of the first file, it is determined that there is a second file whose feature value is the same as the feature value of the first file; If the preset feature value list does not include the feature value of the first file, it is determined that there is no feature value of the second file that is the same as the feature value of the first file.

4. The method according to claim 3, characterized in that When installing the target application, after reading the characteristic value of the second file from the designated file included in the installation package of the target application, the method further includes: The feature value of the second file is stored in the preset feature value list.

5. The method according to claim 4, characterized in that The method further comprises: When installing the target application, if the installation package of the target application includes a compressed file, decompressing the compressed file to obtain a third file; Acquire the feature value of the third file, and store the feature value of the third file in the preset feature value list.

6. The method according to any one of claims 1 to 5, characterized in that: Before obtaining the feature value of the first file, the method further includes: Detecting whether the target application has sensitive permissions, where the sensitive permissions refer to permissions to access sensitive information; If the target application has the sensitive permission, the step of obtaining the characteristic value of the first file is performed.

7. A file detection device, characterized in that: The device comprises: A reading module, used to read the characteristic value of the second file from a designated file included in the installation package of the target application when installing the target application, wherein the designated file is used to record the characteristic values ​​of the files included in the installation package of the target application; A path receiving module, used for receiving a storage path of a first file transmitted by the target application during the running process of the target application; a feature value acquisition module, configured to acquire a feature value of the first file when the first file is loaded from a storage path of the first file; A file detection module, configured to determine that the first file is a file downloaded from a network during the operation of the target application program if there is no feature value of the second file that is the same as the feature value of the first file; wherein the second file is a file included in the installation package of the target application program; The file detection module is further used to detect the first file from at least one dimension to obtain a security score of the first file, wherein the at least one dimension includes detecting whether the first file is packed, detecting whether the first file carries sensitive functions, and detecting whether the first file carries malicious programs. The security score of the first file is obtained by weighting the security score corresponding to each dimension, and the security score corresponding to each dimension is obtained according to the detection result corresponding to each dimension; the security level corresponding to the score interval in which the security score of the first file is located is determined as the security level of the first file; when the security level of the first file meets a preset condition, the first file is loaded into the virtual address space of the second process.

8. A terminal, characterized in that: The terminal includes a processor and a memory, the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the file detection method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the instruction is loaded and executed by the processor to implement the file detection method according to any one of claims 1 to 6.