CN114547604A - Application detection method and device, storage medium and electronic equipment - Google Patents

Application detection method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114547604A
CN114547604A CN202111574727.7A CN202111574727A CN114547604A CN 114547604 A CN114547604 A CN 114547604A CN 202111574727 A CN202111574727 A CN 202111574727A CN 114547604 A CN114547604 A CN 114547604A
Authority
CN
China
Prior art keywords
file
taint
target application
class
package
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111574727.7A
Other languages
Chinese (zh)
Inventor
潘雨晨
郭宇
张玉驰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Hangzhou Douku Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Douku Software Technology Co Ltd filed Critical Hangzhou Douku Software Technology Co Ltd
Priority to CN202111574727.7A priority Critical patent/CN114547604A/en
Publication of CN114547604A publication Critical patent/CN114547604A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Stored Programmes (AREA)

Abstract

本申请实施例公开了一种应用检测方法、装置、存储介质及电子设备,其中,方法包括:获取针对应用的目标应用包以及应用基准包,对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。采用本申请实施例,可以提高应用检测效率。

Figure 202111574727

Embodiments of the present application disclose an application detection method, device, storage medium, and electronic device, wherein the method includes: acquiring a target application package and an application benchmark package for an application, and performing a test on the target application package and the application benchmark package. Decompilation and comparison processing is performed to obtain a difference class set for the target application package, and static taint detection is performed on the target application package based on the difference class set to obtain a taint path set for the target application package. By adopting the embodiments of the present application, the application detection efficiency can be improved.

Figure 202111574727

Description

一种应用检测方法、装置、存储介质及电子设备Application detection method, device, storage medium and electronic device

技术领域technical field

本申请涉及计算机技术领域,尤其涉及一种应用检测方法、装置、存储介质及电子设备。The present application relates to the field of computer technology, and in particular, to an application detection method, device, storage medium and electronic device.

背景技术Background technique

随着网络技术的快速发展,用户在使用应用时面临的安全威胁越来越多,应用的隐私数据泄露问题也愈发重视。应用的应用安装包在开发阶段应至少满足安全合规的要求;基于此,通常会涉及到对应用的应用安装包进行应用检测,以降低安全风险。With the rapid development of network technology, users face more and more security threats when using applications, and more and more attention is paid to the issue of application privacy data leakage. The application installation package of the application should at least meet the requirements of security compliance in the development stage; based on this, application detection of the application installation package of the application is usually involved to reduce security risks.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种应用检测方法、装置、存储介质及电子设备,所述技术方案如下:Embodiments of the present application provide an application detection method, device, storage medium, and electronic device, and the technical solutions are as follows:

第一方面,本申请实施例提供了一种应用检测方法,所述方法包括:In a first aspect, an embodiment of the present application provides an application detection method, the method comprising:

获取针对应用的目标应用包以及应用基准包;Obtain the target application package and the application benchmark package for the application;

对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;Decompiling and comparing the target application package and the application benchmark package to obtain a set of difference classes for the target application package;

基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。Perform static taint detection on the target application package based on the difference class set to obtain a taint path set for the target application package.

第二方面,本申请实施例提供了一种应用检测装置,所述装置包括:In a second aspect, an embodiment of the present application provides an application detection device, and the device includes:

获取模块,用于获取应用的目标应用包以及应用基准包;The acquisition module is used to acquire the target application package and the application benchmark package of the application;

处理模块,用于对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;a processing module, configured to decompile and compare the target application package and the application benchmark package to obtain a set of difference classes for the target application package;

检测模块,用于基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。The detection module is configured to perform static taint detection on the target application package based on the difference class set, and obtain a taint path set for the target application package.

第三方面,本申请实施例提供一种计算机存储介质,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行上述的方法步骤。In a third aspect, an embodiment of the present application provides a computer storage medium, where the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above method steps.

第四方面,本申请实施例提供一种电子设备,可包括:处理器和存储器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述处理器加载并执行上述的方法步骤。In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded by the processor and execute the above method steps .

本申请一些实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by some embodiments of the present application include at least:

在本申请一个或多个实施例中,电子设备获取针对应用的目标应用包以及应用基准包,然后对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,就可以基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,通过基于应用基准包所确定的差异类集合可以避免对目标应用包的全量检测分析,电子设备可以仅需基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,降低了应用检测处理量避免冗余重复,可大幅提高应用检测的效率。In one or more embodiments of the present application, the electronic device obtains a target application package and an application benchmark package for an application, and then decompiles and compares the target application package and the application benchmark package to obtain a target application package for the target application. The difference class set of the application package, the static taint detection can be performed on the target application package based on the difference class set, and the taint path set for the target application package can be obtained. For the full detection and analysis of the target application package, the electronic device can only perform static taint detection on the difference code indicated by the target application package based on the difference class set, which reduces the application detection processing volume and avoids redundant repetition, which can greatly improve the efficiency of application detection. .

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1是本申请实施例提供的一种应用检测方法的流程示意图;1 is a schematic flowchart of an application detection method provided by an embodiment of the present application;

图2是本申请实施例提供的一种应用检测方法的流程示意图;2 is a schematic flowchart of an application detection method provided by an embodiment of the present application;

图3是本申请实施例提供的应用检测方法涉及的一种文件匹配的场景示意图;3 is a schematic diagram of a file matching scenario involved in an application detection method provided by an embodiment of the present application;

图4是本申请实施例提供的应用检测方法涉及的一种文件匹配的场景示意图;4 is a schematic diagram of a file matching scenario involved in an application detection method provided by an embodiment of the present application;

图5是本申请实施例提供的一种应用检测方法的流程示意图;5 is a schematic flowchart of an application detection method provided by an embodiment of the present application;

图6是本申请实施例提供的应用检测方法涉及的一种检测入口函数集合确定的场景示意图;FIG. 6 is a schematic diagram of a scenario in which a set of detection entry functions involved in an application detection method provided by an embodiment of the present application is determined;

图7为本申请实施例提供的一种应用检测系统的架构示意图;FIG. 7 is a schematic structural diagram of an application detection system provided by an embodiment of the present application;

图8是本申请实施例提供的一种应用检测装置的结构示意图;8 is a schematic structural diagram of an application detection device provided by an embodiment of the present application;

图9是本申请实施例提供的一种处理模块的结构示意图;9 is a schematic structural diagram of a processing module provided by an embodiment of the present application;

图10是本申请实施例提供的一种电子设备的结构示意图;10 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;

图11是本申请实施例提供的操作系统和用户空间的结构示意图;11 is a schematic structural diagram of an operating system and a user space provided by an embodiment of the present application;

图12是图11中安卓操作系统的架构图;Fig. 12 is the architecture diagram of the Android operating system in Fig. 11;

图13是图11中IOS操作系统的架构图。FIG. 13 is an architectural diagram of the IOS operating system in FIG. 11 .

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

在本申请的描述中,需要理解的是,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。在本申请的描述中,需要说明的是,除非另有明确的规定和限定,“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。此外,在本申请的描述中,除非另有说明,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。In the description of the present application, it should be understood that the terms "first", "second" and the like are used for descriptive purposes only, and should not be construed as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise expressly specified and defined, "including" and "having" and any modifications thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes unlisted steps or units, or optionally also includes For other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood in specific situations. Also, in the description of the present application, unless otherwise specified, "a plurality" means two or more. "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. The character "/" generally indicates that the associated objects are an "or" relationship.

下面结合具体的实施例对本申请进行详细说明。The present application will be described in detail below with reference to specific embodiments.

在一个实施例中,如图1所示,特提出了一种应用检测方法,该方法可依赖于计算机程序实现,可运行于基于冯诺依曼体系的应用检测装置上。该计算机程序可集成在应用中,也可作为独立的工具类应用运行。所述应用检测装置可以为电子设备,包括但不限于:个人电脑、平板电脑、手持设备、车载设备、服务器、计算设备或连接到无线调制解调器的其它处理设备等。在不同的网络中终端设备可以叫做不同的名称,例如:用户设备、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置、蜂窝电话、无绳电话、5G网络或未来演进网络中的设备等。In one embodiment, as shown in FIG. 1 , an application detection method is proposed, which can be implemented by relying on a computer program and can be run on an application detection device based on the von Neumann system. The computer program can be integrated into an application or run as a stand-alone utility application. The application detection device may be an electronic device, including but not limited to: a personal computer, a tablet computer, a handheld device, a vehicle-mounted device, a server, a computing device, or other processing devices connected to a wireless modem. Terminal equipment may be called by different names in different networks, for example: user equipment, access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication Equipment, User Agent or User Equipment, Cellular Phone, Cordless Phone, Equipment in 5G Network or Future Evolved Network, etc.

具体的,该应用检测方法包括:Specifically, the application detection method includes:

S101:获取针对应用的目标应用包以及应用基准包。S101: Acquire a target application package and an application benchmark package for the application.

所述应用可以理解为一些终端搭载操作系统本身自带的应用,可以是第三方应用,所述第三方应用是指由第三方开发、非终端操作系统本身自带的应用,包括一些由第三方开发的应用、小程序、插件等。在一些实施例中,可以基于应用对应的应用安装包(apk)进行应用安装或应用更新。在本申请中,目标应用包和应用基准包可以理解为针对同一应用的不同应用版本的应用安装包。The application can be understood as the application that some terminals carry with the operating system itself, which can be a third-party application. Developed applications, small programs, plug-ins, etc. In some embodiments, application installation or application update may be performed based on an application installation package (apk) corresponding to the application. In this application, the target application package and the application reference package may be understood as application installation packages for different application versions of the same application.

所述目标应用包与所述应用基准包对应的应用安装包(apk)版本不同,通常目标应用包的apk版本大于应用基准包的apk版本。The target application package is different from the application installation package (apk) version corresponding to the application benchmark package, and usually the apk version of the target application package is larger than the apk version of the application benchmark package.

在一个或多个实施例中,目标应用包可以是当前待更新版本的针对应用的应用安装包;应用基准包可以理解为针对应用历史发布的历史应用安装包。应用基准包具体可基于实际应用场景进行设置,目标应用包的apk版本大于或早于应用基准包的apk版本即可。In one or more embodiments, the target application package may be the application installation package of the current version to be updated for the application; the application reference package may be understood as the historical application installation package released for the application history. The application benchmark package can be set based on the actual application scenario, and the apk version of the target application package may be greater than or earlier than the apk version of the application benchmark package.

可以理解的,在应用更新以及应用安装等场景中,由于应用面临的安全威胁越来越多,应用设计的隐私数据泄露问题也愈发重视,应用的目标应用包的开发应至少满足安全合规的要求,在实际应用阶段,通常会涉及到对应用的应用安装包进行应用检测,而在应用检测中常常会涉及到静态污点传播检测,静态污点传播检测(简称静态污点检测)是指在不运行且不修改应用安装包的代码的前提下,通过分析应用程序变量间的数据依赖关系来检测数据能否从污点源传播到污点汇聚点.,经静态污点检测之后即可得到该应用对应的目标应用包的污点路径结果。It is understandable that in scenarios such as application update and application installation, due to the increasing number of security threats faced by applications, the issue of privacy data leakage in application design is also becoming more and more important. The development of the application's target application package should at least meet security compliance. In the actual application stage, it usually involves application detection of the application installation package of the application, and static taint propagation detection is often involved in application detection. Static taint propagation detection (referred to as static taint detection) refers to Under the premise of running and not modifying the code of the application installation package, by analyzing the data dependencies between application variables to detect whether the data can propagate from the taint source to the taint convergence point. After static taint detection, the corresponding application can be obtained. The tainted path result of the target application package.

在一些实施例中,应用开发端在完成应用的应用版本的目标应用包的开发之后,可以将目标应用包上传至电子设备(如服务平台),此时电子设备即可获取到应用的目标应用包;另外,电子设备可保存有针对应用的历史版本的历史应用安装包,电子设备可从中获取作为与目标应用包属于同一应用的应用基准包。In some embodiments, after completing the development of the target application package of the application version of the application, the application development end may upload the target application package to the electronic device (such as a service platform), and then the electronic device can obtain the target application of the application. In addition, the electronic device may save a historical application installation package for the historical version of the application, and the electronic device may obtain an application reference package from it as an application reference package belonging to the same application as the target application package.

S102:对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合。S102: Decompile and compare the target application package and the application benchmark package to obtain a difference class set for the target application package.

可以理解的,反编译比对处理可以理解为通过对应用安装包(如目标应用包、应用基准包)进行反编译可以得到其对应的反编译文件,以通过对目标应用包的反编译文件和应用基准包对应的反编译文件进行比对,来确定相对于应用基准包的针对目标应用包的差异类集合。It can be understood that the decompilation comparison process can be understood as decompiling the application installation package (such as the target application package, the application benchmark package) to obtain its corresponding decompiled file, so as to obtain the corresponding decompiled file by decompiling the application installation package (such as the target application package and the application benchmark package). The decompiled files corresponding to the application benchmark package are compared to determine a set of difference classes for the target application package relative to the application benchmark package.

可以理解的,所述差异类集合包含至少一个表征“目标应用包的反编译文件和应用基准包对应的反编译文件”的差异的类(也可理解为方法类、函数类);在一些实施例中,差异类集合可以是所述目标应用包相对于应用基准包对应的反编译文件所删减的删减类集合;差异类集合可以是所述目标应用包相对于应用基准包对应的反编译文件所增加的增量类集合It can be understood that the set of difference classes includes at least one class (which can also be understood as a method class and a function class) that represents the difference between "the decompiled file of the target application package and the decompiled file corresponding to the application benchmark package"; in some implementations In an example, the set of difference classes may be the set of pruning classes deleted from the decompiled file corresponding to the target application package relative to the application benchmark package; the set of difference classes may be the opposite of the target application package relative to the application benchmark package Incremental set of classes added by the compiled file

在一些实施方式中,对应用安装包(如目标应用包、应用基准包)进行反编译可以得到的反编译文件可以理解为:通过逆向工程对检测对象的数据(也即应用安装包)进行逆向编译,从而得到的反编译文件。在一些实施例中,对检测对象的逆向编译过程是指从而检测对象对应的已编译的文件获得相应的未编译的文件,以检测对象为常见的检测应用为例,即通过逆向工程对应用的待检测的应用安装包进行逆向编译,从而可以获得反编译文件,反编译文件至少可以是smali代码文件,在一些实施例中反编译文件还可以是各xml资源文件以及 AndroidManifest.xml布局文件等。In some embodiments, a decompiled file that can be obtained by decompiling an application installation package (such as a target application package, an application benchmark package) can be understood as: performing reverse engineering on the data of the detection object (that is, the application installation package) through reverse engineering Compile, resulting in the decompiled file. In some embodiments, the process of reverse compiling the detection object refers to obtaining corresponding uncompiled files from the compiled files corresponding to the detection object. The application installation package to be detected is reverse compiled, thereby obtaining a decompiled file. The decompiled file may at least be a smali code file. In some embodiments, the decompiled file may also be each xml resource file and an AndroidManifest.xml layout file.

可以理解的,电子设备获取的应用的目标应用包(也即待检测对象),在对目标应用包进行逆向编译时,可以预先对该目标应用包进行解包之后再逆向编译(可理解为反编译),以应用安装包为安卓(Android)应用程序包为例进行释义,该应用安装包通常为“.APK文件格式”的文件,“.APK文件格式”可以理解为一种ZIP格式的压缩文件;电子设备可以向对该应用安装包进行解包,解包过程可以为从应用安装包文件中得到classes.dex(编译后的代码文件)、resources.arsc(编译后的资源文件)、AndroidManifest.xml(编译后的布局文件),然后通常基于逆向工程中的逆向编译工具对上述编译后的文件(如编译后的代码文件、资源文件、布局文件)进行反编译,可以得到“编译后的文件”编译之前的“未编译文件”,即获得smali代码文件、各xml资源文件以及AndroidManifest.xml布局文件等,在一个或多个实施例中,反编译文件至少可以是smali文件树,smali文件树指将apk反编译后生成的smali目录下的文件集合,这些smali文件以“包名+类名”命名并以“.smali”结尾。It can be understood that, when the target application package (that is, the object to be detected) of the application obtained by the electronic device is reversely compiled, the target application package can be unpacked in advance and then reverse compiled (which can be understood as reverse compilation). Compilation), take the application installation package as an example of Android (Android) application package for interpretation, the application installation package is usually a file in ".APK file format", and ".APK file format" can be understood as a ZIP format compression file; the electronic device can unpack the application installation package, and the unpacking process can be to obtain classes.dex (compiled code file), resources.arsc (compiled resource file), AndroidManifest from the application installation package file .xml (compiled layout file), and then decompile the above-mentioned compiled files (such as compiled code files, resource files, and layout files) based on the reverse compilation tool in reverse engineering, and you can get the "compiled layout file". The "uncompiled file" before the "file" is compiled, that is, the smali code file, each xml resource file, and the AndroidManifest.xml layout file are obtained. In one or more embodiments, the decompiled file can be at least a smali file tree, a smali file The tree refers to the set of files in the smali directory generated after decompiling the apk. These smali files are named with "package name + class name" and end with ".smali".

可选的,通过获取目标应用包和应用基准包进行反编译后的反编译文件(目标应用包对应的反编译文件、应用基准包对应的反编译文件),以通过对目标应用包的反编译文件和应用基准包对应的反编译文件进行数据比对,来确定相对于应用基准包的针对目标应用包的差异类集合。Optionally, by obtaining the decompiled files (decompilation files corresponding to the target application package and decompilation files corresponding to the application benchmark package) after decompilation of the target application package and the application benchmark package, so as to decompile the target application package. The file is compared with the decompiled file corresponding to the application benchmark package to determine a set of difference classes for the target application package relative to the application benchmark package.

