Application program processing method and device

By decompiling and identifying SDK collections, accurately extracting and detecting SDKs in Android application packages, the existing SDK security threats and detection accuracy problems are solved, and more efficient security detection and privacy protection are achieved.

CN115146264BActive Publication Date: 2024-11-12CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110347307.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-31
Publication Date
2024-11-12
Estimated Expiration
2041-03-31

AI Technical Summary

Technical Problem

The existing SDK has security threats, such as obtaining user privacy information and vulnerabilities, which lead to malicious attacks. As the Android version is upgraded, extracting the SDK becomes inaccurate, affecting the accuracy of security detection.

Method used

By decompiling the Android application package, identify and determine the SDK collection, including the jar and so files in the lib folder, the dependency items in the build.gradle file, the lead package content in the .class file, and the actual calls in the real machine sandbox The SDK file is safely detected and hashed values ​​are calculated, and stored in the database for subsequent queries.

Benefits of technology

It realizes accurate extraction and security detection of the SDK collection of Android application packages, improves the accuracy and efficiency of detection results, and ensures the security of user privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115146264B_ABST
    Figure CN115146264B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and device for processing an application, and relates to the technical field of software development. The method comprises: decompiling an Android application package to obtain a lib folder, a build.gradle file, and a .class file; traversing the lib folder to obtain a first SDK file under the lib folder, wherein the first SDK file comprises a jar file and a so file; identifying the content in a dependent project of the build.gradle file to obtain a second SDK file; traversing the .class file to obtain a third SDK file that may be called by the Android application package; and obtaining a fourth SDK file that is actually called by the Android application package during operation in a real machine sandbox; determining an SDK set of the Android application package, wherein the SDK set comprises the first SDK file and an SDK subset, wherein the SDK subset comprises at least one of the second SDK file, the third SDK file, and the fourth SDK file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of software development, and in particular to a method and device for processing an application program. Background Art

[0002] Software Development Kit (SDK) is a toolkit developed by advertisers, payment companies, social, push platforms, map service providers and other service companies to facilitate application developers to use the services they provide. SDK includes categories such as advertising, payment, statistics, social, push, and maps.

[0003] SDK is widely used, and once a security problem occurs, the impact will be wide-ranging. Summary of the invention

[0004] The inventors have noticed that some malicious SDKs themselves pose security threats. For example, in addition to obtaining user privacy information, such as collecting user device IDs and obtaining user location information, SDKs also pose more serious security issues. For example, some SDKs have the function of actively receiving server instructions, and these SDKs can collect sensitive information such as text messages, call records, and contacts as needed. Some SDKs also perform dangerous operations such as dynamically downloading code.

[0005] In addition, the SDK itself may have vulnerabilities. If these vulnerabilities are exploited, attackers can use the SDK to launch malicious attacks. For example, open the camera to take pictures without the user's knowledge, steal two-factor authentication tokens by sending SMS messages, or turn the user's device into part of a botnet.

[0006] In view of the above considerations, it is necessary to extract the SDK and test the security of the SDK. However, the inventors found that with the upgrade of the Android version, the extracted SDK becomes inaccurate.

[0007] In order to solve the above problems, the embodiments of the present disclosure propose the following solutions.

[0008] According to one aspect of an embodiment of the present disclosure, a method for processing an application is provided, comprising: decompiling an Android application package to obtain a lib folder, a build.gradle file, and a .class file; traversing the lib folder to obtain a first SDK file under the lib folder, wherein the first SDK file includes a jar file and a so file; identifying the content in a dependent project of the build.gradle file to obtain a second SDK file; traversing the .class file to obtain a third SDK file that may be called by the Android application package; and obtaining a fourth SDK file that is actually called by the Android application package during its running in a real machine sandbox; determining an SDK set of the Android application package, wherein the SDK set includes the first SDK file and an SDK subset, wherein the SDK subset includes at least one of the second SDK file, the third SDK file, and the fourth SDK file.

[0009] In some embodiments, the SDK subset includes at least one of the second SDK file and the third SDK file, and the fourth SDK file.

