WO2015074489A1 - 一种测试Android应用程序的方法和装置 - Google Patents
一种测试Android应用程序的方法和装置 Download PDFInfo
- Publication number
- WO2015074489A1 WO2015074489A1 PCT/CN2014/090259 CN2014090259W WO2015074489A1 WO 2015074489 A1 WO2015074489 A1 WO 2015074489A1 CN 2014090259 W CN2014090259 W CN 2014090259W WO 2015074489 A1 WO2015074489 A1 WO 2015074489A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- call
- command
- application
- runtime data
- command call
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
Definitions
- the present invention relates to software testing, and more particularly to a method and apparatus for testing an Android application.
- the prior art does not disclose a solution to the above problem.
- a problem with the static automated test methods of the prior art is that runtime parameters cannot be obtained, and runtime parameters are critical to the analysis of the application's cryptographic algorithms and portions of protocol usage.
- Dynamic testing methods in the prior art often need to modify the application or add breakpoints to debug, and this will reduce the transparency and stability of the program monitoring. For example, modifying the application may cause the application to run incorrectly and also damage the application. The signature mechanism of the program.
- the prior art test methods are only for general-purpose code problems, and cannot be tested and analyzed for specific command calls in the application.
- a specific security analysis eg, whether a certificate is missing or tampered with
- an application's cryptographic algorithms and portions of the protocol cannot be performed, making it impossible to test and discover cryptographic algorithms and protocol usage in the application.
- the present invention proposes a method and apparatus for testing an Android application.
- a method of testing an Android application comprising the steps of:
- step A includes:
- the positioning command is called.
- step A includes:
- step B includes:
- the command call is monitored and the runtime data is retrieved using a monitoring module attached to the Zygote process of the Dalvik virtual machine.
- the runtime data is a parameter related to cryptographic algorithms and/or protocol usage.
- step A its command call is located in the binary code of the application.
- the command call is a method call or an instruction call.
- an apparatus for testing an Android application including:
- a monitoring module configured to monitor the command call and obtain runtime data
- An analysis module for analyzing acquired runtime data.
- the positioning module is configured to:
- the positioning command is called.
- the positioning module is configured to:
- the monitoring module is attached to the Zygote process of the Dalvik virtual machine, thereby monitoring the command call and obtaining runtime data.
- the runtime data is a parameter related to cryptographic algorithms and/or protocol usage.
- the positioning module locates its command call in the binary code of the application.
- the invention dynamically monitors the test program and obtains the operation content of the cryptographic algorithm and the protocol.
- One advantage of the present invention is that it can actively check the mechanism, mode, problem, and various operational information of the code during the running of the program, so that the summary analysis can be performed in stages, and the code quality related judgment result can be obtained according to the specified standard.
- the present invention can directly analyze the binary code of the program without relying on the source code of the program, and when the program is running, the technical solution of the present invention dynamically analyzes the program code loaded in the memory to find the insertion instruction. The location and add specific instructions for program monitoring.
- FIG. 1 is a schematic diagram showing the steps of a method of testing an Android application according to an embodiment of the present invention.
- FIG. 2 is a schematic structural diagram of an apparatus for testing an Android application according to an embodiment of the present invention.
- FIG. 1 is a schematic diagram showing the steps of a method of testing an Android application according to an embodiment of the present invention. As shown in Figure 1, the method includes the following steps:
- a specific command call of the application can be located, such as a command call associated with a cryptographic algorithm and/or protocol usage.
- a command call can be a method call, an interface call, or a fine-grained instruction call for the application.
- the application is statically decompiled to get the class descriptor of the APK program; based on the class descriptor, the method call is filtered to filter out the specific method call.
- step B the command call is monitored and the runtime data is retrieved using a monitoring module attached to the Zygote process of the Dalvik VM (Dalvik VM).
- its command call is located in the application's binary code.
- the programming language used by Android applications is the Java language and runs in the Dalvik VM.
- One embodiment of the present invention monitors the running of a program by adding a monitoring module to the Dalvik VM.
- An Android application runs in a corresponding Dalvik virtual machine instance, a virtual machine instance is a separate process space, so in order for the monitoring module to monitor each process, embodiments of the present invention attach the monitoring module to the Zygote process. on.
- the Zygote process is a special virtual machine process and an incubator for a virtual machine instance. Whenever an Android application is to be executed, Zygote uses the fork function to create a child process to execute the application. The Zygote process completes the initialization of the virtual machine, the loading of the library, the loading and initialization of the preset class library, etc. When a new virtual machine instance is needed, Zygote provides a process template by copying itself. Therefore, when the monitoring module is loaded on the Zygote process, each newly launched APK program will have a monitoring module in the process space, thereby ensuring the reliability of the monitoring.
- the interpreter is the execution engine of the Dalvik virtual machine, which is responsible for Explain the implementation of dex bytecode (that is, the runnable code that is finally generated after the Android source code is compiled).
- Dalvik's dex bytecode includes a constant pool (describes all constants, including references, method names, and numeric constants, as well as class definitions, including access permission flags, class names, etc.), and data segments (including all target virtual machine execution methods).
- the code and the data information associated with the class and method) and the class instance variables which enable the monitoring module to monitor all the information in a fine-grained manner.
- the monitoring module is used to perform policy matching monitoring on the command call. For example, in the process of matching monitoring, the application is first monitored, then monitored and analyzed for its specific class, and then filtered at the instruction level to obtain instructions related to the use of the cryptographic algorithm/protocol, and finally through the monitoring.
- the module extracts runtime data to analyze the application (eg, analyze encryption behavior).
- the runtime data is a parameter related to cryptographic algorithms and/or protocol usage.
- the device for testing an Android application includes a positioning module, a monitoring module, and an analysis module.
- the positioning module is configured to locate a command call of the application
- the monitoring module is configured to monitor the command call and obtain runtime data
- the analysis module is configured to analyze the acquired runtime data.
- the positioning module is configured to perform static code decompilation on the application to obtain a class descriptor; and to locate the method call according to the class descriptor.
- the positioning module is configured to locate and invoke command commands associated with cryptographic algorithms and/or protocol usage.
- the monitoring module is attached to the Zygote process of the Dalvik virtual machine, thereby monitoring the command call and obtaining runtime data.
- the runtime data is a parameter related to cryptographic algorithms and/or protocol usage.
- the positioning module locates its command call in the application's binary code.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明公开测试Android应用程序的方法和装置。该方法包括以下步骤:A:定位应用程序的命令调用,B:监控所述命令调用并获取运行时数据,C:对获取的运行时数据进行分析。
Description
本发明涉及软件测试,并且尤其涉及一种测试Android应用程序的方法和装置。
在应用程序中,通常会使用标准的密码算法和协议来保护数据。但是,在应用程序的开发过程中可能会错误地设置参数(例如,密钥长度、密钥内容)和/或使用步骤(例如,是否使用证书、是否校验证书链),使得安全性得不到保证。为此,需要对应用程序进行测试来避免这样的问题。
现有技术未公开针对上述问题的解决方案。现有技术中的静态自动化测试方法存在的问题是无法获取运行时参数,而运行时的参数对于应用程序的涉及密码算法与协议使用的部分的分析是至关重要的。现有技术中的动态测试方法往往需要修改应用程序或者添加断点来调试,而这样做将降低程序监控的透明性和稳定性,例如,修改应用程序可能导致应用程序运行错误,也会破坏应用程序的签名机制。
另一方面,现有技术的测试方法仅仅针对通用性的代码问题,而无法正对应用程序中的特定命令调用进行测试和分析。例如,无法对应用程序的涉及密码算法与协议使用的部分进行特定性的安全分析(例如,证书是否缺失或者被篡改),从而无法进行测试并发现应用程序中的错误的密码算法和协议使用。
为此,本发明提出一种测试Android应用程序的方法和装置。
发明内容
根据本发明的一个目的,公开一种测试Android应用程序的方法,包括以下步骤:
A:定位应用程序的命令调用,
B:监控所述命令调用并获取运行时数据,
C:对获取的运行时数据进行分析。
在一个技术方案中,步骤A包括:
对应用程序进行静态代码反编译,获取类描述符;
根据类描述符,定位命令调用。
在一个技术方案中,步骤A包括:
定位与密码算法和/或协议使用相关的命令调用。
在一个技术方案中,步骤B包括:
利用被附加到Dalvik虚拟机的Zygote进程上的监控模块来监控所述命令调用并获取运行时数据。
在一个技术方案中,所述运行时数据是与密码算法和/或协议使用相关的参数。
在一个技术方案中,在步骤A中,在应用程序的二进制代码中定位其命令调用。
在一个技术方案中,所述命令调用是方法调用或者指令调用。
根据本发明的另一个目的,公开一种测试Android应用程序的装置,包括:
定位模块,用于定位应用程序的命令调用,
监控模块,用于监控所述命令调用并获取运行时数据,
分析模块,用于对获取的运行时数据进行分析。
在一个技术方案中,定位模块被配置成:
对应用程序进行静态代码反编译,获取类描述符;
根据类描述符,定位命令调用。
在一个技术方案中,定位模块被配置成:
定位与密码算法和/或协议使用相关的命令调用。
在一个技术方案中,所述监控模块被附加到Dalvik虚拟机的Zygote进程上,由此来监控所述命令调用并获取运行时数据。
在一个技术方案中,所述运行时数据是与密码算法和/或协议使用相关的参数。
在一个技术方案中,所述定位模块在应用程序的二进制代码中定位其命令调用。
本发明对待测试程序进行动态监控,获取其密码算法和协议使用的操作内容。本发明的一个优势是在程序运行期间能够主动检查代码运行的机制、模式、问题以及收集代码的各种运行信息,从而可以分阶段执行汇总分析,根据指定的标准,获得代码质量相关判断结果。特别地,本发明可以直接对程序的二进制代码进行分析,无需依赖于程序的源代码,并且在程序运行的时候,本发明的技术方案动态地对内存中加载的程序代码进行分析,找到插入指令的位置,并加入特定指令进行程序监控。
在参照附图阅读了本发明的具体实施方式以后,本领域技术人员将会更清楚地了解本发明的各个方面。本领域技术人员应当理解的是,这些附图仅仅用于配合具体实施方式说明本发明的技术方案,而并非意在对本发明的保护范围构成限制。
图1是根据本发明实施例的测试Android应用程序的方法的步骤示意图。
图2是根据本发明实施例的测试Android应用程序的装置的结构示意图。
下面参照附图,对本发明的具体实施方式作进一步的详细描述。在下面的描述中,为了解释的目的,陈述许多具体细节以便提供对实施例的一个或多个方面的透彻理解。然而,对于本领域技术人员可以显而易见的是,可以这些具体细节的较少程度来实践各实施例的一个或多个方面。因此下面的描述不被视为局限性的,而是通过所附权利要求来限定保护范围。
图1是根据本发明实施例的测试Android应用程序的方法的步骤示意图。如图1所示,该方法包括以下步骤:
A:定位应用程序的命令调用,
B:监控所述命令调用并获取运行时数据,
C:对获取的运行时数据进行分析。
在步骤A中,可以定位应用程序的特定命令调用,例如与密码算法和/或协议使用相关的命令调用。命令调用可以是该应用程序的方法调用、接口调用或更细粒度的指令调用。在一个示例中,对应用程序进行静态代码反编译,获取APK程序的类描述符;根据类描述符,对方法调用进行筛选,过滤出特定的方法调用。
在步骤B中,利用被附加到Dalvik虚拟机(Dalvik VM)的Zygote进程上的监控模块来监控所述命令调用并获取运行时数据。
在一个示例中,在应用程序的二进制代码中定位其命令调用。
Android应用程序所使用的编程语言是Java语言,并运行Dalvik VM中。本发明的一个实施例通过在在Dalvik VM上增加监控模块,对程序运行过程进行监控。一个Android应用程序运行在相应的一个Dalvik虚拟机实例里,一个虚拟机实例是一个独立的进程空间,因此为使监控模块对每个进程进行监控,本发明的实施例将监控模块附加到Zygote进程上。
Zygote进程是一个特殊的虚拟机进程,同时也是一个虚拟机实例的孵化器,每当要执行一个Android应用程序时,Zygote使用fork函数创建出一个子进程来执行该应用程序。Zygote进程完成虚拟机的初始化、库的加载、预置类库的加载和初始化等操作,当需要一个新的虚拟机实例时,Zygote通过复制自身,最快速地提供一个进程模版。因此,当监控模块加载在Zygote进程上时,每一个新启动的APK程序都会在进程空间上拥有监控模块,由此保证监控的可靠性。
在APK程序执行过程中,解释器(Interpreter)是Dalvik虚拟机的执行引擎,它负责
解释执行dex字节码(即Android程序源代码经过编译后最终产生的可运行的编码)。Dalvik的dex字节码中包括常量池(描述所有的常量,包括引用、方法名和数字常量等,以及类定义,包括访问权限标志,类名等),数据段(包括所有目标虚拟机执行的方法代码以及与类和方法相关的数据信息)和类实例变量等内容,这些信息使得监控模块能够细粒度地监控所有信息。在一个实施例中,在Dalvik dex字节码的解释执行过程中,利用监控模块,对命令调用进行策略匹配监控。例如,在匹配监控过程中,首先对应用程序进行监控,然后针对其具体的class进行监控分析,接下来在指令级别上进行过滤,获取和密码算法/协议使用相关的指令调用,最后通过从监控模块提取运行时数据来分析应用(例如分析加密行为)。在一个示例中,所述运行时数据是与密码算法和/或协议使用相关的参数。
图2是根据本发明实施例的测试Android应用程序的装置的结构示意图。如图2所示,测试Android应用程序的装置包括定位模块、监控模块、分析模块。其中,定位模块用于定位应用程序的命令调用,监控模块用于监控所述命令调用并获取运行时数据,分析模块用于对获取的运行时数据进行分析。在一个技术方案中,定位模块被配置成对应用程序进行静态代码反编译,获取类描述符;根据类描述符,定位方法调用。在一个技术方案中,定位模块被配置成定位和与密码算法和/或协议使用相关的命令调用。在一个技术方案中,所述监控模块被附加到Dalvik虚拟机的Zygote进程上,由此来监控所述命令调用并获取运行时数据。在一个技术方案中,所述运行时数据是与密码算法和/或协议使用相关的参数。在一个示例中,定位模块在应用程序的二进制代码中定位其命令调用。
通过以上实施方式的描述,本领域中的普通技术人员能够理解,在不偏离本发明的精神和范围的情况下,还可以对本发明的具体实施方式作各种变更和替换。这些变更和替换都落在本发明权利要求书所限定的范围内。
Claims (14)
- 一种测试Android应用程序的方法,其特征在于,包括以下步骤:A:定位应用程序的命令调用,B:监控所述命令调用并获取运行时数据,C:对获取的运行时数据进行分析。
- 如权利要求1所述的方法,其特征在于,步骤A包括:对应用程序进行静态代码反编译,获取类描述符;根据类描述符,定位命令调用。
- 如权利要求2所述的方法,其特征在于,步骤A包括:定位与密码算法和/或协议使用相关的命令调用。
- 如权利要求3所述的方法,其特征在于,步骤B包括:利用被附加到Dalvik虚拟机的Zygote进程上的监控模块来监控所述命令调用并获取运行时数据。
- 如权利要求4所述的方法,其特征在于,所述运行时数据是与密码算法和/或协议使用相关的参数。
- 如权利要求5所述的方法,其特征在于,在步骤A中,在应用程序的二进制代码中定位其命令调用。
- 如权利要求6所述的方法,其特征在于,所述命令调用是方法调用或者指令调用。
- 一种测试Android应用程序的装置,其特征在于,包括:定位模块,用于定位应用程序的命令调用,监控模块,用于监控所述命令调用并获取运行时数据,分析模块,用于对获取的运行时数据进行分析。
- 如权利要求8所述的装置,其特征在于,定位模块被配置成:对应用程序进行静态代码反编译,获取类描述符;根据类描述符,定位命令调用。
- 如权利要求9所述的装置,其特征在于,定位模块被配置成:定位与密码算法和/或协议使用相关的命令调用。
- 如权利要求10所述的装置,其特征在于,所述监控模块被附加到Dalvik虚拟机的Zygote进程上,由此来监控所述命令调用并获取运行时数据。
- 如权利要求11所述的装置,其特征在于,所述运行时数据是与密码算法和/或协议使用相关的参数。
- 如权利要求12所述的装置,其特征在于,所述定位模块在应用程序的二进制代码中定位其命令调用。
- 如权利要求13所述的装置,其特征在于,所述命令调用是方法调用或者指令调用。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310598510.9A CN104657259B (zh) | 2013-11-22 | 2013-11-22 | 一种测试Android应用程序的方法和装置 |
| CN201310598510.9 | 2013-11-22 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2015074489A1 true WO2015074489A1 (zh) | 2015-05-28 |
Family
ID=53178917
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2014/090259 Ceased WO2015074489A1 (zh) | 2013-11-22 | 2014-11-04 | 一种测试Android应用程序的方法和装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN104657259B (zh) |
| WO (1) | WO2015074489A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106911537A (zh) * | 2017-04-19 | 2017-06-30 | 深圳天珑无线科技有限公司 | 信息采集方法和信息采集装置 |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105740701A (zh) * | 2016-02-01 | 2016-07-06 | 中国人民大学 | 一种Android平台应用执行环境重构方法及装置 |
| CN107704393B (zh) * | 2017-09-29 | 2018-08-21 | 武汉斗鱼网络科技有限公司 | 数据测试方法、装置及电子设备 |
| CN108133229B (zh) * | 2017-12-11 | 2021-08-06 | 广州能量盒子科技有限公司 | 一种安卓apk文件的分类加密方法及系统 |
| CN109086200B (zh) * | 2018-07-13 | 2020-04-14 | 南京大学 | 一种基于安卓虚拟机修改的有效测试框架 |
| CN113032183A (zh) * | 2021-03-24 | 2021-06-25 | 西安闻泰信息技术有限公司 | 系统管理方法、装置、计算机设备和存储介质 |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120151269A1 (en) * | 2010-12-10 | 2012-06-14 | Helix Technology Inc. | Mobile communication terminal capable of testing application and method thereof |
| CN102810143A (zh) * | 2012-04-28 | 2012-12-05 | 天津大学 | 基于Android平台手机应用程序的安全检测系统及方法 |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7296190B2 (en) * | 2003-01-29 | 2007-11-13 | Sun Microsystems, Inc. | Parallel text execution on low-end emulators and devices |
| CN102521118B (zh) * | 2011-11-11 | 2014-12-10 | 福建星网视易信息系统有限公司 | 一种Android程序的自动测试方法 |
-
2013
- 2013-11-22 CN CN201310598510.9A patent/CN104657259B/zh active Active
-
2014
- 2014-11-04 WO PCT/CN2014/090259 patent/WO2015074489A1/zh not_active Ceased
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120151269A1 (en) * | 2010-12-10 | 2012-06-14 | Helix Technology Inc. | Mobile communication terminal capable of testing application and method thereof |
| CN102810143A (zh) * | 2012-04-28 | 2012-12-05 | 天津大学 | 基于Android平台手机应用程序的安全检测系统及方法 |
Non-Patent Citations (1)
| Title |
|---|
| BU, ZHE ET AL.: "A Behavior Analysis Method to Android Mobile Application Software", NETINFO SECURITY, 31 December 2012 (2012-12-31), pages 33 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106911537A (zh) * | 2017-04-19 | 2017-06-30 | 深圳天珑无线科技有限公司 | 信息采集方法和信息采集装置 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104657259B (zh) | 2018-05-18 |
| CN104657259A (zh) | 2015-05-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Oliinyk et al. | Fuzzing {BusyBox}: Leveraging {LLM} and crash reuse for embedded bug unearthing | |
| Lu et al. | DeepAutoD: Research on distributed machine learning oriented scalable mobile communication security unpacking system | |
| Yang et al. | Kernelgpt: Enhanced kernel fuzzing via large language models | |
| US7818721B2 (en) | Dynamic application tracing in virtual machine environments | |
| WO2015074489A1 (zh) | 一种测试Android应用程序的方法和装置 | |
| Chen et al. | Syzgen: Automated generation of syscall specification of closed-source macos drivers | |
| CN114021142A (zh) | 一种安卓应用程序漏洞检测方法 | |
| TWI541669B (zh) | Detection systems and methods for static detection applications, and computer program products | |
| Zhang et al. | IntPatch: Automatically fix integer-overflow-to-buffer-overflow vulnerability at compile-time | |
| US12111749B2 (en) | Debugger script embedded in debuggable program source code | |
| CN108595953A (zh) | 对手机应用进行风险评估的方法 | |
| Lim et al. | An Android Application Protection Scheme against Dynamic Reverse Engineering Attacks. | |
| Arzt et al. | The soot-based toolchain for analyzing android apps | |
| CN109614107B (zh) | 一种软件开发工具包的集成方法和装置 | |
| CN109635568B (zh) | 一种基于静态分析和模糊测试相结合的并发漏洞检测方法 | |
| Huang et al. | Code coverage measurement for android dynamic analysis tools | |
| CN113836023A (zh) | 一种基于体系结构交叉检查的编译器安全性测试方法 | |
| CN109977671B (zh) | 一种基于编译器修改的Android锁屏型勒索软件检测方法 | |
| Dong et al. | What did you pack in my app? a systematic analysis of commercial android packers | |
| US20180121660A1 (en) | Apparatus and method for dynamic binary analysis on hardware board | |
| WO2015067170A1 (zh) | 一种分析Android应用程序的方法和系统 | |
| Mitchell et al. | Systematic audit of third-party android phones | |
| Hamlen et al. | Aspect-oriented runtime monitor certification | |
| CN107341403B (zh) | 一种文件转换方法和装置 | |
| CN108415836B (zh) | 利用应用程序检测计算机系统性能变化的方法和系统 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14864745 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 29/07/2016) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 14864745 Country of ref document: EP Kind code of ref document: A1 |