可选的,电子设备可仅对目标应用包采用逆向工程进行反编译,得到目标应用包的反编译文件;而应用基准包的反编译文件可以不必进行反编译处理,可以是直接获取到的,通常应用的应用基准包在发布前,电子设备已对应用基准包进行应用检测,应用检测过程会涉及到生成应用基准包对应的反编译文件,如生成应用基准包对应的smali文件树,电子设备可以将应用基准包对应的反编译文件进行保存。在具体实施中,在涉及执行“对所述目标应用包和所述应用基准包进行反编译比对处理”的步骤时,可直接获取到应用基准包对应的反编译文件而无需重新对应用基准包进行逆向编译。Optionally, the electronic device may only decompile the target application package by reverse engineering, and obtain the decompiled file of the target application package; and the decompiled file of the application benchmark package may not need to be decompiled, but may be obtained directly. Usually, before the application benchmark package of the application is released, the electronic device has performed the application detection on the application benchmark package. The application detection process will involve generating the decompiled files corresponding to the application benchmark package, such as generating the smali file tree corresponding to the application benchmark package. The decompiled file corresponding to the application benchmark package can be saved. In a specific implementation, when the step of "decompilation and comparison processing is performed on the target application package and the application benchmark package" is involved, the decompiled file corresponding to the application benchmark package can be directly obtained without re-compiling the application benchmark The package is reverse compiled.

S103:基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。S103: Perform static taint detection on the target application package based on the difference class set, to obtain a taint path set for the target application package.

可以理解的,电子设备通过对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,差异类集合一定程度上反馈目标应用包与应用基准包的代码差异,为了提高应用检测效率,本申请在对目标应包进行静态污点检测时,不采用对目标应用包所对应的全部代码进行应用检测的形式,而是确定目标应用包相对于基准应用包的差异类集合,由于基准应用包电子设备已经预先完成静态污点检测得到了污点路径集合,这样可仅基于差异类集合对目标应用包进行静态污点检测,在一些实施例中可以理解为静态污点检测可基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,这样可大幅提高针对目标应用包进行应用检测的效率。也实现了对相关场景下,应用检测时仅能基于相关污点分析工具对apk全面扫描分析的改善,实现了对新版本对应目标应用包的的增量代码的针对性静态污点检测,同时可避免污点检测冗余重复,可实现对目标应用包的快速发布,节省了检测资源。It can be understood that the electronic device obtains the difference class set for the target application package by decompiling and comparing the target application package and the application benchmark package, and the difference class set feeds back the target application package and the application to a certain extent. The code difference of the benchmark package, in order to improve the efficiency of application detection, when the application performs static taint detection on the target application package, it does not use the form of application detection for all the codes corresponding to the target application package, but determines the target application package relative to the target application package. The difference class set of the benchmark application package. Since the electronic device of the benchmark application package has completed the static taint detection in advance to obtain the taint path set, the static taint detection can be performed on the target application package only based on the difference class set. In some embodiments, it can be understood as In the static taint detection, static taint detection can be performed on the difference code indicated by the target application package based on the difference class set, which can greatly improve the efficiency of application detection for the target application package. It also realizes the improvement of the comprehensive scanning and analysis of apk based on the relevant taint analysis tools in application detection in related scenarios, and realizes the targeted static taint detection of the incremental code of the new version corresponding to the target application package, while avoiding The taint detection is redundant and repeated, which can realize the rapid release of the target application package and save the detection resources.

可以理解的,电子设备基于差异类集合确定目标应用包相对于应用基准包是否存在增量代码,若存在增量代码,电子设备可调用用于静态污点检测的污点检测工具对差异类集合在目标应用包指示的增量代码进行静态污点检测,通过检测增量代码指示的应用程序变量间的数据依赖关系来检测数据能否从污点传播到污点汇聚点,进而确定本次采用污点检测工具得到的第一污点路径集合。其中,电子设备可以获取应用基准包对应的第二污点路径集合,然后根据差异类集合对第一污点路径集合和第二污点路径集合进行数据拟合,得到针对目标应用包的污点路径集合。It can be understood that the electronic device determines whether the target application package has incremental code relative to the application benchmark package based on the difference class set. If there is incremental code, the electronic device can call the taint detection tool for static taint detection to detect the difference class set in the target. The incremental code indicated by the application package performs static taint detection, and detects whether the data can be propagated from the taint to the taint convergence point by detecting the data dependencies between the application variables indicated by the incremental code, and then determines whether the taint detection tool is used this time. The first taint path collection. The electronic device may obtain the second taint path set corresponding to the application benchmark package, and then perform data fitting on the first taint path set and the second taint path set according to the difference class set to obtain a taint path set for the target application package.

可以理解的,若不存在增量代码,此时差异类集合通常为删减类集合,电子设备可以无需调用污点检测工具对目标应用包进行检侧,而是基于应用基准包对应的第二污点路径集合来结合删减类集合确定污点路径集合,具体而言忽略删减类集合在第二污点路径集合指示的目标污点路径,来以此得到忽略处理目标污点路径之后不含目标污点路径的第二污点路径集合作为针对目标应用包的污点路径集合。It is understandable that if there is no incremental code, the difference class set is usually a deletion class set at this time, and the electronic device can check the target application package without calling the taint detection tool, but based on the second taint corresponding to the application benchmark package. The path set is used to determine the taint path set in combination with the deletion class set. Specifically, the target taint path indicated by the deletion class set in the second taint path set is ignored, so as to obtain the first taint path without the target taint path after ignoring and processing the target taint path. The second taint path set is used as the taint path set for the target application package.

在本申请实施例中,电子设备获取针对应用的目标应用包以及应用基准包,然后对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,就可以基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,通过基于应用基准包所确定的差异类集合可以避免对目标应用包的全量检测分析,电子设备可以仅需基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,降低了应用检测处理量避免冗余重复,可大幅提高应用检测的效率。In the embodiment of the present application, the electronic device obtains a target application package and an application benchmark package for an application, and then decompiles and compares the target application package and the application benchmark package to obtain the difference for the target application package. class set, static taint detection can be performed on the target application package based on the difference class set, and a taint path set for the target application package can be obtained. For full detection and analysis, the electronic device can only perform static taint detection on the difference code indicated by the target application package based on the difference class set, which reduces the application detection processing load and avoids redundant repetition, which can greatly improve the efficiency of application detection.

请参见图2,图2是本申请提出的一种应用检测方法的另一种实施例的流程示意图。具体的:Please refer to FIG. 2 , which is a schematic flowchart of another embodiment of an application detection method proposed in the present application. specific:

S201:获取针对应用的目标应用包以及应用基准包。S201: Obtain a target application package and an application benchmark package for the application.

具体可参见S101,此处不再赘述。For details, refer to S101, which will not be repeated here.

S202:确定所述应用基准包对应的第一反编译文件,确定所述目标应用包对应的第二反编译文件;S202: Determine a first decompiled file corresponding to the application benchmark package, and determine a second decompiled file corresponding to the target application package;

所述第一反编译文件可以理解为电子设备通过逆向工程对应用的待检测的应用基准包进行逆向编译,从而得到的反编译文件;第一反编译文件至少可以是应用基准包对应的smali 代码文件,在一些实施例中,第一反编译文件可以是smali文件树,smali文件树指将应用基准包apk反编译后生成的smali目录下的smali文件的文件集合,这些smali文件以“包名+ 类名”命名并以“.smali”结尾。The first decompilation file can be understood as a decompilation file obtained by the electronic device reversely compiling the application benchmark package to be detected of the application through reverse engineering; the first decompilation file can be at least the smali code corresponding to the application benchmark package. file, in some embodiments, the first decompiled file may be a smali file tree, and the smali file tree refers to a file collection of smali files in the smali directory generated after decompiling the application benchmark package apk. These smali files start with "package name". + classname" and ends with ".smali".

所述第二反编译文件可以理解为电子设备通过逆向工程对应用的待检测的目标应用包进行逆向编译,从而得到的反编译文件;第二反编译文件至少可以是应用基准包对应的smali 代码文件,在一些实施例中,第二反编译文件可以是smali文件树,smali文件树可以理解为将目标应用包apk反编译后生成的smali目录下的smali文件的文件集合,这些smali文件以“包名+类名”命名并以“.smali”结尾。The second decompilation file can be understood as the decompilation file obtained by the electronic device reversely compiling the target application package to be detected of the application through reverse engineering; the second decompilation file may at least be the smali code corresponding to the application benchmark package. file, in some embodiments, the second decompiled file may be a smali file tree, and the smali file tree may be understood as a file collection of smali files in the smali directory generated after the target application package apk is decompiled. These smali files start with " package name + class name" and ends with ".smali".

可选的,第一反编译文件和第二反编译文件可以采用逆向工程中的apk编译工具得到,如apk编译工具:apktool。Optionally, the first decompiled file and the second decompiled file may be obtained by using an apk compilation tool in reverse engineering, such as an apk compilation tool: apktool.

可以理解的,以时间维度来看,应用基准包的安装包版本在目标应用包的安装包版本之前。It can be understood that, in terms of time dimension, the installation package version of the application reference package is before the installation package version of the target application package.

可以理解的,电子设备在确定第一反编译文件和第二反编译文件之后,再将所述第一反编译文件以及所述第二反编译文件进行比对处理,以得到针对所述目标应用包的差异类集合,具体可参见本申请实施例涉及的其他方法步骤。It can be understood that, after determining the first decompiled file and the second decompiled file, the electronic device compares the first decompiled file and the second decompiled file, so as to obtain information for the target application. For the difference class set of the package, for details, refer to other method steps involved in the embodiments of the present application.

S203:以所述第一反编译文件所包含的至少一个基准文件为参考,在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合。S203: Using at least one benchmark file included in the first decompiled file as a reference, determine a first file that does not match each of the benchmark files in the second decompiled file, and based on the first file A set of incremental classes for the target application package is determined.

在一个或多个实施例中,第一反编译文件可以是基准应用包对应的smail文件树,smail 文件树可以理解为将基准应用包apk反编译后生成的smali目录下的smali文件的文件集合,其中,基准文件可理解为第一反编译文件(如反编译文件树)中的smali文件。进一步的,以操作系统为安卓系统为例,Smali可理解Android虚拟机的反汇编语言,smali文件树是由 smali文件组成的树形目录结构,通常视作为smali文件组成的文件集合。In one or more embodiments, the first decompiled file may be a smail file tree corresponding to the benchmark application package, and the smail file tree may be understood as a file set of smali files in the smali directory generated after decompiling the benchmark application package apk , wherein the benchmark file can be understood as the smali file in the first decompiled file (eg, the decompiled file tree). Further, taking the Android system as the operating system as an example, Smali can understand the disassembly language of the Android virtual machine, and the smali file tree is a tree-shaped directory structure composed of smali files, which is usually regarded as a file collection composed of smali files.

在一种具体的实施场景中,电子设备以所述第一反编译文件所包含的至少一个基准文件为参考,对第二反编译文件进行文件遍历,以在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件对应的类来确定针对所述目标应用包的增量类集合。可以理解的,若第一文件的数量为n(n为自然数),则增量类集合中的第一文件的类的数量为n。所述第一文件可以理解为相对于第一反编译文件所对应的增量文件,例如增量smali 文件。In a specific implementation scenario, the electronic device uses at least one reference file included in the first decompiled file as a reference, and performs file traversal on the second decompiled file to determine in the second decompiled file For a first file that does not match each of the reference files, an incremental class set for the target application package is determined based on a class corresponding to the first file. It can be understood that, if the number of first files is n (n is a natural number), the number of classes of the first file in the incremental class set is n. The first file may be understood as an incremental file corresponding to the first decompiled file, such as an incremental smali file.

简而言之,通过遍历待分析的目标应用文件所对应的smali文件树,对于smali文件树中的每个smali文件,该第一smali文件所对应的类在基准apk中不存在,这样第一smali文件的类属于新增的类,因此将该第一smali文件的文件名添加到增量集合中。In short, by traversing the smali file tree corresponding to the target application file to be analyzed, for each smali file in the smali file tree, the class corresponding to the first smali file does not exist in the benchmark apk, so the first The class of the smali file belongs to the newly added class, so the filename of the first smali file is added to the incremental set.

在一种可行的实施方式中,设置增量类集合IncrementalList,以第一反编译文件为smali 文件树T1、以第二反编译文件为smali文件树T2进行释义,如下:In a feasible implementation manner, an incremental class set IncrementalList is set, and the first decompiled file is used as the smali file tree T1, and the second decompiled file is used as the smali file tree T2 for interpretation, as follows:

第二反编译文件为smali文件树T2中包含N(N为正整数)个目标文件,电子设备以所述第一反编译文件也即“smali文件树T1”所包含至少一个基准文件为参考,如下:The second decompiled file is that the smali file tree T2 contains N (N is a positive integer) target files, and the electronic device uses the first decompiled file, that is, at least one reference file included in the "smali file tree T1" as a reference, as follows:

1、获取“目标文件1”,对第一反编译文件也即“smali文件树T1”进行文件遍历,将当前的“目标文件1”与“smali文件树T1”中的每个“基准文件”分别进行匹配,检测是否“目标文件1”是否与每个所述基准文件不匹配,若不匹配,则确定“目标文件1”为第一文件;将作为第一文件的“目标文件1”对应的类加入至增量类集合IncrementalList;1. Obtain "target file 1", perform file traversal on the first decompiled file, that is, "smali file tree T1", and compare the current "target file 1" and each "benchmark file" in "smali file tree T1" Matching is carried out respectively to detect whether "target file 1" does not match each of the reference files, if not, then determine that "target file 1" is the first file; "target file 1" as the first file corresponds to The class is added to the incremental class collection IncrementalList;

2、获取“目标文件2”,对第一反编译文件也即“smali文件树T1”进行文件遍历,将当前的“目标文件2”与“smali文件树T1”中的每个“基准文件”分别进行匹配,检测是否“目标文件2”是否与每个所述基准文件不匹配,若不匹配,则确定“目标文件2”为第一文件;将作为第一文件的“目标文件2”对应的类加入至增量类集合IncrementalList;2. Obtain the "target file 2", perform file traversal on the first decompiled file, that is, the "smali file tree T1", and compare the current "target file 2" and each "benchmark file" in the "smali file tree T1" Matching is carried out respectively to detect whether "target file 2" does not match each of the reference files, if not, then determine that "target file 2" is the first file; "target file 2" as the first file corresponds to The class is added to the incremental class collection IncrementalList;

........

i、如图3所示,图3是本申请涉及的一种文件匹配的场景示意图,如图3,电子设备可以获取“目标文件i”(i为大于0的整数),对第一反编译文件也即“smali文件树T1”进行文件遍历,将当前的“目标文件i”与“smali文件树T1”中的每个“基准文件”分别进行匹配,检测是否“目标文件i”是否与每个所述基准文件不匹配,若不匹配,则确定“目标文件i”为第一文件;将作为第一文件的“目标文件i”对应的类加入至增量类集合IncrementalList;i. As shown in FIG. 3, FIG. 3 is a schematic diagram of a file matching scenario involved in this application. As shown in FIG. 3, the electronic device can obtain "target file i" (i is an integer greater than 0), and decompile the first The file, that is, the "smali file tree T1", performs file traversal, matches the current "target file i" with each "reference file" in the "smali file tree T1", and detects whether the "target file i" matches each "reference file". Each of the reference files does not match, if it does not match, then determine that "target file i" is the first file; add the class corresponding to "target file i" as the first file to the incremental class set IncrementalList;

以此类推,直至i等于N完成匹配之后结束,得到增量类集合IncrementalList。And so on, until i is equal to N, the matching ends, and the incremental class collection IncrementalList is obtained.

可以理解的,第一smali文件以“包名+类名”命名并以“.smali”结尾,这样通过获取第一smali文件的文件名称,将文件名称中对应的后缀名“.smali”进行去除处理,然后将去除“.smali”之后的文件名称(也即作为增量类)添加至增量类集合中以完成“将第一文件对应的类加入至增量类集合中”。进一步的,所述增量类集合中的至少一个增量类(如新增函数类)可以是相当于“第一反编译文件所包含的基准文件”所新增的新增函数类(可理解为该增量函数类不存在与第一反编译文件中);在一些实施例中,所述增量类集合中的至少一个增量类(如增量函数类)可以是相当于“第一反编译文件所包含的基准文件”所修改的增量函数类(可理解为该增量函数类是在第一反编译文件中某一基准文件的基础上修改之后生成的修改函数类)。It is understandable that the first smali file is named with "package name + class name" and ends with ".smali", so by obtaining the file name of the first smali file, the corresponding suffix ".smali" in the file name is removed. Process, and then add the file name after removing ".smali" (that is, as an incremental class) into the incremental class set to complete "adding the class corresponding to the first file to the incremental class set". Further, at least one incremental class (such as a newly added function class) in the incremental class set may be a newly added function class (understandable) equivalent to the newly added function class (understandably Because the incremental function class does not exist in the first decompiled file); in some embodiments, at least one incremental class (eg, incremental function class) in the incremental class set may be equivalent to "the first incremental function class". The reference file included in the decompiled file” is an incremental function class modified (it can be understood that the incremental function class is a modified function class generated after modification on the basis of a certain benchmark file in the first decompiled file).

可选的,上述“在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件”的过程:可以是通过检测基准文件与‘第二反编译文件所包含的至少一个目标文件’是否一致,也即比对基准文件与目标文件两者间的数据,若某一基准文件与所有的目标文件都不一致,该“某一基准文件”通常为新增的smail文件,将该“某一基准文件”作为第一文件,此时第一文件对应的类通常属于新增的新增函数类。Optionally, the above-mentioned process of "determining the first file that does not match each of the benchmark files in the second decompiled file" can be performed by detecting at least the benchmark file and the second decompiled file. Whether a target file' is consistent, that is, comparing the data between the reference file and the target file, if a certain reference file is inconsistent with all target files, the "a certain reference file" is usually a newly added smail file, The "a certain reference file" is used as the first file, and the class corresponding to the first file usually belongs to the newly added function class.