[0010] In some embodiments, the SDK subset includes the second SDK file, the third SDK file, and the fourth SDK file.

[0011] In some embodiments, the method further includes: performing a security check on the SDK set to obtain a security check result; calculating a first hash value of the Android application package; and storing the security check result and the first hash value of the Android application package in a database correspondingly.

[0012] In some embodiments, the method also includes: receiving a security check request from a user for another Android application package; calculating a second hash value of the other Android application package; when the second hash value is the same as the first hash value, obtaining the security check result corresponding to the first hash value from the database; and sending the security check result corresponding to the first hash value to the user.

[0013] In some embodiments, the method also includes: calculating a first hash value of the Android application package; determining whether the SDK set of the Android application package already exists in the database based on the first hash value; if the SDK set does not exist in the database, executing the step of decompiling the Android application package; after determining the SDK set, storing the SDK set and the first hash value in the database accordingly.

[0014] In some embodiments, the first hash value comprises a SHA1 value.

[0015] According to another aspect of an embodiment of the present disclosure, a processing device for an application is provided, comprising: a decompile module, configured to decompile an Android application package to obtain a lib folder, a build.gradle file and a .class file; a first traversal module, configured to traverse the lib folder to obtain a first SDK file under the lib folder, wherein the first SDK file includes a jar file and a so file; an identification module, configured to identify the content in a dependent project of the build.gradle file to obtain a second SDK file; a second traversal module, configured to traverse the .class file to obtain a third SDK file that may be called by the Android application package; and a first acquisition module, configured to obtain a fourth SDK file actually called by the Android application package during its running in a real machine sandbox; a determination module, configured to determine an SDK set used for security detection of the Android application package, wherein the SDK set includes the first SDK file and an SDK subset, wherein the SDK subset includes at least one of the second SDK file, the third SDK file and the fourth SDK file.

[0016] In some embodiments, the device also includes: a detection module, configured to perform a security check on the SDK set to obtain a security check result; a calculation module, configured to calculate a first hash value of the Android application package; and a storage module, configured to store the security check result and the first hash value of the Android application package in a database correspondingly.

[0017] In some embodiments, the device also includes: a receiving module, configured to receive a user's security check request for another Android application package; the calculating module is also configured to calculate a second hash value of the other Android application package; a second acquisition module, configured to obtain the security check result corresponding to the first hash value from the database when the second hash value is the same as the first hash value; and a sending module, configured to send the security check result corresponding to the first hash value to the user.

[0018] According to another aspect of an embodiment of the present disclosure, there is provided a device for processing an application, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute the method described in any one of the above embodiments based on instructions stored in the memory.

[0019] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, comprising computer program instructions, wherein when the computer program instructions are executed by a processor, the method described in any one of the above embodiments is implemented.

[0020] In the disclosed embodiment, the determined SDK set of the Android application package includes not only the first SDK file obtained by traversing the lib folder, but also the SDK sub-set. The SDK sub-set includes at least one of the second SDK file obtained by identifying the build.gradle file, the third SDK file obtained by traversing the .class file, and the fourth SDK file actually called during the running of the Android application package in the real machine sandbox. In this way, the obtained SDK set of the Android application package is more accurate.

[0021] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 is a flowchart of a method for processing an application according to some embodiments of the present disclosure;

[0024] Figure 2 is a flowchart of a method for processing an application according to other embodiments of the present disclosure;

[0025] Figure 3 is a schematic diagram of the structure of a processing device for an application according to some embodiments of the present disclosure;

[0026] Figure 4 is a schematic diagram of the structure of an application processing device according to other embodiments of the present disclosure;

[0027] Figure 5 It is a structural diagram of a processing device for an application according to some other embodiments of the present disclosure. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.

[0029] Unless specifically stated otherwise, the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure.

[0030] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0031] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0032] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0033] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0034] Figure 1 It is a flowchart of a method for processing an application according to some embodiments of the present disclosure.

[0035] In step 102, the Android application package is decompiled to obtain a lib folder, a build.gradle file, and a .class file.

[0036] For example, you can use decompilation tools such as ApkTool to decompile Android application packages.