可选的,上述“在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件”的过程:可以是通过比对文件名称,也即“在所述第二反编译文件中确定与每个所述基准文件的基准文件名称不匹配的第一文件名称,基于所述第一文件名称确定针对所述目标应用包的增量类集合”,可以理解的,若第二反编译文件中的某一目标文件的名称与所有的基准文件名称均不匹配,则将该“某一目标文件”作为第一文件,第一文件名称也即“某一目标文件”的名称。Optionally, the above-mentioned process of "determining the first file that does not match each of the benchmark files in the second decompiled file" can be performed by comparing the file names, that is, "in the second decompilation file". Determine the first file name that does not match the reference file name of each of the reference files in the compiled file, and determine the incremental class set for the target application package based on the first file name. The name of a certain object file in the second decompiled file does not match the names of all the benchmark files, then this "a certain object file" is regarded as the first file, and the first file name is also the name of "a certain object file" .

在一个或多个实施例中,在每确定第一文件之后可以随之将第一文件从所属的第二反编译文件中进行忽略标记,忽略标记用于指示在下一轮文件匹配过程(将当前的“目标文件i”与“smali文件树T1”中的每个“基准文件”分别进行匹配”的步骤)对该忽略标记的第一文件进行跳过,可不必对此时的第一文件进行匹配,避免每一轮均对已经确定第一文件再判断以节省匹配计算资源,提高应用检测效率。In one or more embodiments, after each determination of the first file, the first file may be marked with an ignore mark from the second decompiled file to which it belongs, and the ignore mark is used to indicate that in the next round of file matching process (the current The "target file i" of the "smali file tree T1" is matched with each "reference file" in the "smali file tree T1"" step) to skip the first file marked with the ignore, and it is not necessary to perform the first file at this time. Matching avoids re-judging the determined first file in each round to save matching computing resources and improve application detection efficiency.

在一些实施方式中可以在每确定第一文件之后将第一文件从第二反编译文件中进行删除处理,以避免在下一轮“将当前的“基准文件i”与“smali文件树T2”中的每个“目标文件”分别进行匹配”的步骤时,可不必对此时的第一文件进行匹配,避免每一轮均对已经确定第一文件再判断以节省匹配计算资源,提高应用检测效率。In some embodiments, the first file may be deleted from the second decompiled file after each first file is determined, so as to avoid the next round of "combining the current "reference file i" with the "smali file tree T2" In the step of matching each "target file", it is not necessary to match the first file at this time, so as to avoid re-judging the determined first file in each round to save matching computing resources and improve application detection efficiency .

在一种可行的实施方式中,电子设备还可以:以所述第一反编译文件所包含的至少一个基准文件的基准文件名称为参考,在所述第二反编译文件中确定与至少一个所述基准文件名称相匹配的第四文件名称,此时可理解为,第四文件名称与基准文件名称相匹配,第四文件与基准文件可能是相同的,也有可能是在基准文件上进行代码修改或代码调整得到的第四文件;基于此,可进一步比对第四文件与基准文件的文件数据是否一致,可以分别对第四文件和基准文件进行摘要计算,得到第四文件和基准文件分别对应的摘要值,通过比对第四文件和基准文件分别对应的摘要值是否一致来确定“第四文件与基准文件的文件数据是否一致”;In a feasible implementation manner, the electronic device may further: use the reference file name of at least one reference file included in the first decompiled file as a reference, and determine in the second decompiled file that the reference file is the same as the at least one reference file included in the second decompiled file. If the name of the fourth file matches the name of the benchmark file, it can be understood that the name of the fourth file matches the name of the benchmark file, the fourth file and the benchmark file may be the same, or the code may be modified on the benchmark file. Or the fourth file obtained by code adjustment; based on this, it is possible to further compare whether the file data of the fourth file and the benchmark file are consistent, and to perform summary calculations on the fourth file and the benchmark file respectively. The summary value of the fourth file and the reference file are compared to determine whether the file data of the fourth file and the reference file are consistent with each other.

可以理解的,可以采用摘要算法计算文件(如第四文件、基准文件)的摘要值,所述摘要算法包括但不限于MD(消息摘要)算法、SHA(安全散列)算法、MAC(消息认证码)算法等等,具体可基于实际应用情况进行设置,此处不作具体限定。It can be understood that a digest algorithm can be used to calculate the digest value of the file (such as the fourth file and the reference file). The digest algorithm includes but is not limited to MD (Message Digest) algorithm, SHA (Secure Hash) algorithm, MAC (Message Authentication) algorithm. code) algorithm, etc., which can be specifically set based on the actual application, which is not specifically limited here.

例如可以通过MD(消息摘要)算法中的MD5算法计算第四文件与基准文件分别对应的摘要值,当两者摘要值一致时,此时第四文件与基准文件是相同的;当两者摘要值不同时,此时为在基准文件上进行代码修改或代码调整得到的第四文件,此种情况下,电子设备基于所述第四文件名称确定针对所述目标应用包的修改类,将该修改类加入至增量类集合中。具体可以参照第一文件对应的增量类的确定方式,两者类似。For example, the digest values corresponding to the fourth file and the reference file can be calculated by the MD5 algorithm in the MD (Message Digest) algorithm. When the digest values of the two are consistent, the fourth file and the reference file are the same; When the values are different, it is the fourth file obtained by performing code modification or code adjustment on the reference file. In this case, the electronic device determines the modification class for the target application package based on the name of the fourth file, and uses the The modified class is added to the incremental class collection. For details, refer to the method for determining the incremental class corresponding to the first file, and the two are similar.

S204:以所述第二反编译文件所包含的至少一个目标文件为参考,在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合。S204: With reference to at least one object file included in the second decompiled file, determine in the first decompiled file a second file that does not match each of the object files and a second file that does not match at least one of the objects For a third file that matches the file, a deletion class set and an incremental class set for the target application package are determined based on the second file and the third file.

在一个或多个实施例中,第二反编译文件可以是基准应用包对应的smail文件树,smail 文件树可以理解为将基准应用包apk反编译后生成的smali目录下的smali文件的文件集合,其中,目标文件可理解为第二反编译文件(如反编译文件树)中的smali文件。进一步的,以操作系统为安卓系统为例,Smali可理解Android虚拟机的反汇编语言,smali文件树是由 smali文件组成的树形目录结构,通常视作为smali文件组成的文件集合。In one or more embodiments, the second decompiled file may be a smail file tree corresponding to the benchmark application package, and the smail file tree may be understood as a file set of smali files in the smali directory generated after decompiling the benchmark application package apk , where the target file can be understood as the smali file in the second decompiled file (eg, the decompiled file tree). Further, taking the Android system as the operating system as an example, Smali can understand the disassembly language of the Android virtual machine, and the smali file tree is a tree-shaped directory structure composed of smali files, which is usually regarded as a file collection composed of smali files.

在一种具体的实施场景中,电子设备以所述第二反编译文件所包含的至少一个目标文件为参考,对第一反编译文件进行文件遍历,以在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合。In a specific implementation scenario, the electronic device uses at least one target file included in the second decompiled file as a reference, and performs file traversal on the first decompiled file to determine in the first decompiled file A second file that does not match each of the target files and a third file that matches at least one of the target files, determining a deletion for the target application package based on the second file and the third file Class Collections and Incremental Class Collections.

简而言之,通过遍历基准应用文件所对应的smali文件树,来确定第二文件以及第三文件,由于第二文件与第二反编译文件中每个所述目标文件均不匹配的,则通常第二文件对应的函数类是删减了的,在一种可行的实施方式中,电子设备可以将所述第二文件的第二文件名称加入至针对所述目标应用包的删减类集合;In short, the second file and the third file are determined by traversing the smali file tree corresponding to the benchmark application file. Since the second file does not match each of the target files in the second decompiled file, then Usually, the function class corresponding to the second file is deleted. In a feasible implementation manner, the electronic device may add the second file name of the second file to the set of deleted classes for the target application package. ;

可选的,上述“在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件”的过程:可以是通过检测目标文件与‘第一反编译文件所包含的每个基准文件’是否一致,也即比对每个基准文件与目标文件两者间的数据,若某一基准文件与所有的目标文件都不一致,该“某一基准文件”通常为删除了的smail文件,将该“某一基准文件”作为第二文件,此时第二文件对应的类通常属于删减的删减函数类。Optionally, the above-mentioned process of "determining a second file that does not match each of the target files in the first decompiled file" can be performed by detecting the target file and each Whether a benchmark file' is consistent, that is, compare the data between each benchmark file and the target file, if a benchmark file is inconsistent with all target files, the "a benchmark file" is usually the deleted smail file. file, the "a certain reference file" is used as the second file, and the class corresponding to the second file at this time usually belongs to the deleted function class.

可选的,上述“在所述第一反编译文件中确定与每个所述目标文件的目标文件名称不匹配的第二文件名称”的过程:可以是通过比对文件名称,也即“在所述第一反编译文件中确定与每个所述目标文件的目标文件名称不匹配的第二文件名称,基于所述第二文件名称确定针对所述目标应用包的删减类集合”。Optionally, the above-mentioned process of "determining a second file name that does not match the target file name of each of the target files in the first decompiled file" can be performed by comparing the file names, that is, "in the A second file name that does not match the target file name of each of the target files is determined in the first decompiled file, and a set of pruning classes for the target application package is determined based on the second file name.

进一步的,电子设备在所述第一反编译文件中确定与至少一个所述目标文件相匹配的第三文件,可以是通过比对文件名称,也即存在基准文件与目标文件的名称相同,与基准文件名称相同的目标文件(与基准文件相同名称的目标文件可作为第三文件,两者smail文件对应的类是相同的)可视作为第三文件;文件名称相匹配,相同名称的目标文件与基准文件可能是相同的文件数据,也有可能是在基准文件上进行代码修改或代码调整得到的第三文件;基于此,可进一步比对第三文件与基准文件的文件数据是否一致,例如可以计算第三文件与基准文件的摘要值,当两者摘要值一致时,此时第三文件与基准文件是相同的;当两者摘要值不同时,此时为在基准文件上进行代码修改或代码调整得到的第三文件,此种情况下,电子设备基于所述第三文件名称确定针对所述目标应用包的修改类,将该修改类加入至增量类集合中。Further, the electronic device determines a third file that matches at least one of the target files in the first decompiled file, which can be by comparing the file names, that is, there is a reference file with the same name as the target file, and the same name as the target file. The target file with the same name as the benchmark file (the target file with the same name as the benchmark file can be used as the third file, and the classes corresponding to the two smail files are the same) can be regarded as the third file; if the file names match, the target file with the same name It may be the same file data as the benchmark file, or it may be a third file obtained by code modification or code adjustment on the benchmark file; Calculate the digest values of the third file and the benchmark file. When the two digest values are consistent, the third file and the benchmark file are the same; when the two digest values are different, code modification or The third file obtained by code adjustment. In this case, the electronic device determines a modification class for the target application package based on the name of the third file, and adds the modification class to the incremental class set.

可以理解的,第二smali文件以“包名+类名”命名并以“.smali”结尾,这样通过获取第二smali文件的文件名称,将文件名称中对应的后缀名“.smali”进行去除处理,然后将去除“.smali”之后的文件名称(也即作为增量类)添加至删减类集合中以完成“将第二文件对应的类加入至删减类集合中”。It is understandable that the second smali file is named with "package name + class name" and ends with ".smali", so by obtaining the file name of the second smali file, the corresponding suffix ".smali" in the file name is removed. Process, and then add the file name after removing ".smali" (that is, as an incremental class) into the set of pruned classes to complete "adding the class corresponding to the second file to the set of pruned classes".

可以理解的,第三smali文件以“包名+类名”命名并以“.smali”结尾,这样通过获取第三smali文件的文件名称,将文件名称中对应的后缀名“.smali”进行去除处理,然后将去除“.smali”之后的文件名称(也即作为增量类)添加至删减类集合中以完成“将第三文件对应的类加入至增量类集合中”。It is understandable that the third smali file is named with "package name + class name" and ends with ".smali", so by obtaining the file name of the third smali file, the corresponding suffix ".smali" in the file name is removed. process, and then add the file name after removing ".smali" (that is, as an incremental class) into the set of pruned classes to complete "adding the class corresponding to the third file to the set of incremental classes".

在一种可行的实施方式中,设置增量类集合IncrementalList,设置删减类集ReducedList;In a feasible implementation manner, the incremental class set IncrementalList is set, and the deletion class set ReducedList is set;

以第一反编译文件为smali文件树T1、以第二反编译文件为smali文件树T2进行释义,如下:Take the first decompiled file as the smali file tree T1 and the second decompiled file as the smali file tree T2 for interpretation, as follows:

电子设备以所述第二反编译文件也即“smali文件树T2”所包含的N个(N为正整数)目标文件为参考:The electronic device refers to N (N is a positive integer) object files contained in the second decompiled file, that is, the "smali file tree T2":

1、获取“基准文件1”,对第二反编译文件也即“smali文件树T2”进行文件遍历,将当前的“基准文件1”与“smali文件树T2”中的每个“目标文件”分别进行匹配,一方面:检测“基准文件1”是否与每个目标文件不匹配,若不匹配,则确定“基准文件1”为第二文件;将作为第二文件的“基准文件1”对应的类加入至删减类集合ReducedList,其中,文件匹配可以通过比对各文件的文件名称;另一方面:检测是否“基准文件1”是否与至少一个目标文件匹配,若匹配,确定“基准文件1”为第三文件;再将第三文件和“与第三文件的文件名称相同的参考目标文件”进行文件数据匹配,在两者文件数据不相同的情况下,说明“与第三文件的文件名称相同的参考目标文件”是对“第三文件”进行代码修改或代码调整生成的第三文件,此时将第三文件对应的类加入至增量类集合IncrementalList中。1. Obtain "benchmark file 1", perform file traversal on the second decompiled file, that is, "smali file tree T2", and traverse the current "benchmark file 1" and each "target file" in "smali file tree T2" Matching is performed separately. On the one hand, it is detected whether the "benchmark file 1" does not match each target file. If it does not match, it is determined that the "benchmark file 1" is the second file; the "benchmark file 1" as the second file corresponds to The class is added to the reduced class collection ReducedList, in which the file matching can be done by comparing the file names of each file; on the other hand, it is detected whether the "benchmark file 1" matches at least one target file, and if it matches, determine the "benchmark file". 1" is the third file; then match the file data between the third file and the "reference target file with the same file name as the third file". The reference target file with the same file name" is the third file generated by code modification or code adjustment of the "third file". At this time, the class corresponding to the third file is added to the incremental class set IncrementalList.

2、获取“基准文件2”,对第二反编译文件也即“smali文件树T2”进行文件遍历,将当前的“基准文件2”与“smali文件树T2”中的每个“目标文件”分别进行匹配,一方面:检测“基准文件2”是否与每个目标文件不匹配,若不匹配,则确定“基准文件2”为第二文件;将作为第二文件的“基准文件2”对应的类加入至删减类集合ReducedList,其中,文件匹配可以通过比对各文件的文件名称;另一方面:检测是否“基准文件2”是否与至少一个目标文件匹配,若匹配,确定“基准文件2”为第三文件;再将第三文件和“与第三文件的文件名称相同的参考目标文件”进行文件数据匹配,在两者文件数据不相同的情况下,说明“与第三文件的文件名称相同的参考目标文件”是对“第三文件”进行代码修改或代码调整生成的第三文件,此时将第三文件对应的类加入至增量类集合IncrementalList中。2. Obtain the "benchmark file 2", perform file traversal on the second decompiled file, that is, the "smali file tree T2", and compare the current "benchmark file 2" and each "target file" in the "smali file tree T2" Matching is carried out respectively. On the one hand, it is detected whether the "benchmark file 2" does not match each target file. If it does not match, it is determined that the "benchmark file 2" is the second file; the "benchmark file 2" as the second file corresponds to The class is added to the reduced class set ReducedList, in which the file matching can be done by comparing the file names of each file; on the other hand, it is detected whether the "reference file 2" matches at least one target file, and if it matches, determine the "reference file". 2" is the third file; then match the file data between the third file and the "reference target file with the same file name as the third file". The reference target file with the same file name" is the third file generated by code modification or code adjustment of the "third file". At this time, the class corresponding to the third file is added to the incremental class set IncrementalList.

........

i、如图4所示,图4是本申请涉及的另一种文件匹配的场景示意图,如图3,电子设备可以获取“基准文件i”,对第二反编译文件也即“smali文件树T2”进行文件遍历,将当前的“基准文件i”与“smali文件树T2”中的每个“目标文件”分别进行匹配,一方面:检测“基准文件i”是否与每个目标文件不匹配,若不匹配,则确定“基准文件i”为第二文件;将作为第二文件的“基准文件i”对应的类加入至删减类集合ReducedList,其中,文件匹配可以通过比对各文件的文件名称;另一方面:检测是否“基准文件i”是否与至少一个目标文件匹配,若匹配,确定“基准文件i”为第三文件;再将第三文件和“与第三文件的文件名称相同的参考目标文件”进行文件数据匹配,在两者文件数据不相同的情况下,说明“与第三文件的文件名称相同的参考目标文件”是对“第三文件”进行代码修改或代码调整生成的第三文件,此时将第三文件对应的类加入至增量类集合IncrementalList中。i. As shown in Figure 4, Figure 4 is a schematic diagram of another file matching scenario involved in this application. As shown in Figure 3, the electronic device can obtain the "reference file i", and the second decompiled file is also the "smali file tree". T2" performs file traversal, and matches the current "baseline file i" with each "target file" in the "smali file tree T2". On the one hand, it detects whether "baseline file i" does not match each target file , if it does not match, then determine the "reference file i" as the second file; add the class corresponding to the "reference file i" as the second file to the reduced class set ReducedList, where the file matching can be achieved by comparing the File name; on the other hand: check whether "reference file i" matches at least one target file, if it matches, determine "reference file i" as the third file; then compare the third file with "the file name of the third file" The same reference object file” is used to match the file data. If the data of the two files are different, it is explained that the “reference object file with the same file name as the third file” is the code modification or code adjustment for the “third file”. In the generated third file, the class corresponding to the third file is added to the incremental class set IncrementalList at this time.