[0037] In step 104, the lib folder is traversed to obtain the first SDK file in the lib folder.

[0038] Here, the first SDK file includes a jar file and a so file.

[0039] In step 106, the content in the dependency project (dependencies) of the build.gradle file is identified to obtain the second SDK file.

[0040] It should be understood that the second SDK file is a toolkit file that the Android application package depends on.

[0041] In step 108, the .class files are traversed to obtain a third SDK file that may be called by the Android application package.

[0042] By traversing the .class files, keywords (such as import) can be used to extract the import package content, thereby obtaining the SDK file that the Android application package may call, that is, the third SDK file.

[0043] In step 110, a fourth SDK file actually called when the Android application package is running in the real machine sandbox is obtained.

[0044] For example, the user's click operation can be simulated to run the Android application package in the real machine sandbox, so that the SDK file actually called during the running of the Android application package, that is, the fourth SDK file, can be captured.

[0045] In step 112, the SDK set of the Android application package is determined.

[0046] Here, the SDK set includes a first SDK file and an SDK sub-set. The SDK sub-set includes at least one of a second SDK file, a third SDK file, and a fourth SDK file.

[0047] In the above embodiment, the determined SDK set of the Android application package includes not only the first SDK file obtained by traversing the lib folder, but also the SDK sub-set. The SDK sub-set includes at least one of the second SDK file obtained by identifying the build.gradle file, the third SDK file obtained by traversing the .class file, and the fourth SDK file actually called during the running of the Android application package in the real machine sandbox. In this way, the obtained SDK set of the Android application package is more accurate.

[0048] In some embodiments, the SDK subset includes at least one of the second SDK file and the third SDK file, and the fourth SDK file. For example, the SDK subset includes both the second SDK file and the fourth SDK file; for another example, the SDK subset includes both the third SDK file and the fourth SDK file. In this way, the second SDK file and the third SDK file are static, and the fourth SDK file is dynamic. By combining static and dynamic, the accuracy of the SDK set of the obtained Android application package can be further improved.

[0049] In some other embodiments, the SDK subset includes the second SDK file, the third SDK file and the fourth SDK file. In this way, the SDK set of the obtained Android application package is more accurate.

[0050] In some embodiments, before step 102, the first hash value of the Android application package may be calculated first, and then it is determined whether the SDK set of the Android application package already exists in the database according to the first hash value. For example, the database stores SDK sets of different Android application packages and first hash values ​​of different Android application packages. In some embodiments, the first hash value includes a SHA1 value.

[0051] If the SDK set of the Android application package does not exist in the database, the step of decompiling the Android application package in step 102 is performed. If the SDK set of the Android application package exists in the database, the SDK set of the Android application package can be directly called from the database.

[0052] In addition, after step 112, that is, after the SDK set of the Android application package is determined, the SDK set of the Android application package and the first hash value may be correspondingly stored in a database for subsequent invocation by other users.

[0053] After obtaining the SDK set of the Android application package, the SDK set of the Android application package can be subsequently subjected to security detection; or, in response to a user's acquisition request, the SDK set of the Android application package can be sent to the user, who can then perform security detection. This will be described below in conjunction with different embodiments.

[0054] Figure 2 It is a flowchart of a method for processing an application according to some other embodiments of the present disclosure.

[0055] In some embodiments, Figure 1 Compared with the embodiment shown, the processing method also includes Figure 2 Steps 202 to 206 are shown.

[0056] In step 202, a security check is performed on the SDK set to obtain a security check result.

[0057] For example, a security check may be performed on the SDK set based on a preset security check standard.

[0058] In step 204, a first hash value of the Android application package is calculated.

[0059] For example, a first hash value of the Android application package, such as a SHA1 value, may be obtained by using a preset hash algorithm.

[0060] In step 206, the security detection result of the SDK set and the first hash value of the Android application package are correspondingly stored in the database.

[0061] In the above embodiment, since the determined SDK set is more accurate, the obtained security detection result is also more accurate.

[0062] In some embodiments, see Figure 2 The processing method also includes steps 208 to 214.

[0063] In step 208 , a security check request from a user for another Android application package is received.

[0064] In step 210 , a second hash value of another Android application package is calculated.

[0065] For example, the second hash value of the other Android application package may be obtained using a hash algorithm that is the same as the above-mentioned preset hash algorithm.

[0066] In step 212, when the second hash value is the same as the first hash value, a security detection result corresponding to the first hash value is obtained from the database.

[0067] In step 214, the security detection result corresponding to the first hash value is sent to the user.

[0068] In the above embodiment, the security detection result of the SDK set of the existing Android application package in the database can be directly called and sent to the user. Especially when a large number of users request security detection at the same time, the method of the above embodiment can effectively improve the processing efficiency, so that the user's security detection requirements can be responded to more quickly.

[0069] In some embodiments, the fourth SDK file can be obtained through the RCSN algorithm, so that the fourth SDK can be obtained more accurately.

[0070] For example, the relative proximity of each cluster of multiple clusters actually called when the Android application package is running in the real machine sandbox can be determined by the following formula:

[0071]

[0072] In the above formula, C i and C j represents the number of data points in clusters i and j, EC(C i ) represents the sum of the weights of the edges in cluster i, EC(C j ) represents the sum of the weights of the edges in cluster j, EC(C i , C j ) represents the sum of the weights of the edges connecting two clusters i and j.

[0073] When the relative similarity of a certain cluster actually called is the same as the relative similarity of a certain SDK cluster among the multiple SDK clusters stored in the database, the SDK cluster in the database is used as the fourth SDK file.

[0074] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0075] Figure 3 It is a structural diagram of a processing device for an application according to some embodiments of the present disclosure.

[0076] like Figure 3 As shown, the processing device includes a decompiling module 301 , a first traversing module 302 , an identifying module 303 , a second traversing module 304 , a first acquiring module 305 and a determining module 306 .

[0077] The decompile module 301 is configured to decompile the Android application package to obtain a lib folder, a build.gradle file, and a .class file. The first traversal module 302 is configured to traverse the lib folder to obtain the first SDK file under the lib folder, and the first SDK file includes a jar file and a so file. The identification module 303 is configured to identify the content in the dependent project of the build.gradle file to obtain the second SDK file. The second traversal module 304 is configured to traverse the .class file to obtain the third SDK file that the Android application package may call. The first acquisition module 305 is configured to obtain the fourth SDK file actually called by the Android application package during the operation in the real machine sandbox. The determination module 306 is configured to determine the SDK set used for security detection of the Android application package, the SDK set includes a first SDK file and an SDK sub-set, and the SDK sub-set includes at least one of the second SDK file, the third SDK file, and the fourth SDK file.

[0078] Figure 4 It is a structural diagram of a processing device for an application according to some other embodiments of the present disclosure.

[0079] like Figure 4 As shown, the processing device further includes a detection module 401 , a calculation module 402 and a storage module 403 .

[0080] The detection module 401 is configured to perform security detection on the SDK set to obtain a security detection result. The calculation module 402 is configured to calculate the first hash value of the Android application package. The storage module 403 is configured to store the security detection result and the first hash value of the Android application package in a database accordingly.

[0081] In some embodiments, see Figure 4 The processing device also includes a receiving module 404, a second obtaining module 405 and a sending module 406.

[0082] The receiving module 404 is configured to receive a security detection request from a user for another Android application package. The calculating module 402 is also configured to calculate a second hash value of another Android application package. The second obtaining module 405 is configured to obtain the security detection result corresponding to the first hash value from the database when the second hash value is the same as the first hash value. The sending module 406 is configured to send the security detection result corresponding to the first hash value to the user.

[0083] Figure 5 It is a structural diagram of a processing device for an application according to some other embodiments of the present disclosure.

[0084] like Figure 5 As shown, the processing device 500 includes a memory 501 and a processor 502 coupled to the memory 501 , and the processor 502 is configured to execute the method of any one of the aforementioned embodiments based on instructions stored in the memory 501 .

[0085] The memory 501 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs.