以此类推,直至i等于N,得到增量类集合IncrementalList和删减类集合ReducedList。And so on, until i is equal to N, the incremental class set IncrementalList and the deletion class set ReducedList are obtained.

可以理解的:上述过程通过遍历基准smali文件树T1,读取每个smali文件的文件名N1,若smali文件树T2中不存在与N1相同的smali文件,此时确定第二文件,第二文件的文件名称为N1,则将N1的后缀“.smali”剔除后添加到删减类集合ReducedList;若smali文件树 T2中存在文件名称N2与文件名称N1相同,则计算N1文件的MD5值(记为MD5_1)与N2 文件的MD5值(记为MD5_2),若MD5_1与MD5_2相同,则将N2从T2中删除或进行忽略标记,以节省后续匹配时的计算处理资源,提高检测效率;若MD5_1与MD5_2不相同,则将N1的后缀剔除后添加到增量类集合IncrementalList中,并从T2中删除N2,以节省后续匹配时的计算处理资源,提高检测效率;It is understandable: the above process reads the file name N1 of each smali file by traversing the benchmark smali file tree T1. If the smali file that is the same as N1 does not exist in the smali file tree T2, then determine the second file, the second file If the file name is N1, the suffix ".smali" of N1 will be removed and added to the reduced class set ReducedList; if there is a file name N2 in the smali file tree T2 that is the same as the file name N1, then calculate the MD5 value of the N1 file (recorded is MD5_1) and the MD5 value of the N2 file (denoted as MD5_2), if MD5_1 and MD5_2 are the same, then delete N2 from T2 or mark it to be ignored to save computational processing resources during subsequent matching and improve detection efficiency; if MD5_1 and MD5_2 are identical to If MD5_2 is not the same, the suffix of N1 is removed and added to the incremental class set IncrementalList, and N2 is deleted from T2 to save computing and processing resources during subsequent matching and improve detection efficiency;

在一种可行的实施方式中,进一步比对第三文件与基准文件的文件数据是否一致,电子设备可以执行“获取所述第三文件与所述基准文件的摘要匹配结果,基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述增量类集合”的步骤。In a feasible implementation manner, to further compare whether the file data of the third file and the reference file are consistent, the electronic device may execute "obtain a summary matching result between the third file and the reference file, and based on the summary matching As a result, the third file name of the third file is added to the incremental class set" step.

其中,摘要匹配结果可以理解为采用摘要算法(如MD5算法)对两个文件(如第三文件、基准文件)分别计算摘要值,对两个文件的摘要值进行匹配得到的匹配结果,该匹配结果也称之为摘要匹配结果。例如可以将两个文件的摘要值进行比对(比对两个文件的摘要值是否一致)得到比对结果以作为摘要匹配结果,摘要匹配结果包含摘要匹配类型和摘要不匹配类型;摘要匹配类型的摘要结果可以理解为两个文件(如第三文件、基准文件)的摘要值相匹配,例如两个文件的摘要值一致;摘要不匹配类型的摘要结果可以理解为两个文件(如第三文件、基准文件)的摘要值不匹配,例如两个文件的摘要值不一致;The digest matching result can be understood as a matching result obtained by using a digest algorithm (such as the MD5 algorithm) to calculate digest values for two files (such as the third file and the benchmark file) respectively, and matching the digest values of the two files. The results are also referred to as digest match results. For example, the digest values of the two files can be compared (check whether the digest values of the two files are consistent) to obtain the comparison result as the digest matching result. The digest matching result includes the digest matching type and the digest mismatching type; the digest matching type The summary results of the two files (such as the third file and the benchmark file) can be understood as matching the summary values of the two files, for example, the summary values of the two files are consistent; the summary results of the summary mismatch type can be understood as the two files (such as the third The digest values of files, benchmark files) do not match, for example, the digest values of the two files are inconsistent;

可以理解的:例如可以采用MD5算法计算第三文件与基准文件的摘要值,将第三文件与基准文件的摘要值进行匹配,当摘要匹配结果指示两者摘要值一致时通常摘要匹配结果为摘要匹配类型时,可以理解为第三文件与基准文件是相同的;当摘要匹配结果指示两者摘要值不同时通常摘要匹配结果为摘要不匹配类型时,可以理解为通常是在基准文件上进行代码修改或代码调整得到的第三文件,此种情况下,电子设备基于所述第三文件名称确定针对所述目标应用包的修改类,将该修改类加入至增量类集合中。It is understandable: for example, the MD5 algorithm can be used to calculate the digest values of the third file and the reference file, and the digest values of the third file and the reference file can be matched. When the digest matching result indicates that the digest values of the two are consistent, the digest matching result is usually the digest. When matching the type, it can be understood that the third file and the benchmark file are the same; when the digest matching result indicates that the two digest values are different, usually when the digest matching result is the digest mismatch type, it can be understood that the code is usually performed on the benchmark file. The third file obtained by modification or code adjustment. In this case, the electronic device determines a modification class for the target application package based on the name of the third file, and adds the modification class to the incremental class set.

进一步的,若所述摘要匹配结果的结果类型为摘要不匹配类型,则将所述第三文件的第三文件名称(第三文件名称可表征第三文件对应的类)加入至所述增量类集合。Further, if the result type of the digest matching result is the digest mismatch type, the third file name of the third file (the third file name can represent the class corresponding to the third file) is added to the increment. class collection.

在一个或多个实施例中,在目标应用文件涉及的应用开发过程中,若对历史版本发布过的应用安装包中的文件进行修改,文件修改前后文件对应的函数类不发生改变。但是由于实质函数类所封装的数据发生改变,电子设备可以将第二文件对应的类作为一种增量函数类加入至增量类集合中。In one or more embodiments, during the application development process involved in the target application file, if the files in the application installation package released by the historical version are modified, the function classes corresponding to the files before and after the file modification are not changed. However, since the data encapsulated by the substantial function class changes, the electronic device may add the class corresponding to the second file as an incremental function class to the incremental class set.

可以理解的,“获取所述第三文件与所述基准文件的摘要匹配结果”涉及过程可以是:通过相关摘要算法对“第三文件与所述基准文件”计算得到两个摘要值,然后比对摘要值,得到摘要匹配结果。其中,相关摘要算法可以是MD5算法、“SHA算法”、“MAC”算法等等。It can be understood that the process involved in "obtaining the digest matching result between the third file and the reference file" may be: obtain two digest values by calculating the "third file and the reference file" through a relevant digest algorithm, and then compare them. For digest values, get digest matching results. The relevant digest algorithm may be the MD5 algorithm, the "SHA algorithm", the "MAC" algorithm, and so on.

S205:基于差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。S205: Perform static taint detection on the target application package based on the difference class set to obtain a taint path set for the target application package.

可以理解的,所述差异类集合可以是增量类集合和/或删减类集合。It can be understood that the difference class set may be an incremental class set and/or a pruned class set.

具体可参见本申请涉及的其他实施例涉及的方法步骤,此处不再赘述。For details, reference may be made to the method steps involved in other embodiments involved in this application, which will not be repeated here.

在本申请实施例中,电子设备获取针对应用的目标应用包以及应用基准包,然后对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,就可以基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,通过基于应用基准包所确定的差异类集合可以避免对目标应用包的全量检测分析,电子设备可以仅需基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,降低了应用检测处理量避免冗余重复,可大幅提高应用检测的效率;以及,基于反编译文件可确定增量类集和删减类集,并以此为依据筛选出进行静态污点分析的增量代码成分,提升了应用检测的智能性。In the embodiment of the present application, the electronic device obtains a target application package and an application benchmark package for an application, and then decompiles and compares the target application package and the application benchmark package to obtain the difference for the target application package. class set, static taint detection can be performed on the target application package based on the difference class set, and a taint path set for the target application package can be obtained. Full detection and analysis, the electronic device can only perform static taint detection on the difference code indicated by the target application package based on the difference class set, which reduces the application detection processing load, avoids redundant repetition, and can greatly improve the efficiency of application detection; and, based on The decompiled file can determine the incremental class set and the deleted class set, and filter out the incremental code components for static taint analysis based on this, which improves the intelligence of application detection.

请参见图5,图5是本申请提出的一种应用检测方法的另一种实施例的流程示意图。具体的:Please refer to FIG. 5 , which is a schematic flowchart of another embodiment of an application detection method proposed in the present application. specific:

S301:获取针对应用的目标应用包以及应用基准包;S301: Obtain a target application package and an application benchmark package for the application;

具体可参考本申请涉及的其他实施例的方法步骤,此处不再赘述。For details, reference may be made to the method steps of other embodiments involved in this application, which will not be repeated here.

S302:对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;S302: Decompile and compare the target application package and the application benchmark package to obtain a set of difference classes for the target application package;

S303:确定所述差异类集合对应的集合类。S303: Determine a set class corresponding to the difference class set.

根据一个或多个实施例中,所述集合类基于实际应用情况可以是删减类、可以是增量类、可以是删减类和增量类。According to one or more embodiments, the set class may be a pruning class, an incremental class, a pruning class and an incremental class based on the actual application situation.

可以理解的,电子设备可以基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合It can be understood that the electronic device can perform static taint detection on the target application package based on the set class, and obtain a set of taint paths for the target application package.

S304:若所述集合类为增量类,则调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合,将所述第一污点路径集合作为针对所述目标应用包的污点路径集合;S304: If the collection class is an incremental class, call a taint detection tool to perform static taint detection on the target application package based on the incremental class set, obtain a first taint path set, and use the first taint path set as the target application package. a collection of taint paths of the target application package;

可以理解的,电子设备通过对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,差异类集合一定程度上反馈目标应用包与应用基准包的代码差异,为了提高应用检测效率,本申请在对目标应包进行静态污点检测时,不采用知己对目标应用包所对应的全部代码进行检测的形式,而是确定目标应用包相对于基准应用包的差异类集合,由于基准应用包电子设备已经预先完成静态污点检测得到了污点路径集合,这样可仅基于差异类集合对目标应用包进行静态污点检测,在一些实施例中可以理解为静态污点检测可基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,这样可大幅节省针对目标应用包进行应用检测的效率。It can be understood that the electronic device obtains the difference class set for the target application package by decompiling and comparing the target application package and the application benchmark package, and the difference class set feeds back the target application package and the application to a certain extent. The code difference of the benchmark package, in order to improve the efficiency of application detection, when the application performs static taint detection on the target application package, it does not use the form of detecting all the codes corresponding to the target application package by the confidant, but determines that the target application package is relative to the target application package. The difference class set of the benchmark application package. Since the electronic device of the benchmark application package has completed the static taint detection in advance to obtain the taint path set, the static taint detection can be performed on the target application package only based on the difference class set. In some embodiments, it can be understood as In the static taint detection, static taint detection can be performed on the difference code indicated by the target application package based on the difference class set, which can greatly save the efficiency of application detection for the target application package.

可以理解的,所述增量类集合用于辅助电子设备确定目标应用包相当于应用基准包的增量代码,进而对增量代码进行污点检测,以减少对整个目标应用包进行污点检测时的计算处理量、提高检测效率。It can be understood that the incremental class set is used to assist the electronic device to determine that the target application package is equivalent to the incremental code of the application reference package, and then perform taint detection on the incremental code, so as to reduce the taint detection of the entire target application package. Calculate throughput and improve detection efficiency.

在一种可行的实施方式中,In a possible implementation,

1、电子设备可以基于所述增量类集合来确定针对所述目标应用包的检测入口函数集合;1. The electronic device may determine, based on the incremental class set, a set of detection entry functions for the target application package;

1.1获取所述目标应用包的过程间调用图,基于所述过程间调用图确定初始入口函数集合;1.1 Obtain the inter-procedure call graph of the target application package, and determine the initial entry function set based on the inter-procedure call graph;

可以理解的:电子设备可以调用污点检测工具,例如调用开源的代码分析框架soot工具中生成控制流图的方法,调用污点检测工具将目标应用包的二进制代码解析为中间代码并生成CFG。调用污点检测工具中生成过程间调用方法,例如FlowDroid框架中的生成双向ICFG 的方法,分析目标应用包的函数调用关系并生成过程间调用图ICFG,记录ICFG中的系统组件生命周期函数及回调函数到集合E中,该集合E也即初始入口函数集合。Understandable: The electronic device can call the taint detection tool, for example, call the method of generating a control flow graph in the open source code analysis framework soot tool, and call the taint detection tool to parse the binary code of the target application package into intermediate code and generate CFG. Call the method of generating inter-process calls in the taint detection tool, such as the method of generating bidirectional ICFG in the FlowDroid framework, analyze the function call relationship of the target application package and generate the inter-process call graph ICFG, and record the system component life cycle functions and callback functions in ICFG into the set E, which is also the initial entry function set.

在一种具体的实施场景中,电子设备在生成过程间调用图之前(也即开始分析直接),通过设置污染源函数source和陷入函数sink,具体实施中:通常将暴露在外部的函数设置为 source函数,将程序内部执行关键逻辑的函数设置为sink函数,如果经过分析能得到从污染源函数source到陷入函数sink的有可达路径,则表示存在一条潜在的安全漏洞,此时可得到一条污点路径;In a specific implementation scenario, the electronic device sets the pollution source function source and sink function before generating the inter-process call graph (that is, starting to analyze directly), in specific implementation: usually, the externally exposed function is set as source function, set the function that executes the key logic inside the program as the sink function. If the reachable path from the pollution source function source to the sink function can be obtained after analysis, it means that there is a potential security vulnerability, and a tainted path can be obtained at this time. ;

可以理解的,在对目标应用包进行分析时,通过目标应用包指示的绝对路径查找被分析对象所在位置,并通过java开源分析框架soot实现对于字节码程序的逆向拆解,即使用开源分析框架soot生成语法简洁的中间语言的表示形式,使目标应用包的所有源程序的字节码变量对应到中间语言表示的新数据结构中,从而完整的表达程序的控制流信息和数据传递信息。It can be understood that when analyzing the target application package, the location of the object to be analyzed is searched through the absolute path indicated by the target application package, and the reverse disassembly of the bytecode program is realized through the java open source analysis framework soot, that is, the open source analysis is used. The framework soot generates an intermediate language representation with concise syntax, so that the bytecode variables of all source programs of the target application package correspond to the new data structure represented by the intermediate language, so as to completely express the control flow information and data transfer information of the program.

进一步的,电子设备调用污点检测工具将目标应用包的二进制代码解析为中间代码,从而以中间代码对应的中间语言表示形式进行转化得到函数内控制流图(CFG),转化过程是将目标应用包的二进制代码指示每条语句对应成一个控制流图节点Bi,并根据执行顺序在每条语句上保存其前驱节点Bp和后继节点Bs;进一步的来生成调用图CG:由于绝大部分应用(目标应用包对应的应用)的执行会涉及函数调用,当函数之间存在调用关系时,电子设备可以进行函数调用关系的模拟,电子设备通常可以解析代码中的函数调用语句,将调用函数和被调用的函数进行映射,并将映射关系用“HashMap的数据结构”保存在调用语句节点中,从而就生成相应的调用图CG;Further, the electronic device calls the taint detection tool to parse the binary code of the target application package into intermediate code, so as to convert the intermediate language representation corresponding to the intermediate code to obtain a control flow graph (CFG) within the function. The conversion process is to convert the target application package. The binary code indicates that each statement corresponds to a control flow graph node Bi, and saves its predecessor node Bp and successor node Bs on each statement according to the execution order; further to generate a call graph CG: Since most applications (target The execution of the application corresponding to the application package) will involve function calls. When there is a calling relationship between functions, the electronic device can simulate the function calling relationship. The function is mapped, and the mapping relationship is saved in the call statement node with "HashMap data structure", so as to generate the corresponding call graph CG;

进一步的,电子设备可以将调用图CG和函数内控制流图CFG复合生成一个新的图类,该图类称为过程间控制流图ICFG,该图类用于描述整个被分析程序的;然后记录过程间控制流图ICFG中的系统组件生命周期函数及回调函数,将系统组件生命周期函数及回调函数加入至一个参考集合(如设置一个空集合E,加入至集合E中),完成上述过程中之后,得到的该参考集合也即初始入口函数集合。Further, the electronic device can combine the call graph CG and the intra-function control flow graph CFG to generate a new graph class, the graph class is called the inter-procedural control flow graph ICFG, and the graph class is used to describe the entire analyzed program; then Record the system component life cycle functions and callback functions in the inter-process control flow graph ICFG, add the system component life cycle functions and callback functions to a reference set (for example, set an empty set E and add it to the set E), and complete the above process After , the obtained reference set is also the initial entry function set.

在一些应用场景中,该初始入口函数集合作为过程间控制流图ICFG的总入口点,后续静态污点检测相当于是对目标应用包对应的所有代码进行静态污点分析,为了提升检测效率,电子设备可以基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数,从而生成包含所述至少一个目标节点函数的检测入口函数集合。最终得到检测入口函数集合相当于用于指示电子设备仅调用污点检测工具对增量代码进行污点检测。In some application scenarios, the initial entry function set is used as the total entry point of the inter-procedure control flow graph ICFG, and subsequent static taint detection is equivalent to static taint analysis of all codes corresponding to the target application package. In order to improve the detection efficiency, electronic devices can Perform function node traversal processing on the inter-procedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function, thereby generating a detection entry function set including the at least one target node function . Finally, the set of detection entry functions is obtained, which is equivalent to instructing the electronic device to only call the taint detection tool to perform taint detection on the incremental code.

1.2、电子设备基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数;1.2. The electronic device performs function node traversal processing on the inter-procedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function;

具体实施中:电子设备以所述初始入口函数集合指示的至少一个初始入口函数为基准,基于增量类集合对所述过程间控制流图中各初始函数节点对应的每个下一函数节点进行节点类匹配处理,得到至少一个目标函数节点对应的目标节点函数;In the specific implementation, the electronic device uses the at least one initial entry function indicated by the initial entry function set as a benchmark, and performs each next function node corresponding to each initial function node in the inter-process control flow graph based on the incremental class set. Node class matching processing to obtain the target node function corresponding to at least one target function node;

其中,所述初始函数节点为所述初始入口函数在所述过程间控制流图中对应的首节点,所述目标函数节点对应的目标入口函数所属的目标函数类为所述增量类集合中的函数类。The initial function node is the first node corresponding to the initial entry function in the inter-process control flow graph, and the objective function class to which the objective entry function corresponding to the objective function node belongs is in the incremental class set function class.

可以理解的,假设初始入口函数集合为集合E,相当于电子设备从集合E的各初始入口函数Entry依次出发遍历“过程间调用图ICFG”,对于每次读取到的“初始入口函数Entry”下一个节点函数(如:NextMethod函数),判断下一个节点函数的类(NextMethod函数的类)是否位增量类集合中,若是,则将该“下一个节点函数”作为目标结点函数添加到增量函数集合中,(例如,预先定义一个增量函数集合IncreEntrance,当“下一个节点函数”对应的类属于增量类集合,则将其“下一个节点函数”作为目标结点函数添加到IncreEntrance中),当完成整个过程间调用图ICFG的遍历之后,即可得到包含至少一个目标节点函数的检测入口函数集合。It can be understood that, assuming that the initial entry function set is set E, it is equivalent to that the electronic device traverses the "inter-procedure call graph ICFG" sequentially from each initial entry function Entry of set E, and for each read "initial entry function Entry" The next node function (such as: NextMethod function), judge whether the class of the next node function (the class of the NextMethod function) is in the incremental class set, if so, add the "next node function" as the target node function to the In the incremental function set, (for example, an incremental function set IncreEntrance is pre-defined, when the class corresponding to the "next node function" belongs to the incremental class set, its "next node function" is added as the target node function. IncreEntrance), when the traversal of the entire inter-process call graph ICFG is completed, a detection entry function set containing at least one target node function can be obtained.

如图6所示,图6是本申请涉及的一种检测入口函数集合确定的场景示意图,假设初始入口函数集合为集合E,电子设备依次遍历集合E中的(初始)入口函数Entry,在每一轮遍历入口函数Entry之前,判断是否遍历完集合E中的每个(初始)入口函数Entry(也即图6中“遍历已结束”对应的步骤),若否,则基于当前的“(初始)入口函数Entry”遍历“过程间调用图ICFG”,对于每次读取到的“初始入口函数Entry”下一个节点函数(如:NextMethod 函数),判断下一个节点函数的类(NextMethod函数的类)是否位于增量类集合中(也即图6中示出的:增量类集合是否存在NextMethod函数的类),若是,则将该“下一个节点函数”作为目标结点函数添加到增量函数集合中,(例如,预先定义一个增量函数集合IncreEntrance,当“下一个节点函数”对应的类属于增量类集合,则将其“下一个节点函数”作为目标结点函数添加到如图6示出的IncreEntrance中),当完成最后一个初始入口函数Entry针对整个过程间调用图ICFG的遍历之后,即可得到包含至少一个目标节点函数的检测入口函数集合IncreEntrance。As shown in FIG. 6 , FIG. 6 is a schematic diagram of a scenario in which the set of detection entry functions involved in the present application is determined. Assuming that the set of initial entry functions is set E, the electronic device traverses the (initial) entry functions Entry in set E in sequence, and at each Before a round of traversal of the entry function Entry, determine whether each (initial) entry function Entry in the set E has been traversed (that is, the step corresponding to "traversal has ended" in Figure 6), if not, based on the current "(initial) ) Entry function Entry" traverses the "Inter-procedure call graph ICFG", and for each read "initial entry function Entry" next node function (eg: NextMethod function), determine the class of the next node function (the class of the NextMethod function) ) is located in the incremental class set (that is, as shown in Figure 6: whether the incremental class set has a class with the NextMethod function), if so, add the "next node function" as the target node function to the incremental class set In the function set, (for example, an incremental function set IncreEntrance is pre-defined, when the class corresponding to the "next node function" belongs to the incremental class set, its "next node function" is added as the target node function as shown in the figure. 6), when the last initial entry function Entry traverses the entire inter-process call graph ICFG, the detection entry function set IncreEntrance containing at least one target node function can be obtained.

可以理解的,understandably,

1.3电子设备生成包含所述至少一个目标节点函数的检测入口函数集合。1.3 The electronic device generates a detection entry function set including the at least one target node function.

在一些实施方式中,在得到检测入口函数集合之后,电子设备完成使用污点检测工具进行控制流分析过程。In some embodiments, after obtaining the detection entry function set, the electronic device completes the control flow analysis process using the taint detection tool.

2、电子设备然后基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合。2. The electronic device then invokes a taint detection tool based on the set of detection entry functions to perform static taint detection on the target application package to obtain a first set of taint paths.

可以理解的,电子设备可以调用诸如FlowDroid框架等污点检测工具中的污点分析方法进行数据流分析从而执行静态污点检测过程。It can be understood that the electronic device can call a taint analysis method in a taint detection tool such as the FlowDroid framework to perform data flow analysis to perform a static taint detection process.

可以理解的,电子设备可以获取所述目标应用包对应的过程间调用图ICFG,然后基于所述检测入口函数集合对所述过程间调用图进行静态污点检测,得到针对所述目标应用包的第一污点路径集合。It can be understood that the electronic device can obtain the inter-procedure call graph ICFG corresponding to the target application package, and then perform static taint detection on the inter-procedure call graph based on the detection entry function set, and obtain the No. A collection of tainted paths.

可以理解的,电子设备遍历检测入口函数集合(如集合IncreEntrance)中的所有检测入口函数,对于每个检测入口函数NewEntry,提取其在ICFG中的下一个节点,判断该节点是否属于污染源函数source。若是,则调用污点检测工具中的污点分析算法通过对系统中敏感数据进行标记,继而跟踪标记数据在程序中的传播路径,基于污点检测工具检测系统的保密性和完整性等安全问题,同时将该节点的函数变量设为污点变量,并进行污点分析。若该节点属于污点函数sink,并且使用了污点变量,则该污点变量的传递路径是一条完整的污点路径。并且将该污点路径添加到污点路径集合中,以此类推,遍历完过程间控制流图ICFG后,结束数据流分析以完成静态污点检测之后,就可以得到第一污点路径集合。It can be understood that the electronic device traverses all the detection entry functions in the detection entry function set (such as the set IncreEntrance), and for each detection entry function NewEntry, extracts its next node in the ICFG, and determines whether the node belongs to the pollution source function source. If so, call the taint analysis algorithm in the taint detection tool to mark the sensitive data in the system, and then track the propagation path of the marked data in the program, based on the taint detection tool to detect security issues such as confidentiality and integrity of the system, and at the same time The function variable of this node is set as a taint variable, and taint analysis is performed. If the node belongs to the taint function sink and a taint variable is used, the transmission path of the taint variable is a complete taint path. The taint path is added to the taint path set, and so on. After traversing the inter-process control flow graph ICFG, the data flow analysis is completed to complete the static taint detection, and the first taint path set can be obtained.

可以理解的,第一污点路径集合为电子设备当前通过调用污点检测工具进行污点检测分析,生成的第一污点路径集合。第一污点路径集合反馈的是基于增量类集合所生成的检测入口函数针对性对目标应用包中增量代码成分进行污点检测分析,而得到的增量代码成分中相关的污点路径。可以理解的在一个或多个实施例中,实际调用污点检测工具进行污点检测的检测对象并非整个目标应用包而是目标应用包中的增量代码成分,从而生成第一污点路径集合。It can be understood that the first taint path set is the first taint path set generated by the electronic device currently by invoking a taint detection tool to perform taint detection and analysis. The first taint path set feeds back the relevant taint paths in the incremental code components obtained by performing taint detection and analysis on the incremental code components in the target application package based on the detection entry function generated based on the incremental class set. It can be understood that in one or more embodiments, the detection object actually calling the taint detection tool to perform taint detection is not the entire target application package but the incremental code components in the target application package, thereby generating the first taint path set.

S305:若所述集合类为删减类,则获取所述应用基准包对应的第二污点路径集合,基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合;S305: If the collection class is a pruning class, obtain a second taint path set corresponding to the application benchmark package, and determine all taint paths for the target application package based on the second taint path set and the pruning class set. Describe the taint path collection;

可以理解的,若差异类集合的集合类均属于删减类,则差异类集合即为删减类集合,此时,目标应用包相对于应用基准包而言,通常应用安装包不含增量代码成分。考虑到在目标应用包之前安装包版本的应用基准包已完成污点检测,可以理解为,在应用基准包发布前,电子设备已经完成了对应用基准包的静态污点检测生成了第二污点路径集合,第二污点路径集合可以理解为对应用基准包经静态污点检测处理后所对应的污点路径集合。可以理解的,电子设备可以不用对目标应用包再次调用污点检测工具进行污点检测,而是基于应用基准包对应的第二污点路径集合并结合删减类集合来得到针对目标应用包的污点路径集合。It is understandable that if the collection classes of the difference class set belong to the pruned class, the difference class set is the pruned class set. At this time, the target application package is relative to the application base package, and usually the application installation package does not contain increments. code components. Considering that the application benchmark package of the package version installed before the target application package has completed taint detection, it can be understood that before the application benchmark package is released, the electronic device has completed the static taint detection of the application benchmark package and generated a second taint path set. , the second taint path set can be understood as the taint path set corresponding to the static taint detection processing of the application reference package. It can be understood that the electronic device can obtain the taint path set for the target application package based on the second taint path set corresponding to the application benchmark package and combining with the deletion class set without calling the taint detection tool again on the target application package to perform taint detection. .

在一种具体的实施场景中,电子设备可以基于所述第二污点路径集合以及删减类集合,从第二污点路径集合中确定针对所述目标应用包的所述污点路径集合;In a specific implementation scenario, the electronic device may determine the taint path set for the target application package from the second taint path set based on the second taint path set and the pruning class set;

可以理解的,删减类集合中包含至少一个删减类,在获取应用基准包对应的第二污点路径集合,可以遍历第二污点路径集合中的每条污点路径,可以理解的污点路径通常可映射诸如污点变量、节点对应的污点函数、污点函数所对应的类,基于此,电子设备可以确定每条污点路径对应的污点函数类,例如基于污点路径记载的污点函数或污点变量的名称来确定污点函数类,电子设备仅需对删减类与每条污点路径对应的污点函数类进行匹配即可,当两者相匹配时,例如两者一致,电子设备可以确定与删减类所匹配的污点函数类指示的参考污点路径,依次类推,完成对删减类集合中所有删减类的匹配,来从所述第二污点路径集合中确定至少一个参考污点路径;也即执行“基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径”步骤;电子设备在确定至少一个参考污点路径之后,通常这些参考污点路径在目标应用包中不会存在,基于此,电子设备仅将所述第二污点路径集合中的所述至少一个参考污点路径进行删除处理,就可以得到针对所述目标应用包的污点路径集合。It is understandable that the deletion class set contains at least one deletion class. After obtaining the second taint path set corresponding to the application benchmark package, each taint path in the second taint path set can be traversed. The understandable taint path can usually be Map such as taint variables, taint functions corresponding to nodes, and classes corresponding to taint functions. Based on this, the electronic device can determine the taint function class corresponding to each taint path, for example, based on the name of the taint function or taint variable recorded in the taint path. The taint function class, the electronic device only needs to match the deletion class with the taint function class corresponding to each taint path. When the two match, for example, the two are consistent, the electronic device can determine the matching with the deletion class. The reference taint path indicated by the taint function class, and so on, completes the matching of all the pruned classes in the pruned class set to determine at least one reference taint path from the second taint path set; The pruning class set determines at least one reference taint path from the second taint path set" step; after the electronic device determines at least one reference taint path, usually these reference taint paths do not exist in the target application package. Based on this, The electronic device can obtain a taint path set for the target application package by simply deleting the at least one reference taint path in the second taint path set.

S306:若所述集合类为增量类和删减类,则基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合。S306: If the collection class is an incremental class and a pruned class, determine, based on the first taint path set, the second taint path set, and the pruned class set, all of the target application packages. The set of taint paths described.

可以理解的,若所述集合类为增量类和删减类,也就是说,差异类集合包括增量类集合和删减类集合,所述增量类集合用于辅助电子设备确定目标应用包相当于应用基准包的增量代码,进而对增量代码进行污点检测,以减少对整个目标应用包进行污点检测时的计算处理量、提高检测效率。电子设备可以通过对第一污点路径集合和第二污点路径集合进行污点路径拟合,去除删减类集合在第二污点路径集合中的相关污点路径,可得到针对目标应用包的污点路径集合。从而起到提高检测效率,节省污点检测工作量的效果。It can be understood that if the set class is an incremental class and a subtracted class, that is, the difference class set includes an incremental class set and a subtracted class set, and the incremental class set is used to assist the electronic device in determining the target application. The package is equivalent to the incremental code of the application benchmark package, and then the taint detection is performed on the incremental code, so as to reduce the computational processing amount and improve the detection efficiency when performing taint detection on the entire target application package. The electronic device can obtain a taint path set for the target application package by performing taint path fitting on the first taint path set and the second taint path set, and removing the relevant taint paths in the second taint path set in the pruning class set. Thereby, the detection efficiency is improved and the workload of stain detection is saved.

在一种具体的实施场景中,电子设备可以执行“基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径”步骤(具体可参考S305),然后获取所述第二污点路径集合中的至少一个目标污点路径,所处目标污点路径为所述第二污点路径集合中除所述参考污点路径之外的污点路径,可以理解为从第二污点路径集合中获取到除参考污点路径之外的目标污点路径,然后将所述至少一个目标污点路径加入至所述第一污点路径集合中,就可以得到针对所述目标应用包的污点路径集合。第一污点路径集合的获取方式可参考其他方法步骤,此处不再赘述。In a specific implementation scenario, the electronic device may perform the step of "determining at least one reference taint path from the second taint path set based on the pruned class set" (for details, refer to S305), and then obtain the first reference taint path. At least one target taint path in the second taint path set, where the target taint path is a taint path other than the reference taint path in the second taint path set, can be understood as being obtained from the second taint path set A target taint path other than the reference taint path, and then adding the at least one target taint path to the first taint path set, a taint path set for the target application package can be obtained. For the acquisition method of the first taint path set, reference may be made to other method steps, which will not be repeated here.

在本申请实施例中,电子设备获取针对应用的目标应用包以及应用基准包,然后对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,就可以基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,通过基于应用基准包所确定的差异类集合可以避免对目标应用包的全量检测分析,电子设备可以仅需基于差异类集合对目标应用包指示的差异代码进行静态污点检测即可,降低了应用检测处理量避免冗余重复,可大幅提高应用检测的效率;以及,基于反编译文件可确定增量类集和删减类集,并以此为依据筛选出进行静态污点分析的增量代码成分,提升了应用检测的智能性;以及,基于不同差异类集合的类型可实现采用不同方式来进行污点检测,提升了历史生成的应用基准包对应污点分析结果的利用效率,优化了静态污点检测的流程。In the embodiment of the present application, the electronic device obtains a target application package and an application benchmark package for an application, and then decompiles and compares the target application package and the application benchmark package to obtain the difference for the target application package. class set, static taint detection can be performed on the target application package based on the difference class set, and a taint path set for the target application package can be obtained. Full detection and analysis, the electronic device can only perform static taint detection on the difference code indicated by the target application package based on the difference class set, which reduces the application detection processing load, avoids redundant repetition, and can greatly improve the efficiency of application detection; and, based on The decompiled file can determine the incremental class set and the deleted class set, and based on this, the incremental code components for static taint analysis can be screened out, which improves the intelligence of application detection; Implementing taint detection in different ways improves the utilization efficiency of taint analysis results corresponding to historically generated application benchmark packages, and optimizes the process of static taint detection.

请参见图7,为本申请实施例提供的一种应用检测系统的架构示意图。如图4所示,所述应用检测系统100包括电子设备20和目标设备集群,所述标设备集群可以包括多个目标设备,如图7所示,具体包括目标设备1、目标设备2、…、目标设备n,n为大于0的整数;本实施例以图7中的电子设备20及目标设备1为例进行描述。Please refer to FIG. 7 , which is a schematic structural diagram of an application detection system provided by an embodiment of the present application. As shown in FIG. 4 , the application detection system 100 includes an electronic device 20 and a target device cluster, and the target device cluster may include multiple target devices, as shown in FIG. 7 , specifically including a target device 1, a target device 2, . . . , the target device n, where n is an integer greater than 0; this embodiment is described by taking the electronic device 20 and the target device 1 in FIG. 7 as an example.