[0086] The processing device 500 may also include an input / output interface 503, a network interface 504, a storage interface 505, etc. These interfaces 503, 504, 505, and the memory 501 and the processor 502 may be connected, for example, via a bus 506. The input / output interface 503 provides a connection interface for input / output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 504 provides a connection interface for various networked devices. The storage interface 505 provides a connection interface for external storage devices such as an SD card and a USB flash drive.

[0087] The embodiments of the present disclosure further provide a computer-readable storage medium on which computer program instructions are stored. When the instructions are executed by a processor, the method of any one of the above embodiments is implemented.

[0088] So far, various embodiments of the present disclosure have been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.

[0089] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0090] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions specified in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0091] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0093] Although some specific embodiments of the present disclosure have been described in detail by way of examples, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified or some technical features may be replaced by equivalents without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.

Claims

1. A method for processing an application, comprising: Decompile the Android application package to get the lib folder, build.gradle file and .class files; Traverse the lib folder to obtain a first software development kit SDK file in the lib folder, wherein the first SDK file includes a jar file and a so file; Identify the contents of the dependent project in the build.gradle file to obtain the second SDK file; Traversing the .class file to extract the import package content using keywords, thereby obtaining a third SDK file that may be called by the Android application package; Obtaining a fourth SDK file that is actually called when the Android application package is running in the real machine sandbox; and Determine an SDK set for the Android application package to perform security detection, wherein the SDK set includes the first SDK file and an SDK sub-set, and the SDK sub-set includes the second SDK file, the third SDK file, and the fourth SDK file.

2. The method according to claim 1, further comprising: Performing a security test on the SDK set to obtain a security test result; Calculating a first hash value of the Android application package; The security detection result and the first hash value of the Android application package are correspondingly stored in a database.

3. The method according to claim 2, further comprising: receiving a security detection request from a user for another Android application package; Calculating a second hash value of the another Android application package; When the second hash value is the same as the first hash value, obtaining the security detection result corresponding to the first hash value from the database; The security detection result corresponding to the first hash value is sent to a user.

4. The method according to claim 1, further comprising: Calculating a first hash value of the Android application package; Determining whether the SDK set of the Android application package already exists in the database according to the first hash value; In the case that the SDK set does not exist in the database, executing the step of decompiling the Android application package; After the SDK set is determined, the SDK set and the first hash value are correspondingly stored in the database.

5. The method according to claim 3 or 4, wherein: The first hash value comprises a SHA1 value.

6. A device for processing an application, comprising: The decompilation module is configured to decompile the Android application package to obtain the lib folder, build.gradle file and .class files; A first traversal module is configured to traverse the lib folder to obtain a first software development kit SDK file in the lib folder, wherein the first SDK file includes a jar file and a so file; An identification module is configured to identify the content in the dependent project of the build.gradle file to obtain the second SDK file; A second traversal module is configured to traverse the .class file to extract the import package content using keywords, thereby obtaining a third SDK file that may be called by the Android application package; A first acquisition module is configured to acquire a fourth SDK file actually called during the running of the Android application package in the real machine sandbox; and A determination module is configured to determine the SDK set used for security detection of the Android application package, wherein the SDK set includes the first SDK file and an SDK subset, and the SDK subset includes the second SDK file, the third SDK file and the fourth SDK file.

7. The apparatus according to claim 6, further comprising: A detection module, configured to perform a security detection on the SDK set to obtain a security detection result; A calculation module, configured to calculate a first hash value of the Android application package; The storage module is configured to store the security detection result and the first hash value of the Android application package in a database correspondingly.

8. The apparatus according to claim 7, further comprising: A receiving module, configured to receive a security detection request from a user for another Android application package; The calculation module is further configured to calculate a second hash value of the other Android application package; A second acquisition module is configured to acquire the security detection result corresponding to the first hash value from the database when the second hash value is the same as the first hash value; and The sending module is configured to send the security detection result corresponding to the first hash value to a user.

9. A device for processing an application, comprising: Memory; as well as A processor coupled to the memory is configured to execute the method according to any one of claims 1 to 5 based on instructions stored in the memory.

10. A computer-readable storage medium comprising computer program instructions, wherein: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.