所述电子设备20具有应用检测功能,在电子设备20为服务器是,电子设备20可以是单独的服务器设备,例如:机架式、刀片、塔式、或者机柜式的服务器设备,或采用工作站、大型计算机等具备较强计算能力硬件设备;也可以是采用多个服务器组成的服务器集群,所述服务集群中的各服务器可以是以对称方式组成的,其中每台服务器在业务链路中功能等价、地位等价,各服务器均可单独对外提供服务,所述单独提供服务可以理解为无需另外的服务器的辅助。The electronic device 20 has an application detection function. When the electronic device 20 is a server, the electronic device 20 may be a separate server device, such as a rack-type, blade, tower, or cabinet-type server device, or a workstation, A large computer or other hardware device with strong computing power; it can also be a server cluster composed of multiple servers, and each server in the service cluster can be composed in a symmetrical manner, in which each server has functions in the business link, etc. The price and status are equivalent, and each server can independently provide services to the outside world, which can be understood as not requiring the assistance of another server.

目标设备集群中各目标设备可以是具有通信功能的设备,目标设备可以是用于开发诸如目标应用包、应用基准包等应用安装包的设备,该目标设备包括但不限于:手持设备、个人电脑、平板电脑、车载设备、智能手机、计算设备或连接到无线调制解调器的其它处理设备等。Each target device in the target device cluster may be a device with a communication function, and the target device may be a device used to develop application installation packages such as target application packages, application benchmark packages, etc. The target devices include but are not limited to: handheld devices, personal computers , tablet computer, in-vehicle device, smartphone, computing device, or other processing device connected to a wireless modem, etc.

所述目标设备1通过网络与电子设备20进行通信,网络可以是无线网络,也可以是有线网络,无线网络包括但不限于蜂窝网络、无线局域网、红外网络或蓝牙网络,有线网络包括但不限于以太网、通用串行总线(universal serial bus,USB)或控制器局域网络。The target device 1 communicates with the electronic device 20 through a network. The network can be a wireless network or a wired network. The wireless network includes but is not limited to a cellular network, a wireless local area network, an infrared network or a Bluetooth network. The wired network includes but is not limited to Ethernet, Universal Serial Bus (USB) or Controller Area Network.

目标设备1至少可以基于与电子设备之间的通信网络上传待检测应用的目标应用包。可以理解的,电子设备20获取到针对应用的目标应用包,电子设备可以获取针对应用的应用基准包;The target device 1 can at least upload the target application package of the application to be detected based on the communication network with the electronic device. It can be understood that the electronic device 20 obtains the target application package for the application, and the electronic device can obtain the application reference package for the application;

电子设备20对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;The electronic device 20 decompiles and compares the target application package and the application benchmark package to obtain a difference class set for the target application package;

电子设备20基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。The electronic device 20 performs static taint detection on the target application package based on the difference class set, and obtains a taint path set for the target application package.

另外,上述实施例提供的文件提测系统实施例与一些实施例中的所述文件提测方法属于同一构思,其体现实现过程详见方法实施例,这里不再赘述。In addition, the embodiment of the file detection system provided by the above embodiments and the file detection method in some embodiments belong to the same concept, and the implementation process of the embodiment is detailed in the method embodiment, which will not be repeated here.

下面将结合图8,对本申请实施例提供的应用检测装置进行详细介绍。需要说明的是,图8所示的应用检测装置,用于执行本申请图1~图7所示实施例的方法,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请图1~图7所示的实施例。The application detection apparatus provided by the embodiment of the present application will be described in detail below with reference to FIG. 8 . It should be noted that the application detection device shown in FIG. 8 is used to execute the methods of the embodiments shown in FIG. 1 to FIG. 7 of the present application. For convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technology For details not disclosed, please refer to the embodiments shown in FIGS. 1 to 7 of the present application.

请参见图8,其示出本申请实施例的应用检测装置的结构示意图。该应用检测装置1可以通过软件、硬件或者两者的结合实现成为用户终端的全部或一部分。根据一些实施例,该应用检测装置1包括获取模块11、处理模块12和检测模块13,具体用于:Please refer to FIG. 8 , which shows a schematic structural diagram of an application detection apparatus according to an embodiment of the present application. The application detection apparatus 1 can be implemented as all or a part of the user terminal through software, hardware or a combination of the two. According to some embodiments, the application detection apparatus 1 includes an acquisition module 11, a processing module 12 and a detection module 13, and is specifically used for:

获取模块11,用于获取应用的目标应用包以及应用基准包;an acquisition module 11, used to acquire the target application package and the application benchmark package of the application;

处理模块12,用于对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;a processing module 12, configured to perform decompilation and comparison processing on the target application package and the application benchmark package to obtain a set of difference classes for the target application package;

检测模块13,用于基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合The detection module 13 is configured to perform static taint detection on the target application package based on the difference class set, and obtain a taint path set for the target application package

可选的,如图9所示,所述处理模块12包括:Optionally, as shown in FIG. 9 , the processing module 12 includes:

文件确定单元121,用于确定所述应用基准包对应的第一反编译文件,确定所述目标应用包对应的第二反编译文件;A file determination unit 121, configured to determine a first decompiled file corresponding to the application benchmark package, and determine a second decompiled file corresponding to the target application package;

集合确定单元122,用于将所述第一反编译文件以及所述第二反编译文件进行比对处理,得到针对所述目标应用包的差异类集合。The set determining unit 122 is configured to perform a comparison process on the first decompiled file and the second decompiled file to obtain a difference class set for the target application package.

可选的,所述集合确定单元122,具体用于:Optionally, the set determining unit 122 is specifically configured to:

以所述第一反编译文件所包含的至少一个基准文件为参考,在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合;和/或With reference to at least one benchmark file included in the first decompiled file, a first file that does not match each of the benchmark files is determined in the second decompiled file, and based on the first file, the target file is determined. an incremental class set of the target application package; and/or

以所述第二反编译文件所包含的至少一个目标文件为参考,在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合。Taking at least one object file included in the second decompiled file as a reference, determine in the first decompiled file a second file that does not match each of the object files and a second file that does not match at least one of the object files. For the matched third file, a deletion class set and an incremental class set for the target application package are determined based on the second file and the third file.

可选的,所述集合确定单元122,具体用于:Optionally, the set determining unit 122 is specifically configured to:

在所述第二反编译文件中确定与每个所述基准文件的基准文件名称不匹配的第一文件名称,基于所述第一文件名称确定针对所述目标应用包的增量类集合;determining a first file name that does not match the reference file name of each of the reference files in the second decompiled file, and determining an incremental class set for the target application package based on the first file name;

可选的,所述集合确定单元122,具体用于:Optionally, the set determining unit 122 is specifically configured to:

在所述第一反编译文件中确定与每个所述目标文件的目标文件名称不匹配的第二文件名称以及与至少一个所述目标文件名称相匹配的第三文件名称,基于所述第二文件名称以及所述第三文件名称确定针对所述目标应用包的删减类集合和增量类集合。A second file name that does not match the object file name of each of the object files and a third file name that matches at least one of the object file names are determined in the first decompiled file, based on the second file name The file name and the third file name determine a set of pruned classes and a set of incremental classes for the target application package.

可选的,所述集合确定单元122,具体用于:Optionally, the set determining unit 122 is specifically configured to:

将所述第二文件的第二文件名称加入至针对所述目标应用包的删减类集合;以及,adding the second file name of the second file to the set of abridged classes for the target application package; and,

获取所述第三文件与参考目标文件的摘要匹配结果,基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述增量类集合,所述第三文件的文件名称与所述参考目标文件的文件名称相同。Obtain the digest matching result between the third file and the reference target file, and add the third file name of the third file to the incremental class set based on the digest matching result, where the file name of the third file is the same as The file names of the reference object files are the same.

可选的,所述集合确定单元122,具体用于:Optionally, the set determining unit 122 is specifically configured to:

若所述摘要匹配结果的结果类型为摘要不匹配类型,则将所述第三文件的第三文件名称加入至所述增量类集合。If the result type of the digest matching result is a digest mismatch type, adding the third file name of the third file to the incremental class set.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

确定所述差异类集合对应的集合类,基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。A collection class corresponding to the set of difference classes is determined, and static taint detection is performed on the target application package based on the collection class to obtain a taint path set for the target application package.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

若所述集合类为增量类,则调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合,将所述第一污点路径集合作为针对所述目标应用包的污点路径集合;If the collection class is an incremental class, call the taint detection tool to perform static taint detection on the target application package based on the incremental class set, obtain a first taint path set, and use the first taint path set as the target application package for the A collection of taint paths of the target application package;

若所述集合类为删减类,则获取所述应用基准包对应的第二污点路径集合,基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合;If the collection class is a pruning class, obtain a second taint path set corresponding to the application reference package, and determine the taint for the target application package based on the second taint path set and the pruning class set path collection;

若所述集合类为增量类和删减类,则基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合。If the set class is an incremental class and a pruned class, determining the taint for the target application package based on the first taint path set, the second taint path set, and the pruned class set Path collection.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes;

获取所述第二污点路径集合中的至少一个目标污点路径,所处目标污点路径为所述第二污点路径集合中除所述参考污点路径之外的污点路径;acquiring at least one target taint path in the second taint path set, where the target taint path is a taint path other than the reference taint path in the second taint path set;

将所述至少一个目标污点路径加入至所述第一污点路径集合中,得到针对所述目标应用包的污点路径集合。The at least one target taint path is added to the first taint path set to obtain a taint path set for the target application package.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes;

将所述第二污点路径集合中的所述至少一个参考污点路径进行删除处理,得到针对所述目标应用包的污点路径集合。The at least one reference taint path in the second taint path set is deleted to obtain a taint path set for the target application package.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

基于所述增量类集合确定针对所述目标应用包的检测入口函数集合;Determine, based on the incremental class set, a set of detection entry functions for the target application package;

基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合。Based on the set of detection entry functions, a taint detection tool is called to perform static taint detection on the target application package, and a first set of taint paths is obtained.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

获取所述目标应用包的过程间调用图,基于所述过程间调用图确定初始入口函数集合;Obtain an inter-procedure call graph of the target application package, and determine an initial entry function set based on the inter-procedure call graph;

基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数;Perform function node traversal processing on the inter-procedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function;

生成包含所述至少一个目标节点函数的检测入口函数集合。A detection entry function set including the at least one target node function is generated.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

以所述初始入口函数集合指示的至少一个初始入口函数为基准,基于增量类集合对所述过程间控制流图中各初始函数节点对应的每个下一函数节点进行节点类匹配处理,得到至少一个目标函数节点对应的目标节点函数;Taking at least one initial entry function indicated by the initial entry function set as a benchmark, performing node class matching processing on each next function node corresponding to each initial function node in the inter-process control flow graph based on the incremental class set, to obtain the target node function corresponding to at least one target function node;

其中,所述初始函数节点为所述初始入口函数在所述过程间控制流图中对应的首节点,所述目标函数节点对应的目标入口函数所属的目标函数类为所述增量类集合中的函数类。The initial function node is the first node corresponding to the initial entry function in the inter-process control flow graph, and the objective function class to which the objective entry function corresponding to the objective function node belongs is in the incremental class set function class.

可选的,所述检测模块13,具体用于:Optionally, the detection module 13 is specifically used for:

获取所述目标应用包对应的过程间调用图;obtaining an inter-procedure call graph corresponding to the target application package;

基于所述检测入口函数集合对所述过程间调用图进行静态污点检测,得到针对所述目标应用包的第一污点路径集合。Perform static taint detection on the inter-procedure call graph based on the detection entry function set to obtain a first taint path set for the target application package.

需要说明的是,上述实施例提供的应用检测装置在执行应用检测方法时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的应用检测装置与应用检测方法实施例属于同一构思,其体现实现过程详见方法实施例,这里不再赘述。It should be noted that, when the application detection apparatus provided in the above embodiment executes the application detection method, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions may be allocated to different functional modules as required. , that is, dividing the internal structure of the device into different functional modules to complete all or part of the functions described above. In addition, the application detection apparatus and the application detection method provided by the above embodiments belong to the same concept, and the implementation process of the application detection device is described in the method embodiment, which will not be repeated here.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

本申请实施例还提供了一种计算机存储介质,所述计算机存储介质可以存储有多条指令,所述指令适于由处理器加载并执行如上述图1~图6所示实施例的所述应用检测方法,具体执行过程可以参见图1~图6所示实施例的具体说明,在此不进行赘述。Embodiments of the present application further provide a computer storage medium, where the computer storage medium can store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the above-described embodiments shown in FIG. 1 to FIG. 6 . For the application detection method and the specific execution process, reference may be made to the specific descriptions of the embodiments shown in FIG. 1 to FIG. 6 , which will not be repeated here.

本申请还提供了一种计算机程序产品,该计算机程序产品存储有至少一条指令,所述至少一条指令由所述处理器加载并执行如上述图1~图6所示实施例的所述应用检测方法,具体执行过程可以参见图1~图6所示实施例的具体说明,在此不进行赘述。The present application also provides a computer program product, where the computer program product stores at least one instruction, and the at least one instruction is loaded by the processor to execute the application detection in the embodiments shown in FIG. 1 to FIG. 6 above. For the specific implementation process, reference may be made to the specific descriptions of the embodiments shown in FIG. 1 to FIG. 6 , which will not be repeated here.

请参考图10,其示出了本申请一个示例性实施例提供的电子设备的结构方框图。本申请中的电子设备可以包括一个或多个如下部件:处理器110、存储器120、输入装置130、输出装置140和总线150。处理器110、存储器120、输入装置130和输出装置140之间可以通过总线150连接。Please refer to FIG. 10 , which shows a structural block diagram of an electronic device provided by an exemplary embodiment of the present application. An electronic device in this application may include one or more of the following components: a processor 110 , a memory 120 , an input device 130 , an output device 140 and a bus 150 . The processor 110 , the memory 120 , the input device 130 and the output device 140 may be connected through a bus 150 .

处理器110可以包括一个或者多个处理核心。处理器110利用各种接口和线路连接整个电子设备内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(digital signal processing,DSP)、现场可编程门阵列(field-programmable gate array,FPGA)、可编程逻辑阵列(programmable logicArray,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(centralprocessing unit,CPU)、图像处理器(graphics processing unit,GPU)和调制解调器等中的一种或几种的组合。其中, CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts in the entire electronic device, and executes the electronic device by running or executing the instructions, programs, code sets or instruction sets stored in the memory 120, and calling the data stored in the memory 120. Various functions of the device 100 and processing data. Optionally, the processor 110 may employ at least one of digital signal processing (digital signal processing, DSP), field-programmable gate array (field-programmable gate array, FPGA), and programmable logic array (programmable logic array, PLA). implemented in hardware. The processor 110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used for rendering and drawing of the display content; the modem is used for handling wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 110, and is implemented by a communication chip alone.

存储器120可以包括随机存储器(random Access Memory,RAM),也可以包括只读存储器(read-only memory,ROM)。可选地,该存储器120包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等,该操作系统可以是安卓(Android)系统,包括基于Android系统深度开发的系统、苹果公司开发的IOS系统,包括基于IOS系统深度开发的系统或其它系统。存储数据区还可以存储电子设备在使用中所创建的数据比如电话本、音视频数据、聊天记录数据,等。The memory 120 may include random access memory (RAM), or may include read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. Memory 120 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, etc., the operating system can be an Android (Android) system, including a system based on the deep development of the Android system, an IOS system developed by Apple, including a system based on the deep development of the IOS system or other systems. The storage data area can also store data created by the electronic device in use, such as a phone book, audio and video data, chat record data, and the like.

参见图11所示,存储器120可分为操作系统空间和用户空间,操作系统即运行于操作系统空间,原生及第三方应用程序即运行于用户空间。为了保证不同第三方应用程序均能够达到较好的运行效果,操作系统针对不同第三方应用程序为其分配相应的系统资源。然而,同一第三方应用程序中不同应用场景对系统资源的需求也存在差异,比如,在本地资源加载场景下,第三方应用程序对磁盘读取速度的要求较高;在动画渲染场景下,第三方应用程序则对GPU性能的要求较高。而操作系统与第三方应用程序之间相互独立,操作系统往往不能及时感知第三方应用程序当前的应用场景,导致操作系统无法根据第三方应用程序的具体应用场景进行针对性的系统资源适配。Referring to FIG. 11 , the memory 120 can be divided into an operating system space and a user space, the operating system runs in the operating system space, and the native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve better running effects, the operating system allocates corresponding system resources to different third-party applications. However, different application scenarios in the same third-party application also have different requirements for system resources. For example, in the local resource loading scenario, the third-party application has higher requirements on the disk read speed; in the animation rendering scenario, the first Third-party applications have higher requirements on GPU performance. The operating system and the third-party application are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in time, so that the operating system cannot perform targeted system resource adaptation according to the specific application scenario of the third-party application.

为了使操作系统能够区分第三方应用程序的具体应用场景,需要打通第三方应用程序与操作系统之间的数据通信,使得操作系统能够随时获取第三方应用程序当前的场景信息,进而基于当前场景进行针对性的系统资源适配。In order to enable the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up the data communication between the third-party application and the operating system, so that the operating system can obtain the current scene information of the third-party application at any time, and then perform the operation based on the current scene. Targeted system resource adaptation.

以操作系统为Android系统为例,存储器120中存储的程序和数据如图12所示,存储器120中可存储有Linux内核层320、系统运行时库层340、应用框架层360和应用层380,其中,Linux内核层320、系统运行库层340和应用框架层360属于操作系统空间,应用层380 属于用户空间。Linux内核层320为电子设备的各种硬件提供了底层的驱动,如显示驱动、音频驱动、摄像头驱动、蓝牙驱动、Wi-Fi驱动、电源管理等。系统运行库层340通过一些C/C++ 库来为Android系统提供了主要的特性支持。如SQLite库提供了数据库的支持,OpenGL/ES 库提供了3D绘图的支持,Webkit库提供了浏览器内核的支持等。在系统运行时库层340中还提供有安卓运行时库(Android runtime),它主要提供了一些核心库,能够允许开发者使用Java语言来编写Android应用。应用框架层360提供了构建应用程序时可能用到的各种API,开发者也可以通过使用这些API来构建自己的应用程序,比如活动管理、窗口管理、视图管理、通知管理、内容提供者、包管理、通话管理、资源管理、定位管理。应用层380中运行有至少一个应用程序,这些应用程序可以是操作系统自带的原生应用程序,比如联系人程序、短信程序、时钟程序、相机应用等;也可以是第三方开发者所开发的第三方应用程序,比如游戏类应用程序、即时通信程序、相片美化程序等。Taking the Android system as the operating system as an example, the programs and data stored in the memory 120 are shown in FIG. 12 . The memory 120 can store the Linux kernel layer 320, the system runtime library layer 340, the application framework layer 360 and the application layer 380, Among them, the Linux kernel layer 320, the system runtime layer 340 and the application framework layer 360 belong to the operating system space, and the application layer 380 belongs to the user space. The Linux kernel layer 320 provides underlying drivers for various hardwares of electronic devices, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, power management and the like. The system runtime layer 340 provides main feature support for the Android system through some C/C++ libraries. For example, the SQLite library provides database support, the OpenGL/ES library provides 3D drawing support, and the Webkit library provides browser kernel support. An Android runtime library (Android runtime) is also provided in the system runtime library layer 340, which mainly provides some core libraries, which can allow developers to use Java language to write Android applications. The application framework layer 360 provides various APIs that may be used when building applications. Developers can also build their own applications by using these APIs, such as activity management, window management, view management, notification management, content provider, Package management, call management, resource management, location management. There is at least one application running in the application layer 380, and these applications may be native applications that come with the operating system, such as contact programs, SMS programs, clock programs, camera applications, etc.; they may also be developed by third-party developers Third-party applications, such as game applications, instant messaging programs, photo enhancement programs, etc.

以操作系统为IOS系统为例,存储器120中存储的程序和数据如图13所示,IOS系统包括:核心操作系统层420(Core OS layer)、核心服务层440(Core Services layer)、媒体层460(Media layer)、可触摸层480(Cocoa Touch Layer)。核心操作系统层420包括了操作系统内核、驱动程序以及底层程序框架,这些底层程序框架提供更接近硬件的功能,以供位于核心服务层440的程序框架所使用。核心服务层440提供给应用程序所需要的系统服务和/或程序框架,比如基础(Foundation)框架、账户框架、广告框架、数据存储框架、网络连接框架、地理位置框架、运动框架等等。媒体层460为应用程序提供有关视听方面的接口,如图形图像相关的接口、音频技术相关的接口、视频技术相关的接口、音视频传输技术的无线播放(AirPlay)接口等。可触摸层480为应用程序开发提供了各种常用的界面相关的框架,可触摸层480负责用户在电子设备上的触摸交互操作。比如本地通知服务、远程推送服务、广告框架、游戏工具框架、消息用户界面接口(User Interface,UI)框架、用户界面UIKit框架、地图框架等等。Taking the operating system as the IOS system as an example, the programs and data stored in the memory 120 are shown in FIG. 13 . The IOS system includes: a core operating system layer 420 (Core OS layer), a core service layer 440 (Core Services layer), a media layer 460 (Media layer), touchable layer 480 (Cocoa Touch Layer). The core operating system layer 420 includes the operating system kernel, drivers, and low-level program frameworks, which provide functions closer to hardware for use by the program frameworks located in the core service layer 440 . The core service layer 440 provides system services and/or program frameworks required by application programs, such as a foundation framework, an account framework, an advertisement framework, a data storage framework, a network connection framework, a geographic location framework, a motion framework, and the like. The media layer 460 provides audiovisual interfaces for applications, such as graphics and image related interfaces, audio technology related interfaces, video technology related interfaces, and audio and video transmission technology wireless playback (AirPlay) interfaces. The touchable layer 480 provides various common interface-related frameworks for application development, and the touchable layer 480 is responsible for the user's touch interaction operation on the electronic device. Such as local notification service, remote push service, advertising framework, game tool framework, message user interface interface (User Interface, UI) framework, user interface UIKit framework, map framework and so on.

在图13所示出的框架中,与大部分应用程序有关的框架包括但不限于:核心服务层440 中的基础框架和可触摸层480中的UIKit框架。基础框架提供许多基本的对象类和数据类型,为所有应用程序提供最基本的系统服务,和UI无关。而UIKit框架提供的类是基础的UI类库,用于创建基于触摸的用户界面,iOS应用程序可以基于UIKit框架来提供UI,所以它提供了应用程序的基础架构,用于构建用户界面,绘图、处理和用户交互事件,响应手势等等。Among the frameworks shown in FIG. 13 , the frameworks related to most applications include but are not limited to: the basic framework in the core service layer 440 and the UIKit framework in the touchable layer 480 . The basic framework provides many basic object classes and data types, and provides the most basic system services for all applications, regardless of UI. The classes provided by the UIKit framework are the basic UI class libraries for creating touch-based user interfaces. iOS applications can provide UI based on the UIKit framework, so it provides the application's infrastructure for building user interfaces, drawing , handling and user interaction events, responding to gestures, and more.

其中,在IOS系统中实现第三方应用程序与操作系统数据通信的方式以及原理可参考 Android系统,本申请在此不再赘述。The method and principle of implementing data communication between a third-party application program and an operating system in the IOS system may refer to the Android system, which will not be repeated in this application.

其中,输入装置130用于接收输入的指令或数据,输入装置130包括但不限于键盘、鼠标、摄像头、麦克风或触控设备。输出装置140用于输出指令或数据,输出装置140包括但不限于显示设备和扬声器等。在一个示例中,输入装置130和输出装置140可以合设,输入装置130和输出装置140为触摸显示屏,该触摸显示屏用于接收用户使用手指、触摸笔等任何适合的物体在其上或附近的触摸操作,以及显示各个应用程序的用户界面。触摸显示屏通常设置在电子设备的前面板。触摸显示屏可被设计成为全面屏、曲面屏或异型屏。触摸显示屏还可被设计成为全面屏与曲面屏的结合,异型屏与曲面屏的结合,本申请实施例对此不加以限定。The input device 130 is used for receiving input instructions or data, and the input device 130 includes but is not limited to a keyboard, a mouse, a camera, a microphone or a touch device. The output device 140 is used for outputting instructions or data, and the output device 140 includes, but is not limited to, a display device, a speaker, and the like. In one example, the input device 130 and the output device 140 may be co-located, and the input device 130 and the output device 140 are a touch display screen, the touch display screen is used to receive any suitable objects such as a user's finger, a touch pen, etc. Nearby touch actions, as well as displaying the user interface of each application. The touch display is usually provided on the front panel of the electronic device. The touch screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed to be a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.

除此之外,本领域技术人员可以理解,上述附图所示出的电子设备的结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,电子设备中还包括射频电路、输入单元、传感器、音频电路、无线保真(wireless fidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation to the electronic device, and the electronic device may include more or less components than those shown in the drawings, or a combination of certain components may be included. some components, or a different arrangement of components. For example, the electronic device further includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, and a Bluetooth module, which will not be repeated here.

在本申请实施例中,各步骤的执行主体可以是上文介绍的电子设备。可选地,各步骤的执行主体为电子设备的操作系统。操作系统可以是安卓系统,也可以是IOS系统,或者其它操作系统,本申请实施例对此不作限定。In this embodiment of the present application, the execution body of each step may be the electronic device described above. Optionally, the execution subject of each step is an operating system of the electronic device. The operating system may be an Android system, an IOS system, or other operating systems, which are not limited in this embodiment of the present application.

本申请实施例的电子设备,其上还可以安装有显示设备,显示设备可以是各种能实现显示功能的设备,例如:阴极射线管显示器(cathode ray tubedisplay,简称CR)、发光二极管显示器(light-emitting diode display,简称LED)、电子墨水屏、液晶显示屏(liquid crystal display,简称LCD)、等离子显示面板(plasma display panel,简称PDP)等。用户可以利用电子设备101上的显示设备,来查看显示的文字、图像、视频等信息。所述电子设备可以是智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、汽车、数据存储装置、音频播放装置、视频播放装置、笔记本、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The electronic device according to the embodiment of the present application may also have a display device installed thereon, and the display device may be various devices that can realize a display function, such as a cathode ray tube display (CR for short), a light emitting diode display (light emitting diode display). -emitting diode display, referred to as LED), electronic ink screen, liquid crystal display (liquid crystal display, referred to as LCD), plasma display panel (plasma display panel, referred to as PDP) and so on. The user can use the display device on the electronic device 101 to view the displayed text, image, video and other information. The electronic device may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, a wearable device such as an electronic device. Watches, electronic glasses, electronic helmets, electronic bracelets, electronic necklaces, electronic clothing and other equipment.

在图10所示的电子设备中,其中电子设备可以是一种终端,处理器110可以用于调用存储器120中存储的应用程序,并具体执行以下操作:In the electronic device shown in FIG. 10, the electronic device may be a terminal, and the processor 110 may be used to invoke the application program stored in the memory 120, and specifically perform the following operations:

获取针对应用的目标应用包以及应用基准包;Obtain the target application package and the application benchmark package for the application;

对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;Decompiling and comparing the target application package and the application benchmark package to obtain a set of difference classes for the target application package;

基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。Perform static taint detection on the target application package based on the difference class set to obtain a taint path set for the target application package.

在一个实施例中,所述处理器110在执行所述对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合时,具体执行以下操作:In an embodiment, when the processor 110 performs the decompilation and comparison process on the target application package and the application benchmark package to obtain a difference class set for the target application package, the processor 110 specifically performs the following steps: operate:

确定所述应用基准包对应的第一反编译文件,确定所述目标应用包对应的第二反编译文件;determining a first decompiled file corresponding to the application benchmark package, and determining a second decompiled file corresponding to the target application package;

将所述第一反编译文件以及所述第二反编译文件进行比对处理,得到针对所述目标应用包的差异类集合。The first decompiled file and the second decompiled file are compared to obtain a difference class set for the target application package.

在一个实施例中,所述处理器110在执行所述将所述第一反编译文件以及所述第二反编译文件进行比对处理时,具体执行以下操作:In one embodiment, when the processor 110 performs the comparison process of the first decompiled file and the second decompiled file, the processor 110 specifically performs the following operations:

以所述第一反编译文件所包含的至少一个基准文件为参考,在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合;和/或With reference to at least one benchmark file included in the first decompiled file, a first file that does not match each of the benchmark files is determined in the second decompiled file, and based on the first file, the target file is determined. an incremental class set of the target application package; and/or

以所述第二反编译文件所包含的至少一个目标文件为参考,在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合。Taking at least one object file included in the second decompiled file as a reference, determine in the first decompiled file a second file that does not match each of the object files and a second file that does not match at least one of the object files. For the matched third file, a deletion class set and an incremental class set for the target application package are determined based on the second file and the third file.

在一个实施例中,所述处理器110在执行所述在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合时,具体执行以下操作:In one embodiment, the processor 110 determines, in the second decompiled file, a first file that does not match each of the benchmark files, and determines the target based on the first file. When applying a package's incremental class collection, it does the following:

在所述第二反编译文件中确定与每个所述基准文件的基准文件名称不匹配的第一文件名称,基于所述第一文件名称确定针对所述目标应用包的增量类集合;determining a first file name that does not match the reference file name of each of the reference files in the second decompiled file, and determining an incremental class set for the target application package based on the first file name;

所述在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合,包括:the determining in the first decompiled file a second file that does not match each of the object files and a third file that matches at least one of the object files, based on the second file and the third file The three files determine the set of pruning classes for the target application package, including:

在所述第一反编译文件中确定与每个所述目标文件的目标文件名称不匹配的第二文件名称以及与至少一个所述目标文件名称相匹配的第三文件名称,基于所述第二文件名称以及所述第三文件名称确定针对所述目标应用包的删减类集合和增量类集合。A second file name that does not match the object file name of each of the object files and a third file name that matches at least one of the object file names are determined in the first decompiled file, based on the second file name The file name and the third file name determine a set of pruned classes and a set of incremental classes for the target application package.

在一个实施例中,所述处理器110在执行所述基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合时,具体执行以下操作:In an embodiment, the processor 110 specifically performs the following operations when executing the determining of the pruned class set and the incremental class set for the target application package based on the second file and the third file :

将所述第二文件的第二文件名称加入至针对所述目标应用包的删减类集合;以及,adding the second file name of the second file to the set of abridged classes for the target application package; and,

获取所述第三文件与参考目标文件的摘要匹配结果,基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述增量类集合,所述第三文件的文件名称与所述参考目标文件的文件名称相同。Obtain the digest matching result between the third file and the reference target file, and add the third file name of the third file to the incremental class set based on the digest matching result, where the file name of the third file is the same as The file names of the reference object files are the same.

在一个实施例中,所述处理器110在执行述基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述删减类集合中时,具体执行以下操作:In one embodiment, when the processor 110 executes the process of adding the third file name of the third file to the abridged class set based on the digest matching result, the processor 110 specifically performs the following operations:

若所述摘要匹配结果的结果类型为摘要不匹配类型,则将所述第三文件的第三文件名称加入至所述增量类集合。If the result type of the digest matching result is a digest mismatch type, adding the third file name of the third file to the incremental class set.

在一个实施例中,所述处理器110在执行所述基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合时,具体执行以下操作:In one embodiment, when the processor 110 performs the static taint detection on the target application package based on the difference class set to obtain a taint path set for the target application package, the processor 110 specifically performs the following operations:

确定所述差异类集合对应的集合类,基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。A collection class corresponding to the set of difference classes is determined, and static taint detection is performed on the target application package based on the collection class to obtain a taint path set for the target application package.

在一个实施例中,所述处理器110在执行所述基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合时,具体执行以下操作:In one embodiment, when the processor 110 performs the static taint detection on the target application package based on the collection class to obtain a taint path set for the target application package, the processor 110 specifically performs the following operations:

若所述集合类为增量类,则调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合,将所述第一污点路径集合作为针对所述目标应用包的污点路径集合;If the collection class is an incremental class, call the taint detection tool to perform static taint detection on the target application package based on the incremental class set, obtain a first taint path set, and use the first taint path set as the target application package for the A collection of taint paths of the target application package;

若所述集合类为删减类,则获取所述应用基准包对应的第二污点路径集合,基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合;If the collection class is a pruning class, obtain a second taint path set corresponding to the application reference package, and determine the taint for the target application package based on the second taint path set and the pruning class set path collection;

若所述集合类为增量类和删减类,则基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合。If the set class is an incremental class and a pruned class, determining the taint for the target application package based on the first taint path set, the second taint path set, and the pruned class set Path collection.

在一个实施例中,所述处理器110在执行所述基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合时,具体执行以下操作:In one embodiment, the processor 110 is performing the determining of the taint for the target application package based on the first taint path set, the second taint path set and the pruning class set. When the path collection is performed, the specific operations are as follows:

基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes;

获取所述第二污点路径集合中的至少一个目标污点路径,所处目标污点路径为所述第二污点路径集合中除所述参考污点路径之外的污点路径;acquiring at least one target taint path in the second taint path set, where the target taint path is a taint path other than the reference taint path in the second taint path set;

将所述至少一个目标污点路径加入至所述第一污点路径集合中,得到针对所述目标应用包的污点路径集合。The at least one target taint path is added to the first taint path set to obtain a taint path set for the target application package.

在一个实施例中,所述处理器110在执行所述基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合时,具体执行以下操作:In one embodiment, when the processor 110 determines the taint path set for the target application package based on the second taint path set and the pruning class set, the processor 110 specifically performs the following operations:

基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes;

将所述第二污点路径集合中的所述至少一个参考污点路径进行删除处理,得到针对所述目标应用包的污点路径集合。The at least one reference taint path in the second taint path set is deleted to obtain a taint path set for the target application package.

在一个实施例中,所述处理器110在执行所述调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合时,具体执行以下操作:In one embodiment, when executing the call taint detection tool to perform static taint detection on the target application package based on the incremental class set, and obtain the first taint path set, the processor 110 specifically performs the following operations:

基于所述增量类集合确定针对所述目标应用包的检测入口函数集合;Determine, based on the incremental class set, a set of detection entry functions for the target application package;

基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合。Based on the set of detection entry functions, a taint detection tool is called to perform static taint detection on the target application package, and a first set of taint paths is obtained.

在一个实施例中,所述处理器1001在执行所述基于所述增量类集合确定针对所述目标应用包的检测入口函数集合时,具体执行以下操作:In one embodiment, when the processor 1001 executes the determination of the set of detection entry functions for the target application package based on the incremental class set, the processor 1001 specifically performs the following operations:

获取所述目标应用包的过程间调用图,基于所述过程间调用图确定初始入口函数集合;Obtain an inter-procedure call graph of the target application package, and determine an initial entry function set based on the inter-procedure call graph;

基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数;Perform function node traversal processing on the inter-procedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function;

生成包含所述至少一个目标节点函数的检测入口函数集合。A detection entry function set including the at least one target node function is generated.

在一个实施例中,所述处理器110在执行所述基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数时,具体执行以下操作:In one embodiment, the processor 110 performs the function node traversal processing on the interprocedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function , do the following:

以所述初始入口函数集合指示的至少一个初始入口函数为基准,基于增量类集合对所述过程间控制流图中各初始函数节点对应的每个下一函数节点进行节点类匹配处理,得到至少一个目标函数节点对应的目标节点函数;Taking at least one initial entry function indicated by the initial entry function set as a benchmark, performing node class matching processing on each next function node corresponding to each initial function node in the inter-process control flow graph based on the incremental class set, to obtain the target node function corresponding to at least one target function node;

其中,所述初始函数节点为所述初始入口函数在所述过程间控制流图中对应的首节点,所述目标函数节点对应的目标入口函数所属的目标函数类为所述增量类集合中的函数类。The initial function node is the first node corresponding to the initial entry function in the inter-process control flow graph, and the objective function class to which the objective entry function corresponding to the objective function node belongs is in the incremental class set function class.

在一个实施例中,所述处理器1001在执行所述基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合时,具体执行以下操作:In one embodiment, the processor 1001 specifically performs the following operations when executing the static taint detection on the target application package by calling the taint detection tool based on the detection entry function set to obtain the first taint path set:

获取所述目标应用包对应的过程间调用图;基于所述检测入口函数集合对所述过程间调用图进行静态污点检测,得到针对所述目标应用包的第一污点路径集合。Obtaining an inter-procedure call graph corresponding to the target application package; performing static taint detection on the inter-procedure call graph based on the detection entry function set, to obtain a first taint path set for the target application package.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体或随机存储记忆体等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. During execution, the processes of the embodiments of the above-mentioned methods may be included. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only storage memory or a random storage memory, and the like.

以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。What is disclosed above is only the preferred embodiment of the present application, and of course, it cannot limit the scope of the right of the present application. Therefore, the equivalent changes made according to the claims of the present application are still within the scope of the present application.

Claims (17)

1.一种应用检测方法,其特征在于,所述方法包括:1. an application detection method, is characterized in that, described method comprises: 获取针对应用的目标应用包以及应用基准包;Obtain the target application package and the application benchmark package for the application; 对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;Decompiling and comparing the target application package and the application benchmark package to obtain a set of difference classes for the target application package; 基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。Perform static taint detection on the target application package based on the difference class set to obtain a taint path set for the target application package. 2.根据权利要求1所述的方法,其特征在于,所述对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合,包括:2. The method according to claim 1, wherein the decompiling and comparison processing is performed on the target application package and the application benchmark package to obtain a difference class set for the target application package, comprising: 确定所述应用基准包对应的第一反编译文件,确定所述目标应用包对应的第二反编译文件;determining a first decompiled file corresponding to the application benchmark package, and determining a second decompiled file corresponding to the target application package; 将所述第一反编译文件以及所述第二反编译文件进行比对处理,得到针对所述目标应用包的差异类集合。The first decompiled file and the second decompiled file are compared to obtain a difference class set for the target application package. 3.根据权利要求2所述的方法,其特征在于,所述将所述第一反编译文件以及所述第二反编译文件进行比对处理,得到针对所述目标应用包的差异类集合,包括:3. The method according to claim 2, wherein the first decompiled file and the second decompiled file are compared and processed to obtain a difference class set for the target application package, include: 以所述第一反编译文件所包含的至少一个基准文件为参考,在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合;和/或With reference to at least one benchmark file included in the first decompiled file, a first file that does not match each of the benchmark files is determined in the second decompiled file, and based on the first file, the target file is determined. an incremental class set of the target application package; and/or 以所述第二反编译文件所包含的至少一个目标文件为参考,在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合。Taking at least one object file included in the second decompiled file as a reference, determine in the first decompiled file a second file that does not match each of the object files and a second file that does not match at least one of the object files. For the matched third file, a deletion class set and an incremental class set for the target application package are determined based on the second file and the third file. 4.根据权利要求3所述的方法,其特征在于,所述在所述第二反编译文件中确定与每个所述基准文件不匹配的第一文件,基于所述第一文件确定针对所述目标应用包的增量类集合,包括:4 . The method according to claim 3 , wherein, determining in the second decompiled file a first file that does not match each of the reference files, determining the first file based on the first file. 5 . A collection of incremental classes for the target application package, including: 在所述第二反编译文件中确定与每个所述基准文件的基准文件名称不匹配的第一文件名称,基于所述第一文件名称确定针对所述目标应用包的增量类集合;determining a first file name that does not match the reference file name of each of the reference files in the second decompiled file, and determining an incremental class set for the target application package based on the first file name; 所述在所述第一反编译文件中确定与每个所述目标文件不匹配的第二文件以及与至少一个所述目标文件相匹配的第三文件,基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合,包括:the determining in the first decompiled file a second file that does not match each of the object files and a third file that matches at least one of the object files, based on the second file and the third file The three files determine the set of pruning classes for the target application package, including: 在所述第一反编译文件中确定与每个所述目标文件的目标文件名称不匹配的第二文件名称以及与至少一个所述目标文件名称相匹配的第三文件名称,基于所述第二文件名称以及所述第三文件名称确定针对所述目标应用包的删减类集合和增量类集合。A second file name that does not match the object file name of each of the object files and a third file name that matches at least one of the object file names are determined in the first decompiled file, based on the second file name The file name and the third file name determine a set of pruned classes and a set of incremental classes for the target application package. 5.根据权利要求3所述的方法,其特征在于,所述基于所述第二文件以及所述第三文件确定针对所述目标应用包的删减类集合和增量类集合,包括:5. The method according to claim 3, characterized in that, determining the set of deletion classes and the set of incremental classes for the target application package based on the second file and the third file, comprising: 将所述第二文件的第二文件名称加入至针对所述目标应用包的删减类集合;以及,adding the second file name of the second file to the set of abridged classes for the target application package; and, 获取所述第三文件与参考目标文件的摘要匹配结果,基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述增量类集合,所述第三文件的文件名称与所述参考目标文件的文件名称相同。Obtain the digest matching result between the third file and the reference target file, and add the third file name of the third file to the incremental class set based on the digest matching result, where the file name of the third file is the same as The file names of the reference object files are the same. 6.根据权利要求5所述的方法,其特征在于,所述基于所述摘要匹配结果将所述第三文件的第三文件名称加入至所述删减类集合中,包括:6. The method according to claim 5, wherein adding the third file name of the third file to the abridged class set based on the digest matching result, comprising: 若所述摘要匹配结果的结果类型为摘要不匹配类型,则将所述第三文件的第三文件名称加入至所述增量类集合。If the result type of the digest matching result is a digest mismatch type, adding the third file name of the third file to the incremental class set. 7.根据权利要求1所述的方法,其特征在于,所述基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,包括:7. The method according to claim 1, wherein the static taint detection is performed on the target application package based on the difference class set to obtain a taint path set for the target application package, comprising: 确定所述差异类集合对应的集合类,基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。A collection class corresponding to the set of difference classes is determined, and static taint detection is performed on the target application package based on the collection class to obtain a taint path set for the target application package. 8.根据权利要求7所述的方法,其特征在于,所述基于所述集合类对所述目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合,包括:8 . The method according to claim 7 , wherein the static taint detection is performed on the target application package based on the collection class to obtain a taint path set for the target application package, comprising: 8 . 若所述集合类为增量类,则调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合,将所述第一污点路径集合作为针对所述目标应用包的污点路径集合;If the collection class is an incremental class, call the taint detection tool to perform static taint detection on the target application package based on the incremental class set, obtain a first taint path set, and use the first taint path set as the target application package for the A collection of taint paths of the target application package; 若所述集合类为删减类,则获取所述应用基准包对应的第二污点路径集合,基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合;If the collection class is a pruning class, obtain a second taint path set corresponding to the application reference package, and determine the taint for the target application package based on the second taint path set and the pruning class set path collection; 若所述集合类为增量类和删减类,则基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合。If the set class is an incremental class and a pruned class, determining the taint for the target application package based on the first taint path set, the second taint path set, and the pruned class set Path collection. 9.根据权利要求8所述的方法,其特征在于,所述基于所述第一污点路径集合、所述第二污点路径集合以及所述删减类集合,确定针对所述目标应用包的所述污点路径集合,包括:9 . The method according to claim 8 , wherein, based on the first taint path set, the second taint path set, and the pruning class set, determining all of the target application packages. 10 . The set of taint paths described above, including: 基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes; 获取所述第二污点路径集合中的至少一个目标污点路径,所处目标污点路径为所述第二污点路径集合中除所述参考污点路径之外的污点路径;acquiring at least one target taint path in the second taint path set, where the target taint path is a taint path other than the reference taint path in the second taint path set; 将所述至少一个目标污点路径加入至所述第一污点路径集合中,得到针对所述目标应用包的污点路径集合。The at least one target taint path is added to the first taint path set to obtain a taint path set for the target application package. 10.根据权利要求8所述的方法,其特征在于,所述基于所述第二污点路径集合以及删减类集合,确定针对所述目标应用包的所述污点路径集合,包括:10. The method according to claim 8, wherein the determining the taint path set for the target application package based on the second taint path set and the pruning class set comprises: 基于所述删减类集合从所述第二污点路径集合中确定至少一个参考污点路径;determining at least one reference taint path from the second set of taint paths based on the set of pruned classes; 将所述第二污点路径集合中的所述至少一个参考污点路径进行删除处理,得到针对所述目标应用包的污点路径集合。The at least one reference taint path in the second taint path set is deleted to obtain a taint path set for the target application package. 11.根据权利要求8所述的方法,其特征在于,所述调用污点检测工具基于增量类集合对所述目标应用包进行静态污点检测,得到第一污点路径集合,包括:11. The method according to claim 8, wherein the invoking taint detection tool performs static taint detection on the target application package based on an incremental class set to obtain a first taint path set, comprising: 基于所述增量类集合确定针对所述目标应用包的检测入口函数集合;Determine, based on the incremental class set, a set of detection entry functions for the target application package; 基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合。Based on the set of detection entry functions, a taint detection tool is called to perform static taint detection on the target application package, and a first set of taint paths is obtained. 12.根据权利要求11所述的方法,其特征在于,所述基于所述增量类集合确定针对所述目标应用包的检测入口函数集合,包括:12. The method according to claim 11, wherein the determining a set of detection entry functions for the target application package based on the incremental class set comprises: 获取所述目标应用包的过程间调用图,基于所述过程间调用图确定初始入口函数集合;Obtain an inter-procedure call graph of the target application package, and determine an initial entry function set based on the inter-procedure call graph; 基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数;Perform function node traversal processing on the inter-procedure call graph based on the incremental class set and the initial entry function set to determine at least one target node function; 生成包含所述至少一个目标节点函数的检测入口函数集合。A detection entry function set including the at least one target node function is generated. 13.根据权利要求12所述的方法,其特征在于,所述基于所述增量类集合和所述初始入口函数集合对所述过程间调用图进行函数节点遍历处理,以确定至少一个目标节点函数,包括:13 . The method according to claim 12 , wherein the function node traversal processing is performed on the interprocedural call graph based on the incremental class set and the initial entry function set to determine at least one target node. 14 . functions, including: 以所述初始入口函数集合指示的至少一个初始入口函数为基准,基于增量类集合对所述过程间控制流图中各初始函数节点对应的每个下一函数节点进行节点类匹配处理,得到至少一个目标函数节点对应的目标节点函数;Taking at least one initial entry function indicated by the initial entry function set as a benchmark, performing node class matching processing on each next function node corresponding to each initial function node in the inter-process control flow graph based on the incremental class set, to obtain the target node function corresponding to at least one target function node; 其中,所述初始函数节点为所述初始入口函数在所述过程间控制流图中对应的首节点,所述目标函数节点对应的目标入口函数所属的目标函数类为所述增量类集合中的函数类。The initial function node is the first node corresponding to the initial entry function in the inter-process control flow graph, and the objective function class to which the objective entry function corresponding to the objective function node belongs is in the incremental class set function class. 14.根据权利要求11所述的方法,其特征在于,所述基于所述检测入口函数集合调用污点检测工具对目标应用包进行静态污点检测,得到第一污点路径集合,包括:14. The method according to claim 11, wherein the calling a taint detection tool based on the detection entry function set to perform static taint detection on the target application package to obtain a first taint path set, comprising: 获取所述目标应用包对应的过程间调用图;obtaining the inter-procedure call graph corresponding to the target application package; 基于所述检测入口函数集合对所述过程间调用图进行静态污点检测,得到针对所述目标应用包的第一污点路径集合。Perform static taint detection on the inter-procedure call graph based on the detection entry function set to obtain a first taint path set for the target application package. 15.一种应用检测装置,其特征在于,所述装置包括:15. An application detection device, characterized in that the device comprises: 获取模块,用于获取应用的目标应用包以及应用基准包;The acquisition module is used to acquire the target application package and the application benchmark package of the application; 处理模块,用于对所述目标应用包和所述应用基准包进行反编译比对处理,得到针对所述目标应用包的差异类集合;a processing module, configured to decompile and compare the target application package and the application benchmark package to obtain a set of difference classes for the target application package; 检测模块,用于基于所述差异类集合对目标应用包进行静态污点检测,得到针对所述目标应用包的污点路径集合。The detection module is configured to perform static taint detection on the target application package based on the difference class set, and obtain a taint path set for the target application package. 16.一种计算机存储介质,其特征在于,所述计算机存储介质存储有多条指令,所述指令适于由处理器加载并执行如权利要求1~14任意一项的方法步骤。16. A computer storage medium, characterized in that the computer storage medium stores a plurality of instructions, the instructions are suitable for being loaded by a processor and performing the method steps of any one of claims 1-14. 17.一种电子设备,其特征在于,包括:处理器和存储器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述处理器加载并执行如权利要求1~14任意一项的方法步骤。17. An electronic device, comprising: a processor and a memory; wherein, the memory stores a computer program, and the computer program is adapted to be loaded by the processor and execute any one of claims 1 to 14 method steps for the item.
CN202111574727.7A 2021-12-21 2021-12-21 Application detection method and device, storage medium and electronic equipment Pending CN114547604A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111574727.7A CN114547604A (en) 2021-12-21 2021-12-21 Application detection method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111574727.7A CN114547604A (en) 2021-12-21 2021-12-21 Application detection method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114547604A true CN114547604A (en) 2022-05-27

Family

ID=81668931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111574727.7A Pending CN114547604A (en) 2021-12-21 2021-12-21 Application detection method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114547604A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080984A (en) * 2022-06-30 2022-09-20 Oppo广东移动通信有限公司 Third-party library file vulnerability detection method, device, electronic device and storage medium
CN115632877A (en) * 2022-12-01 2023-01-20 成都九洲电子信息系统股份有限公司 Large-scale PCAP data correctness verification method, system and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933645A (en) * 2017-01-17 2017-07-07 深圳市能信安科技股份有限公司 A kind of Apk security risks automatic Static auditing system and method
CN110443043A (en) * 2019-07-31 2019-11-12 北京奇艺世纪科技有限公司 The leak detection method and equipment of a kind of pair of Android application program
CN113254001A (en) * 2021-07-06 2021-08-13 统信软件技术有限公司 Source code analysis method, computing device and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933645A (en) * 2017-01-17 2017-07-07 深圳市能信安科技股份有限公司 A kind of Apk security risks automatic Static auditing system and method
CN110443043A (en) * 2019-07-31 2019-11-12 北京奇艺世纪科技有限公司 The leak detection method and equipment of a kind of pair of Android application program
CN113254001A (en) * 2021-07-06 2021-08-13 统信软件技术有限公司 Source code analysis method, computing device and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080984A (en) * 2022-06-30 2022-09-20 Oppo广东移动通信有限公司 Third-party library file vulnerability detection method, device, electronic device and storage medium
CN115080984B (en) * 2022-06-30 2024-12-17 Oppo广东移动通信有限公司 Third party library file vulnerability detection method and device, electronic equipment and storage medium
CN115632877A (en) * 2022-12-01 2023-01-20 成都九洲电子信息系统股份有限公司 Large-scale PCAP data correctness verification method, system and storage medium

Similar Documents

Publication Publication Date Title
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN110531962B (en) Development processing method and device for applet and computer readable storage medium
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN109726217B (en) Database operation method, device, equipment and storage medium
CN113407165B (en) SDK generation and self-upgrade method, device, readable medium and equipment
CN112214653B (en) String recognition method, device, storage medium and electronic device
CN111796865B (en) Byte code file modification method, device, terminal equipment and medium
CN112527386B (en) Application distribution method and device
CN110609687A (en) Compiling method, device, electronic equipment and storage medium
CN114547604A (en) Application detection method and device, storage medium and electronic equipment
CN110928571A (en) Business program development method and device
CN112416303A (en) Software development kit thermal restoration method and device and electronic equipment
CN118673497A (en) Code risk detection method and device, electronic equipment and computer storage medium
EP3834080A1 (en) Static reconcilliation of application view hierarchies
CN113268221B (en) File matching method, device, storage medium and computer equipment
CN113254340B (en) A method and device for generating test cases
CN117632746A (en) Pile inserting processing method and device, storage medium and electronic equipment
CN113849242A (en) Method and device for generating and registering UI service package and loading UI service
US11775471B2 (en) System and method for caching converted files and compiling computer code from the cache
CN111274551B (en) Compiler-based java code protection method, device and electronic equipment
CN112068814A (en) Method, device, system and medium for generating executable file
CN112148318A (en) Application package issuing method, application method, device, medium, server and equipment
CN111008006A (en) RFC file modification method and device, storage medium and terminal
CN117349165A (en) Compiling and debugging method and device, storage medium and electronic equipment
CN113778386B (en) Component generation method, device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20250411

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Country or region after: China

Address before: 311100 room 1001, building 9, Xixi bafangcheng, Wuchang Street, Yuhang District, Hangzhou City, Zhejiang Province

Applicant before: Hangzhou douku Software Technology Co.,Ltd.

Country or region before: China