Nothing Special   »   [go: up one dir, main page]

CN104239797B - Active defense method and device - Google Patents

Active defense method and device Download PDF

Info

Publication number
CN104239797B
CN104239797B CN201410539274.8A CN201410539274A CN104239797B CN 104239797 B CN104239797 B CN 104239797B CN 201410539274 A CN201410539274 A CN 201410539274A CN 104239797 B CN104239797 B CN 104239797B
Authority
CN
China
Prior art keywords
target application
application
event behavior
active defense
monitoring unit
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.)
Active
Application number
CN201410539274.8A
Other languages
Chinese (zh)
Other versions
CN104239797A (en
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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410539274.8A priority Critical patent/CN104239797B/en
Publication of CN104239797A publication Critical patent/CN104239797A/en
Application granted granted Critical
Publication of CN104239797B publication Critical patent/CN104239797B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities

Landscapes

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

Abstract

本发明提供了一种主动防御方法和装置,包括如下步骤:响应运行目标应用的指令,运行相应的外壳应用;利用外壳应用先后加载监控单元及所述目标应用,由该监控单元对该目标应用的事件行为进行监控捕获;特定事件行为被捕获后,获取事件行为处理策略,依据所述处理策略对该特定事件行为进行处理。本发明提出的主动防御方案,对现有系统的改动很小,不会影响系统的兼容性,而且实现简单、高效。

The present invention provides an active defense method and device, comprising the following steps: responding to an instruction to run a target application, running a corresponding shell application; using the shell application to load a monitoring unit and the target application successively, and the monitoring unit applies the target application The event behavior is monitored and captured; after the specific event behavior is captured, the event behavior processing strategy is obtained, and the specific event behavior is processed according to the processing strategy. The active defense scheme proposed by the invention requires little modification to the existing system, does not affect the compatibility of the system, and is simple and efficient to implement.

Description

主动防御方法及装置Active defense method and device

技术领域technical field

本发明涉及计算机安全领域,具体而言,本发明涉及一种主动防御方法,相应还涉及一种主动防御装置。The present invention relates to the field of computer security, specifically, the present invention relates to an active defense method, and correspondingly also relates to an active defense device.

背景技术Background technique

Unix系的操作系统,以Android为典型代表,广泛应用于各种移动通信终端中。Android具有相对较为严格的用户权限管理机制,默认状态下,用户的权限较低。要突破权限限制,需要将系统的权限提高到最高级别,也即进行ROOT授权。获得最高权限后,用户便可对第三方应用的恶意行为进行拦截,对消耗系统资源的设置项进行修改,因此,多数情况下,市面上的安全软件需要在已经获得ROOT授权的Android移动终端上工作,才能达到其最优效果。但是,一般用户并不掌握较高的专业知识,未必能对其终端进行ROOT授权,即使进行了ROOT授权,在为安全软件开放更高权限的同时,也给了恶意程序以可乘之机。更为矛盾的是,在非ROOT条件下,一部分恶意程序能工作,而传统的安全防御软件却会失去绝对优势。因此,在非ROOT条件下解决Android、Ubuntu等类似系统的安全防御需求,是业内一直以来的努力方向。Unix-based operating systems, typically represented by Android, are widely used in various mobile communication terminals. Android has a relatively strict user rights management mechanism. By default, users have low rights. To break through the authority restriction, the authority of the system needs to be raised to the highest level, that is, ROOT authorization. After obtaining the highest authority, the user can intercept the malicious behavior of the third-party application and modify the setting items that consume system resources. Therefore, in most cases, the security software on the market needs to be installed on the Android mobile terminal that has obtained ROOT authorization. work to achieve its optimum effect. However, general users do not have high professional knowledge, and may not be able to perform ROOT authorization on their terminals. Even if ROOT authorization is performed, while opening higher permissions for security software, it also gives malicious programs an opportunity to take advantage of. What is even more paradoxical is that some malicious programs can work under non-ROOT conditions, but traditional security defense software will lose its absolute advantage. Therefore, solving the security defense requirements of Android, Ubuntu and other similar systems under non-ROOT conditions has been the direction of the industry's efforts.

主动防御技术是满足上述需求的较佳解决方案。主动防御是基于程序事件行为自主分析判断的实时防护技术,不以病毒的特征码作为判断病毒的依据,而是从最原始的病毒定义出发,直接将程序的行为作为判断病毒的依据。主动防御是用软件自动实现了反病毒工程师分析判断病毒的过程,解决了传统安全软件无法防御未知恶意软件的弊端,从技术上实现了对木马和病毒的主动防御。Active defense technology is a better solution to meet the above requirements. Active defense is a real-time protection technology based on the independent analysis and judgment of program event behavior. It does not use the virus signature as the basis for judging the virus, but starts from the most original virus definition, and directly uses the behavior of the program as the basis for judging the virus. Active defense is to use software to automatically realize the process of anti-virus engineers analyzing and judging viruses, which solves the disadvantage that traditional security software cannot defend against unknown malware, and technically realizes active defense against Trojan horses and viruses.

请参阅2014年9月3日公开、公开号为CN104023122A的专利申请,其请求保护一种安全防御方法及装置。该方案的基本思路是通过下载预先定制的待注入应用程序来替换当前终端的相应的应用程序,并且在系统重启后优先启动该待注入应用程序,从而实现主动防御。该思路主要是为了解决如何构建安全防御机制的问题,而其中所涉的待注入应用程序是由当前终端的应用程序进行反编译、修改代码和重新封装后生成的,也就是采用了二次打包技术。本领域技术人员可以理解,这种依赖于对应用程序进行全面的二次打包实现的行为监控方式存在不足,表现在如下几个方面:Please refer to the patent application published on September 3, 2014 with publication number CN104023122A, which requests protection of a security defense method and device. The basic idea of this solution is to replace the corresponding application program on the current terminal by downloading a pre-customized application program to be injected, and to start the application program to be injected first after the system is restarted, so as to realize active defense. This idea is mainly to solve the problem of how to build a security defense mechanism, and the application to be injected is generated by decompiling, modifying the code and repackaging the current terminal application, that is, using secondary packaging technology. Those skilled in the art can understand that there are deficiencies in this behavior monitoring method that relies on comprehensive secondary packaging of the application program, which is manifested in the following aspects:

首先,安装失败率高。事实上,越来越多的应用程序已经具备防止二次打包的免疫力,如果应用程序已经做好了防止二次打包的免疫设置,那么,强行向目标应用程序注入监控代码,会导致该目标应用不能安装,或者安装后出现异常崩溃,建构主动防御环境的成功率较低。First, the installation failure rate is high. In fact, more and more applications already have the immunity to prevent secondary packaging. If the application has already made immune settings to prevent secondary packaging, then forcibly injecting monitoring code into the target application will cause the target If the application cannot be installed, or crashes abnormally after installation, the success rate of constructing an active defense environment is low.

其次,存在监控不全面的先天不足。挂钩函数构成应用程序的一部分,恶意程序可以利用JAVA反射机制中的反射调用、JNI本地调用(Native)等技术来逃避这一防御机制。Secondly, there is an inherent deficiency of incomplete monitoring. The hook function constitutes a part of the application program, and malicious programs can use technologies such as reflection calls in the JAVA reflection mechanism and JNI native calls (Native) to evade this defense mechanism.

此外,监控精细程度不高。二次打包后的应用程序,其监控对象往往局限于应用程序本身,难以具体到精细行为,难以对诸如短信操作、联系人接入或删除操作、URL访问操作、衍生物操作、安装操作、子进程侵入等具体行为做出精细的监控。In addition, the degree of granularity of monitoring is not high. After secondary packaging, the monitoring object is often limited to the application itself, and it is difficult to specify fine behaviors, such as SMS operations, contact access or deletion operations, URL access operations, derivative operations, installation operations, child operations, etc. Detailed monitoring of specific behaviors such as process intrusion.

综合以上的分析可知,业内关于主动防御技术的研究,仍有较大的提升空间。Based on the above analysis, it can be seen that there is still a lot of room for improvement in the research on active defense technology in the industry.

发明内容Contents of the invention

本发明的首要目的在于,在免ROOT条件下实现更为高效的主动安全防御,从而提供一种主动防御方法。The primary purpose of the present invention is to realize more efficient active security defense under the ROOT-free condition, thereby providing an active defense method.

本发明的另一目的在于配合首要目的而提供一种主动防御装置。Another object of the present invention is to provide an active defense device in conjunction with the primary object.

为实现本发明的上述目的,本发明提供如下技术方案:In order to realize the above-mentioned purpose of the present invention, the present invention provides following technical scheme:

本发明提供的一种主动防御方法其包括如下步骤:A kind of active defense method provided by the present invention comprises the following steps:

响应运行目标应用的指令,运行相应的外壳应用;Responding to an instruction to run a target application, run a corresponding shell application;

利用外壳应用先后加载监控单元及所述目标应用,由该监控单元对该目标应用的事件行为进行监控捕获;The monitoring unit and the target application are successively loaded by the shell application, and the monitoring unit monitors and captures the event behavior of the target application;

特定事件行为被捕获后,获取事件行为处理策略,依据所述处理策略对该特定事件行为进行处理。After the specific event behavior is captured, an event behavior processing strategy is obtained, and the specific event behavior is processed according to the processing strategy.

此外,包括如下前置步骤:在图形用户界面中提供快捷方式用于获取所述运行目标应用的指令,该快捷方式的图标由目标应用默认图标修改而得。In addition, the following pre-step is included: a shortcut is provided in the graphical user interface for acquiring the instruction for running the target application, and the icon of the shortcut is modified from a default icon of the target application.

具体的,所述监控单元调用挂钩插件,在运行时挂钩所述目标应用进程所直接或间接触发的特定事件,以实现对所述目标应用的监控。Specifically, the monitoring unit invokes a hook plug-in to hook a specific event directly or indirectly triggered by the target application process at runtime, so as to monitor the target application.

具体的,所述监控单元从远程插件接口获得对应于特定事件行为的所述挂钩插件。Specifically, the monitoring unit obtains the hook plug-in corresponding to a specific event behavior from a remote plug-in interface.

具体的,监控单元监控目标应用进程触发的事件行为,当监控单元监控到目标应用进程触发释放子进程的事件行为时,为该子进程加载监控单元,以继续监控该子进程所触发的事件行为。Specifically, the monitoring unit monitors the event behavior triggered by the target application process, and when the monitoring unit monitors the event behavior triggered by the target application process to release the sub-process, the monitoring unit is loaded for the sub-process to continue monitoring the event behavior triggered by the sub-process .

具体的,所述监控单元通过在目标应用的子进程中注入内联钩子实现挂钩。Specifically, the monitoring unit realizes the hooking by injecting an inline hook into the subprocess of the target application.

较佳的,所述监控模块所监控的事件行为包括以下任意一种或多种行为类型:获取运营商信息、APN操作、通知栏广告操作、获取手机识别码操作、创建快捷方式、电话拔打操作、短信插入或删除操作、联系人插入或删除操作、URL访问操作、子进程侵入操作、应用加载操作、命令操作、衍生物操作、激活设备管理器操作。Preferably, the event behavior monitored by the monitoring module includes any one or more of the following behavior types: obtaining operator information, APN operation, notification column advertisement operation, obtaining mobile phone identification code operation, creating shortcuts, making phone calls Operation, text message insertion or deletion operation, contact insertion or deletion operation, URL access operation, sub-process intrusion operation, application loading operation, command operation, derivative operation, activation device manager operation.

进一步,所述监控模块监控到目标应用触发产生衍生物的事件行为时,通过远程规则库接口获取针对该衍生物的处理规则并处理该衍生物。Further, when the monitoring module monitors that the target application triggers the event behavior of generating derivatives, it obtains the processing rules for the derivatives through the remote rule base interface and processes the derivatives.

进一步,该方法包括将预设的交互模块注册为系统服务的步骤,外壳应用通过其内建的交互接口与该交互模块通信,借助该交互模块向用户界面弹窗实现人机交互。Further, the method includes the step of registering a preset interactive module as a system service, the shell application communicates with the interactive module through its built-in interactive interface, and realizes human-computer interaction by popping a window to the user interface through the interactive module.

具体的,所述外壳应用采用JAVA反射调用的方式动态加载所述目标应用。Specifically, the shell application dynamically loads the target application in a JAVA reflective calling manner.

进一步,捕获事件行为后,以如下任意方式至少之一获取针对该事件行为的所述处理策略:Further, after the event behavior is captured, the processing strategy for the event behavior is acquired in at least one of the following ways:

向用户界面弹窗告警,接收用户指令以获得所述的处理策略;Alerting the user interface with a pop-up window, receiving user instructions to obtain the processing strategy;

从本地策略数据库中检索获得对应的处理策略;Retrieving the corresponding processing policy from the local policy database;

通过远程策略接口向云端发送请求并获得对应反馈的处理策略。Send a request to the cloud through the remote policy interface and obtain the corresponding feedback processing policy.

此外,还包括如下步骤:下载云端策略数据库并更新本地策略数据库,该本地策略数据库用于提供对应于具体目标应用的特定事件行为的处理策略。In addition, the following steps are further included: downloading the cloud policy database and updating the local policy database, the local policy database is used to provide a processing policy corresponding to a specific event behavior of a specific target application.

本发明提供的一种主动防御装置,其包括:A kind of active defense device provided by the present invention, it comprises:

启动模块,用于响应运行目标应用的指令,运行相应的外壳应用;A startup module, configured to run a corresponding shell application in response to an instruction to run the target application;

安防模块,其利用外壳应用先后加载监控单元及所述目标应用,由该监控单元对该目标应用的事件行为进行监控捕获;A security module, which utilizes the shell application to successively load the monitoring unit and the target application, and the monitoring unit monitors and captures the event behavior of the target application;

处理模块,用于在特定事件行为被捕获后,获取事件行为处理策略,依据所述处理策略对该特定事件行为进行处理。The processing module is configured to obtain an event behavior processing strategy after the specific event behavior is captured, and process the specific event behavior according to the processing strategy.

进一步,还包括:Further, it also includes:

快捷方式,其置于图形用户界面中,用于获取所述运行目标应用的指令,该快捷方式的图标由目标应用默认图标修改而得。A shortcut, which is placed in the graphical user interface, is used to obtain the instruction for running the target application, and the icon of the shortcut is modified from the default icon of the target application.

具体的,所述监控单元调用挂钩插件,用于在运行时挂钩所述目标应用进程所直接或间接触发的特定事件,以实现对所述目标应用的监控。Specifically, the monitoring unit invokes a hook plug-in for hooking a specific event directly or indirectly triggered by the target application process at runtime, so as to monitor the target application.

具体的,所述监控单元从远程插件接口获得对应于特定事件行为的所述挂钩插件。Specifically, the monitoring unit obtains the hook plug-in corresponding to a specific event behavior from a remote plug-in interface.

进一步,监控单元监控目标应用进程触发的事件行为,当监控单元监控到目标应用进程触发释放子进程的事件行为时,为该子进程加载监控单元,以继续监控该子进程所触发的事件行为。Further, the monitoring unit monitors the event behavior triggered by the target application process, and when the monitoring unit monitors the event behavior triggered by the target application process to release the sub-process, loads the monitoring unit for the sub-process to continue monitoring the event behavior triggered by the sub-process.

具体的,所述监控单元通过在目标应用的子进程中注入内联钩子实现挂钩。Specifically, the monitoring unit realizes the hooking by injecting an inline hook into the subprocess of the target application.

较佳的,所述监控模块所监控的事件行为包括以下任意一种或多种行为类型:获取运营商信息、APN操作、通知栏广告操作、获取手机识别码操作、创建快捷方式、电话拔打操作、短信插入或删除操作、联系人插入或删除操作、URL访问操作、子进程侵入操作、应用加载操作、命令操作、衍生物操作、激活设备管理器操作。Preferably, the event behavior monitored by the monitoring module includes any one or more of the following behavior types: obtaining operator information, APN operation, notification column advertisement operation, obtaining mobile phone identification code operation, creating shortcuts, making phone calls Operation, text message insertion or deletion operation, contact insertion or deletion operation, URL access operation, sub-process intrusion operation, application loading operation, command operation, derivative operation, activation device manager operation.

进一步,所述监控模块监控到目标应用触发产生衍生物的事件行为时,通过远程规则库接口获取针对该衍生物的处理规则并处理该衍生物。Further, when the monitoring module monitors that the target application triggers the event behavior of generating derivatives, it obtains the processing rules for the derivatives through the remote rule base interface and processes the derivatives.

此外,该装置包括交互模块,被注册为系统服务,外壳应用通过其内建的交互接口与该交互模块通信,借助该交互模块向用户界面弹窗实现人机交互。In addition, the device includes an interaction module, which is registered as a system service, and the shell application communicates with the interaction module through its built-in interaction interface, and realizes human-computer interaction by popping a window to the user interface through the interaction module.

进一步,所述安防模块包括配置模块,用于通过JAVA反射调用的方式动态加载所述目标应用。Further, the security module includes a configuration module, configured to dynamically load the target application through JAVA reflective calling.

此外,针对事件行为的所述处理策略由如下策略生成装置之一提供:In addition, said processing policy for event behavior is provided by one of the following policy generating means:

用于向用户界面弹窗告警,接收用户指令以获得所述的处理策略;It is used to alert the user interface with a pop-up window, and receive user instructions to obtain the processing strategy;

用于从本地策略数据库中检索获得对应的处理策略;Used to retrieve the corresponding processing policy from the local policy database;

用于通过远程策略接口向云端发送请求并获得对应反馈的处理策略。The processing strategy used to send requests to the cloud through the remote strategy interface and obtain corresponding feedback.

进一步该装置还包括:Further this device also includes:

更新模块,用于下载云端策略数据库并更新本地策略数据库,该本地策略数据库用于检索对应于具体目标应用的特定事件行为的处理策略。The update module is used to download the cloud policy database and update the local policy database, and the local policy database is used to retrieve the processing policy corresponding to the specific event behavior of the specific target application.

相较于现有技术,本发明至少具有如下优点:Compared with the prior art, the present invention has at least the following advantages:

1、真正实现了动态主动防御。本发明以目标应用为基本单位提出建构其主动防御环境的解决方案,可以通过在实时监测目标应用被安装后,或者通过识别用户对需要建立主动防御机制的目标程序的选定后,根据目标应用构造一个伪装成目标应用的外壳应用,再由该外壳应用去加载监控单元和真正的目标应用,为目标应用程序及时动态建立防御机制,后续可借助这一外壳应用的运行实现主动防御。这一过程不需要对系统进行ROOT授权,不依赖于联网条件,更不依赖于以特征码为基础的病毒库,因此而真正实现了对目标应用程序的主动防御。1. Realized dynamic active defense. The present invention proposes a solution for constructing an active defense environment with the target application as the basic unit. After the target application is installed in real time, or by identifying the user's selection of the target program that needs to establish an active defense mechanism, the target application Construct a shell application disguised as the target application, and then load the monitoring unit and the real target application by the shell application, and establish a defense mechanism for the target application in a timely and dynamic manner, and then use the operation of this shell application to implement active defense. This process does not require ROOT authorization for the system, does not depend on network conditions, and does not depend on signature-based virus databases, so it truly realizes active defense against target applications.

2、所建立的主动防御机制安全有效。如前所述,本发明构造所述外壳应用时,是根据目标应用的安装包进行构造的,而目标应用的安装包本身被安全保存。由此,本发明一方面由于未改变待运行的目标应用的代码和配置,因而目标应用能够满足自校验要求,而外壳应用被视为所述的目标应用而合法存在;另一方面,即使带有恶意的目标应用企图利用JAVA反射机制避开检测,也难以逃脱监控单元的观察;再一方面还可以通过监控单元实现对真正的目标程序的事件行为的监控,以类似观察者的身份全面监视目标应用的一切事件行为,对各种特定事件行为及时做出响应,突破JVM局限,可以实现对Java函数、JNI函数、系统函数调用的监控,显然较为全面。2. The established active defense mechanism is safe and effective. As mentioned above, when the present invention constructs the shell application, it is constructed according to the installation package of the target application, and the installation package of the target application itself is safely stored. Thus, on the one hand, the present invention does not change the code and configuration of the target application to be run, so the target application can meet the self-verification requirements, and the shell application is regarded as the target application and exists legally; on the other hand, even Malicious target applications try to use the JAVA reflection mechanism to avoid detection, and it is difficult to escape the observation of the monitoring unit; on the other hand, the monitoring unit can also monitor the event behavior of the real target program, and use the identity of an observer to comprehensively Monitor all event behaviors of the target application, respond to various specific event behaviors in a timely manner, break through the limitations of the JVM, and monitor Java functions, JNI functions, and system function calls, which is obviously more comprehensive.

3、实现对目标应用的精细监控。由于监控单元可以监控目标应用的一切事件行为,对各种函数调用均可无障碍地实施监控,因此,具体到应用层面,本发明不仅可以实现对包括电话、短信、联系人等常规应用的具体操作行为的监控,也可以实现诸如衍生物(安装包)、提权命令、应用加载等高端事件行为的监控,其监控效果更为全面、具体、有效。3. Realize fine monitoring of the target application. Since the monitoring unit can monitor all event behaviors of the target application, and monitor various function calls without hindrance, the present invention can not only realize the concrete monitoring of conventional applications including telephone calls, short messages, contacts, etc. The monitoring of operation behavior can also realize the monitoring of high-end event behaviors such as derivatives (installation packages), privilege escalation commands, application loading, etc., and its monitoring effect is more comprehensive, specific and effective.

结合上述的分析可知,本发明提出的上述方案,对现有系统的改动很小,不会影响系统的兼容性,而且实现简单、高效。In combination with the above analysis, it can be seen that the above solution proposed by the present invention has little modification to the existing system, does not affect the compatibility of the system, and is simple and efficient to implement.

本发明附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本发明的实践了解到。Additional aspects and advantages of the invention will be set forth in part in the description which follows, and will become apparent from the description, or may be learned by practice of the invention.

附图说明Description of drawings

本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present invention will become apparent and easy to understand from the following description of the embodiments in conjunction with the accompanying drawings, wherein:

图1为本发明一种免ROOT主动防御配置方法的典型实施例的原理示意图;Fig. 1 is a schematic diagram of the principle of a typical embodiment of a ROOT-free active defense configuration method of the present invention;

图2为本发明的免ROOT主动防御配置方法中将安装原包配置成外壳应用的过程的原理示意图;Fig. 2 is a schematic diagram of the principle of the process of configuring the installation original package into a shell application in the ROOT-free active defense configuration method of the present invention;

图3为本发明一种免ROOT主动防御配置装置的结构示意图;3 is a schematic structural diagram of a ROOT-free active defense configuration device of the present invention;

图4为本发明一种主动防御方法的典型实施例的原理示意图;FIG. 4 is a schematic diagram of a typical embodiment of an active defense method of the present invention;

图5为本发明的主动防御方法中利用外壳应用的运行对目标应用的事件行为进行监控的原理示意图;5 is a schematic diagram of the principle of monitoring the event behavior of the target application by using the operation of the shell application in the active defense method of the present invention;

图6为本发明的主动防御方法中对捕获的事件进行处理的原理示意图;6 is a schematic diagram of the principle of processing captured events in the active defense method of the present invention;

图7为本发明一种主动防御装置的结构示意图;Fig. 7 is a schematic structural view of an active defense device of the present invention;

图8为根据本发明实现的一个程序实例的用户界面之一,用于展示发现未防御应用之后的弹框交互功能;Fig. 8 is one of the user interfaces of a program example implemented according to the present invention, which is used to display the bullet box interaction function after the undefended application is found;

图9为根据本发明实现的一个程序实例的用户界面之一,用于展示扫描到的应用程序列表,并向用户提供用于确定目标应用的选择区域;9 is one of the user interfaces of a program example implemented according to the present invention, which is used to display a list of scanned applications and provide the user with a selection area for determining the target application;

图10为根据本发明实现的一个程序实例的用户界面之一,用于展示单个应用所有事件行为的默认处理策略,并提供给用户对处理策略进行修改的选项;Fig. 10 is one of the user interfaces of a program example implemented according to the present invention, which is used to display the default processing strategy of all event behaviors of a single application, and provides the user with the option to modify the processing strategy;

图11为根据本发明实现的一个程序实例的用户界面之一,用于展示进行事件行为拦截后的人机交互效果,具体是拦截发送短信的事件行为;Figure 11 is one of the user interfaces of a program example implemented according to the present invention, which is used to show the human-computer interaction effect after event behavior interception, specifically intercepting the event behavior of sending short messages;

图12为根据本发明实现的一个程序实例的用户界面之一,用于展示进行事件行为拦截后的人机交互效果,具体是拦截插入短信的事件行为。Fig. 12 is one of the user interfaces of a program example implemented according to the present invention, which is used to display the human-computer interaction effect after event behavior interception, specifically intercepting the event behavior of inserting short messages.

具体实施方式detailed description

下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。Embodiments of the present invention are described in detail below, examples of which are shown in the drawings, wherein the same or similar reference numerals designate the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the figures are exemplary only for explaining the present invention and should not be construed as limiting the present invention.

本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本发明的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。Those skilled in the art will understand that unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the word "comprising" used in the description of the present invention refers to the presence of said features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Additionally, "connected" or "coupled" as used herein may include wireless connection or wireless coupling. The expression "and/or" used herein includes all or any elements and all combinations of one or more associated listed items.

本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本发明所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which this invention belongs. It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have meanings consistent with their meaning in the context of the prior art, and unless specifically defined as herein, are not intended to be idealized or overly Formal meaning to explain.

本技术领域技术人员可以理解,这里所使用的“终端”、“终端设备”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,执行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“终端”、“终端设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“终端”、“终端设备”还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。Those skilled in the art can understand that the "terminal" and "terminal equipment" used here not only include wireless signal receiver equipment, which only has wireless signal receiver equipment without transmission capabilities, but also include receiving and transmitting hardware. A device having receiving and transmitting hardware capable of performing bi-directional communication over a bi-directional communication link. Such equipment may include: cellular or other communication equipment, which has a single-line display or a multi-line display or a cellular or other communication equipment without a multi-line display; PCS (Personal Communications Service, personal communication system), which can combine voice, data Processing, facsimile and/or data communication capabilities; PDA (Personal Digital Assistant, Personal Digital Assistant), which may include radio frequency receiver, pager, Internet/Intranet access, web browser, notepad, calendar and/or GPS (Global Positioning System (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal", "terminal device" may be portable, transportable, installed in a vehicle (air, sea, and/or land), or adapted and/or configured to operate locally, and/or In distributed form, the operation operates at any other location on Earth and/or in space. The "terminal" and "terminal equipment" used here can also be communication terminals, Internet terminals, music/video playback terminals, such as PDAs, MIDs (Mobile Internet Devices, mobile Internet devices) and/or with music/video playback terminals. Functional mobile phones, smart TVs, set-top boxes and other devices.

本技术领域技术人员可以理解,这里所使用的远端网络设备,其包括但不限于计算机、网络主机、单个网络服务器、多个网络服务器集或多个服务器构成的云。在此,云由基于云计算(Cloud Computing)的大量计算机或网络服务器构成,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。本发明的实施例中,远端网络设备、终端设备与WNS服务器之间可通过任何通信方式实现通信,包括但不限于,基于3GPP、LTE、WIMAX的移动通信、基于TCP/IP、UDP协议的计算机网络通信以及基于蓝牙、红外传输标准的近距无线传输方式。Those skilled in the art can understand that the remote network device used here includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud formed by multiple servers. Here, the cloud is composed of a large number of computers or network servers based on cloud computing (Cloud Computing), wherein cloud computing is a kind of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets. In the embodiment of the present invention, the communication between the remote network equipment, the terminal equipment and the WNS server can be realized through any communication method, including but not limited to, mobile communication based on 3GPP, LTE, WIMAX, based on TCP/IP, UDP protocol Computer network communication and short-distance wireless transmission methods based on Bluetooth and infrared transmission standards.

本领域技术人员应当理解,本发明所称的“应用”、“应用程序”、“应用软件”以及类似表述的概念,是业内技术人员所公知的相同概念,是指由一系列计算机指令及相关数据资源有机构造的适于电子运行的计算机软件。除非特别指定,这种命名本身不受编程语言种类、级别,也不受其赖以运行的操作系统或平台所限制。理所当然地,此类概念也不受任何形式的终端所限制。同理,本发明所称的“目标应用”、“安装包”之间存在对应关系,安装包为目标应用的文件存在形式。Those skilled in the art should understand that the concepts of "application", "application program", "application software" and similar expressions referred to in the present invention are the same concepts well known to those skilled in the art, and refer to a series of computer instructions and related Computer software that is organically constructed from data resources and suitable for electronic operation. Unless otherwise specified, this naming itself is not limited by the type of programming language, level, or the operating system or platform on which it runs. Naturally, such concepts are also not limited by any form of terminal. Similarly, there is a corresponding relationship between the "target application" and "installation package" mentioned in the present invention, and the installation package is the file existence form of the target application.

本发明的一种免ROOT主动防御配置方法,主要用于为操作系统构建应用程序的安全防御环境,以便在不影响应用程序的正常操作的前提下,实现主动防御。为此本发明将提供一典型实施例用于说明该方法的基本实现。相应的,应用了上述免ROOT主动防御配置方法的应用程序,其利用所述配置方法的机理进行工作,也包含一种与前者相应的主动防御方法。为便于说明,以下将以Unix系的Android操作系统及其应用程序为例,详细说明上述两种方法以及其相应装置的具体实现。The ROOT-free active defense configuration method of the present invention is mainly used to construct a security defense environment for application programs for the operating system, so as to realize active defense without affecting the normal operation of the application programs. Therefore, the present invention will provide a typical embodiment to illustrate the basic realization of the method. Correspondingly, the application program applying the above-mentioned ROOT-free active defense configuration method uses the mechanism of the configuration method to work, and also includes a corresponding active defense method to the former. For the convenience of description, the following will take the Unix-based Android operating system and its application program as an example to describe the implementation of the above two methods and their corresponding devices in detail.

本发明的方法所应用的环境包括可与远程服务器或云端通信的移动终端,该移动终端安装有Android操作系统,该系统处于未经ROOT授权的状态。需要指出的是,即使该操作系统处于ROOT授权后的状态,本发明所述的各种方法也依然适用于该操作系统中。也就是说,本发明各种方法的实现,不受操作系统是否开放最高权限所限制。The environment to which the method of the present invention is applied includes a mobile terminal capable of communicating with a remote server or a cloud, the mobile terminal is installed with an Android operating system, and the system is in a state without ROOT authorization. It should be pointed out that even if the operating system is in a ROOT authorized state, the various methods described in the present invention are still applicable to the operating system. That is to say, the implementation of various methods of the present invention is not limited by whether the operating system opens the highest authority.

请参阅图1的原理示意图,该图揭示了所述免ROOT主动防御配置方法的典型实施例,包括如下几大步骤:Please refer to the schematic diagram of Figure 1, which discloses a typical embodiment of the ROOT-free active defense configuration method, including the following major steps:

S11、确定目标应用,保存其安装包至指定目录。S11. Determine the target application, and save its installation package to a designated directory.

所述的目标应用,即需要建构主动防御环境的目标应用程序,就特定的处于非ROOT授权环境下的Android系统而言,出于权限限制的考虑,一般适用于第三方应用。The target application described above, that is, the target application program that needs to construct an active defense environment, is generally applicable to third-party applications for the specific Android system in a non-ROOT authorized environment due to permission restrictions.

本发明所称的指定目录,是指本发明出于文件组织、管理效率的考虑而为这些需要建构主动防御环境而提供的自定义默认目录,所有通过本发明建立了主动防御环境的目标应用的安装包,均可被移动或复制保存到该指定目录中,进一步还可以对其进行加密或隐藏,以确保其安全性。需要指出的是,这里的指定目录,还可以是系统已经存在的目录。既可以是单个目录,也可以是多个目录。概括而言,是为本发明所采用的用于存放由本发明建构主动防御环境的目标应用安装包的目录。The designated directory referred to in the present invention refers to the self-defined default directory provided by the present invention for the purpose of constructing an active defense environment for these needs in consideration of file organization and management efficiency, and all target applications that have established an active defense environment through the present invention The installation package can be moved or copied and saved to the specified directory, and it can be encrypted or hidden further to ensure its security. It should be pointed out that the specified directory here may also be a directory that already exists in the system. It can be either a single directory or multiple directories. In a nutshell, it is the directory used by the present invention for storing the target application installation package constructed by the present invention to construct the active defense environment.

目标应用的确定和处理,非常灵活,以下提供几种确定目标应用和后续处理的实施方式:The determination and processing of the target application is very flexible. The following provides several implementation methods for determining the target application and subsequent processing:

方式一:method one:

对于已经完成安装的应用程序而言,本发明可以自动或受用户指令控制对这些已安装应用程序进行扫描,获得这些应用程序的安装信息,将这些应用程序作为候选目标应用列表显示在用户界面中(参阅图9),在图形用户界面的相应指示区域中为列表中的每个候选目标应用提供相对应的选择开关,由用户对这些开关状态进行设定,从而获得用户对具体目标应用的确定。具体而言,用户可以将某个目标应用所对应的指示区域中的选择开关,从未选定状态切换至选定状态,如图9中的“已监控”、“点击监控”二态开关示例,这种情况下,即可视为用户完成了对该目标应用的确定操作。For the application programs that have been installed, the present invention can automatically or be controlled by user instructions to scan these installed application programs, obtain the installation information of these application programs, and display these application programs as a list of candidate target applications in the user interface (Refer to FIG. 9 ), provide corresponding selection switches for each candidate target application in the list in the corresponding indication area of the graphical user interface, and set the state of these switches by the user, so as to obtain the determination of the specific target application by the user . Specifically, the user can switch the selection switch in the indication area corresponding to a certain target application from the unselected state to the selected state, as shown in the example of the two-state switch of "monitored" and "click to monitor" in Figure 9 , in this case, it can be considered that the user has completed the determination operation of the target application.

众所周知的,Android系统中,第三方应用的安装会涉及对如下目录做如下操作:data/app,第三方应用安装目录,安装时先把apk文件复制到此目录;data/dalvik-cache,将apk解压后的代码文件(.dex文件)安装到该目录下;data/data,用于建立并存放应用程序所需的数据。基于上述原理可知,第三方应用的apk文件即为其安装包,在data/app中可以找到该安装包。因此,对于已安装的目标应用而言,可以从data/app中复制相应的apk文件到指定目录中,然后卸载该目标应用。As we all know, in the Android system, the installation of third-party applications will involve the following operations on the following directories: data/app, the third-party application installation directory, first copy the apk file to this directory during installation; data/dalvik-cache, copy the apk The decompressed code file (.dex file) is installed in this directory; data/data is used to create and store the data required by the application. Based on the above principles, it can be seen that the apk file of the third-party application is its installation package, which can be found in data/app. Therefore, for an installed target application, the corresponding apk file can be copied from data/app to a specified directory, and then the target application can be uninstalled.

方式二:Method 2:

参阅图8,对于准备或者正在进行安装的应用程序而言,本发明可以通过将自身注册为默认安装器的形式,获取该应用程序的安装广播信息。继而,将这个新装应用程序作为目标应用,将其安装包或签名之类的特征信息通过远程规则库接口发送到云端服务器中,由云端服务器对其做出安全性判断。一种实施例中,云端服务器为应用程序的安全级别设定黑、灰、白三种级别,分别代表不同危险程度,并设定对应的处理规则。例如,黑应用禁止安装,灰应用由用户自行选择,白应用则可径行安装。当然,可以进一步简化为灰、白两种,或者简化为黑、白两种。本领域技术人员熟悉服务器的这种云端控制技术,将在后续进一步概要揭示。无论如何,本发明将从本机远程规则库接口中获得云端服务器有关这些应用的处理规则的反馈,利用反馈结果做出相应的后续处理。具体而言,当针对当前目标应用返回黑应用标识时,可以随即停止该目标应用的安装;当标识为白应用或灰应用时,则可放行安装。出于交互性的考虑,当完成远程判断后,本发明将向用户界面弹窗提醒用户有关判断结果,并显示相应的处理建议,询问用户是否确定对当前新装应用建构主动防御环境,用户从中确定对当前新装目标应用进行主动防御的标识后,即确定了该目标应用。Referring to FIG. 8 , for an application program that is about to be installed or is being installed, the present invention can obtain the installation broadcast information of the application program by registering itself as a default installer. Then, the newly installed application is used as the target application, and the characteristic information such as its installation package or signature is sent to the cloud server through the remote rule base interface, and the cloud server makes a security judgment on it. In one embodiment, the cloud server sets three levels for the security level of the application program: black, gray, and white, respectively representing different risk levels, and sets corresponding processing rules. For example, black apps are prohibited from being installed, gray apps are selected by the user, and white apps can be installed directly. Of course, it can be further simplified into gray and white, or into black and white. Those skilled in the art are familiar with this cloud control technology of the server, which will be further briefly disclosed later. In any case, the present invention will obtain feedback from the cloud server on the processing rules of these applications from the local remote rule base interface, and use the feedback results to make corresponding follow-up processing. Specifically, when a black application identification is returned for the current target application, the installation of the target application can be stopped immediately; when the identification is a white application or a gray application, the installation can be released. For the sake of interactivity, after the remote judgment is completed, the present invention will remind the user of the judgment result in a pop-up window on the user interface, and display corresponding processing suggestions, asking the user whether to confirm the construction of an active defense environment for the current newly installed application, from which the user can determine After the active defense identification is performed on the currently newly installed target application, the target application is determined.

同理,用户确定该目标应用之后,本发明会将该目标应用的安装包存放至所述的指定目录中。另外,出于本发明后续将为该已确定的目标应用建构主动防御环境的考虑,本发明会立即停止该目标应用的安装,停止安装的操作既可以发明在用户确定该目标应用之前也可以发生在之后。Similarly, after the user determines the target application, the present invention will store the installation package of the target application in the specified directory. In addition, considering that the present invention will construct an active defense environment for the determined target application, the present invention will immediately stop the installation of the target application, and the operation of stopping the installation can occur before the user determines the target application. After.

其它变通方式:Other workarounds:

如前提供的两种典型的有关确定目标应用的方式,可由本领域技术人员变通利用。例如,对于方式一中的已安装目标应用而言,可以适用方式二中将已安装应用通过远程规则库接口发送到云端进行安全等级判断,并在返回结果后,参照方式二的处理方式,对已安装应用进行处理。又如,如果当前应用属于黑应用,而用户仍然希望安装该应用,则仍可允许用户在建立主动防御环境的前提下保留该已安装应用程序,或者允许相应的新装应用继续安装。The two typical methods for determining the target application provided above can be utilized by those skilled in the art. For example, for the installed target application in the first method, the installed application can be sent to the cloud through the remote rule base interface in the second method to judge the security level, and after returning the result, refer to the processing method in the second method to The installed app is processed. For another example, if the current application is a black application and the user still wants to install the application, the user may still be allowed to keep the installed application under the premise of establishing an active defense environment, or allow the corresponding newly installed application to continue to be installed.

以上揭示关于确定目标应用的两种典型方式及其变通方式,本领域技术人员足以据此掌握,本发明的主动防御配置方法的首要步骤中涉及如何确定目标应用的多种途径,以及如何获得被确定的目标应用的安装包并将其保存至指定目录中的多种实现方式。The two typical ways of determining the target application and their alternatives disclosed above are enough for those skilled in the art to understand that the first step of the active defense configuration method of the present invention involves multiple ways of determining the target application and how to obtain the target application. A variety of implementations of determining the installation package of the target application and saving it in a specified directory.

S12、利用目标应用的安装包配置外壳应用的安装包。S12. Using the installation package of the target application to configure the installation package of the shell application.

确定需要建构主动防御环境的目标应用后,进一步创建外壳应用。请参阅图2,该外壳应用的创建包括如下具体步骤:After determining the target application that needs to construct an active defense environment, further create a shell application. Please refer to Figure 2, the creation of the shell application includes the following specific steps:

S121、解析目标应用安装包,生成外壳应用镜像。S121. Parse the target application installation package, and generate a shell application image.

众所周知,目标应用安装包为压缩文件,将该安装包解压,即可获得其中的文件。较佳的,将目标应用安装包解压至一个临时工作目录以完成解压工作。解压后,即可对目标应用安装包中的各个文件进行解析。另一种方式中,也可以在内存中直接解析该目标应用安装包。无论如何,本领域技术人员均能通过已知方式对目标应用进行解析,获得用于配置外壳应用的相关参数和资源,并据此生成外壳应用镜像。该镜像既可以是硬盘镜像,也可以是内存镜像,其功能在于在构造外壳应用过程中作为中间状态出现,故其具体存在形式应不影响本发明的实现,本领域技术人员可以结合公知常识灵活变通之,下不赘述。S122、修改或替换镜像中的代码文件,以注入所述的桩模块。As we all know, the target application installation package is a compressed file, and the files in it can be obtained by decompressing the installation package. Preferably, the target application installation package is decompressed to a temporary working directory to complete the decompression work. After decompression, each file in the target application installation package can be parsed. In another manner, the target application installation package may also be directly parsed in memory. In any case, those skilled in the art can parse the target application in a known manner, obtain relevant parameters and resources for configuring the shell application, and generate a shell application image accordingly. The image can be either a hard disk image or a memory image, and its function is to appear as an intermediate state during the construction of the shell application process, so its specific form of existence should not affect the realization of the present invention, and those skilled in the art can flexibly combine common knowledge Work around it, so I won’t repeat it below. S122. Modify or replace the code file in the image to inject the stub module.

公知的,apk安装包的构成文件中包含代码文件Classes.dex。本发明中,通过修改或者替换的方式,为外壳应用镜像构造新的Classes.dex,使该新文件中包含本发明所提供的桩模块nStub。该桩模块通过加载利用HOOK技术实现的监控单元14,使监控单元14可在运行时实现对目标应用15所创建的进程的事件行为的监控捕获。As known, the constituent files of the apk installation package include the code file Classes.dex. In the present invention, by means of modification or replacement, a new Classes.dex is constructed for the shell application image, so that the new file includes the stub module nStub provided by the present invention. The stub module loads the monitoring unit 14 realized by using HOOK technology, so that the monitoring unit 14 can monitor and capture the event behavior of the process created by the target application 15 during operation.

S123、修改镜像中的配置文件的配置参数,用于加载指定目录中的目标应用15。S123. Modify the configuration parameters of the configuration file in the image, so as to load the target application 15 in the specified directory.

同理,安装包的构成文件中还包含配置文件Androidmanifest.xml,对该文件进行修改,对应修改外壳应用镜像中有关目标应用15的配置信息,使其适于加载指定目录中的目标应用15。此外,本发明利用Java反射调用机制,将LoadApk与ActivityThread涉及的运行时配置信息用反射替换成指定目录中目标应用15安装包的ClassLoader与资源,从而实现外壳应用在运行时对目标应用15的加载。Similarly, the configuration file of the installation package also includes the configuration file Androidmanifest.xml, which is modified to modify the configuration information of the target application 15 in the shell application image correspondingly, so that it is suitable for loading the target application 15 in the specified directory. In addition, the present invention uses the Java reflection calling mechanism to replace the runtime configuration information involved in LoadApk and ActivityThread with the ClassLoader and resources of the target application 15 installation package in the specified directory, thereby realizing the loading of the target application 15 by the shell application at runtime .

此外,图标作为一种可供人机识别的资源,在本发明中也作为配置文件之一被修改。为了使图标更易识别,本发明利用该目标应用15的原图标作为底稿,对其添加图戳,以原文件名保存替换原图标,如此,即可在外壳应用安装后,供用户通过该图戳识别其为已防御的应用。同一个目标应用15可能包括多个图标资源,可以仅对其中目标应用15所采用的主图标进行修改,也可对其包含的多个或所有图标进行类似的修改。In addition, the icon, as a resource that can be recognized by man and machine, is also modified as one of the configuration files in the present invention. In order to make the icon easier to identify, the present invention uses the original icon of the target application 15 as a draft, adds a stamp to it, and saves and replaces the original icon with the original file name, so that after the shell application is installed, it can be identified by the stamp for the user It is a defended application. The same target application 15 may include multiple icon resources, and only the main icon used by the target application 15 may be modified, or multiple or all icons contained in it may be modified similarly.

S124、完成该外壳应用的封装。S124 , completing the encapsulation of the shell application.

本子步骤为本领域技术人员所知悉的常规步骤,在完成上述的修改后,对外壳应用镜像进行打包和签名,便可完成外壳应用的封装。签名时,参照公知方式,可以采用手机识别码IME,或者采用随机码的方式进行签名。This sub-step is a conventional step known to those skilled in the art. After completing the above modification, the shell application image is packaged and signed, and the package of the shell application can be completed. When signing, referring to known methods, the mobile phone identification code IME can be used, or a random code can be used to sign.

经过以上四个子步骤,便可基于目标应用15安装包构造相应的外壳应用安装包。可以理解,外壳应用属于轻应用,体积较小,其功能主要表现在对监控单元14和对目标应用15的先后加载。在运行时,监控单元14先被桩模块加载,加载后便开始挂钩后续被加载的目标应用15的所有或部分指定的事件行为,实际上相当于将目标应用15的事件行为的控制权交到监控单元14手中。After the above four sub-steps, a corresponding shell application installation package can be constructed based on the target application 15 installation package. It can be understood that the shell application is a light application with a small volume, and its function is mainly manifested in sequentially loading the monitoring unit 14 and the target application 15 . During operation, the monitoring unit 14 is first loaded by the stub module, and after loading, it starts to hook all or part of the specified event behaviors of the subsequently loaded target application 15, which is actually equivalent to handing over the control of the event behavior of the target application 15 to Monitoring unit 14 hands.

需要指出的是,所述的监控单元14,是通过从一后台沙箱HOOK框架中获取对应于特定的事件行为的挂钩插件,利用该挂钩插件监控目标应用15的特定事件行为而实现的。所述的后台沙箱HOOK框架,在云端进行集中管理,向各终端进行分发。其中,云端主要构造有Java挂钩插件库和Native挂钩插件库。监控单元14可以通过远程插件接口向后台沙箱HOOK框架发送请求,获得针对特定事件行为的HOOK函数,即所述的挂钩插件,借此建立对特定事件行为的监控捕获和处理。It should be pointed out that the monitoring unit 14 is realized by obtaining a hook plug-in corresponding to a specific event behavior from a background sandbox HOOK framework, and using the hook plug-in to monitor the specific event behavior of the target application 15 . The background sandbox HOOK framework is centrally managed in the cloud and distributed to each terminal. Among them, the main structure of the cloud is the Java hook plug-in library and the Native hook plug-in library. The monitoring unit 14 can send a request to the background sandbox HOOK framework through the remote plug-in interface to obtain a HOOK function for a specific event behavior, that is, the hook plug-in, so as to establish monitoring capture and processing of a specific event behavior.

由于监控单元14与目标应用15的加载,均为外壳应用进程所驱动,且监控单元14先于目标应用15加载,因而,监控单元14在理论上可以建立对目标应用15一切事件行为的监控。以下概括说明几种典型的事件行为及其捕获实例:Since the loading of the monitoring unit 14 and the target application 15 are both driven by the shell application process, and the monitoring unit 14 is loaded before the target application 15, the monitoring unit 14 can theoretically monitor all event behaviors of the target application 15. The following outlines several typical event behaviors and their capture instances:

(1)终端、联网有关的操作:(1) Operations related to terminal and networking:

获取运营商信息:目标应用15例如通过getSimOperatorName()函数可以获得移动终端的IMSI,由此可进一步判断运营商的名称,进一步可以向运营商发送约定指令,实现扣费之类的非法目的。监控平台通过挂钩与此相关的消息,便可以对事件行为的捕获。Obtaining operator information: the target application 15 can obtain the IMSI of the mobile terminal, for example, through the getSimOperatorName() function, thereby further determining the name of the operator, and further sending an agreed command to the operator to achieve illegal purposes such as deduction. The monitoring platform can capture the event behavior by hooking the related messages.

切换APN操作:同理,目标应用15通过与APN切换有关的函数实现ANP切换控制的操作,也可被监控单元14通过调用相应的挂钩插件进行监控。APN switching operation: Similarly, the target application 15 realizes the operation of ANP switching control through functions related to APN switching, and can also be monitored by the monitoring unit 14 by calling the corresponding hook plug-in.

类似的操作,还包括获取手机识别码IME的操作,也与上述同理。Similar operations also include the operation of obtaining the mobile phone identification code IME, which is also the same as above.

(2)通知栏广告操作:通知栏广告是最易被恶意程序利用的手段,监控单元14通过调用相应的挂钩插件对notify函数产生的事件消息进行监控,也可对其实施监控。(2) Notification bar advertisement operation: Notification bar advertisement is the method most likely to be used by malicious programs. The monitoring unit 14 can monitor the event message generated by the notify function by calling the corresponding hook plug-in, and can also monitor it.

(3)通信操作:(3) Communication operation:

如电话拔打操作,通过StartActivity()函数可以监控拔打电话的事件行为,利用相应的挂钩插件可以对拔打电话操作建立事件行为监控。For example, the call operation can monitor the event behavior of the call through the StartActivity() function, and use the corresponding hook plug-in to establish event behavior monitoring for the call operation.

短信操作,对应于SendTextMessage()之类的函数,同理,可以借助挂钩插件对这类函数建立事件行为监控。SMS operation corresponds to functions such as SendTextMessage(). Similarly, event behavior monitoring can be established for such functions with the help of hook plug-ins.

联系人操作:一般对应于Query()、Insert()函数,监控单元14利用挂钩插件挂钩此类函数可以实现对此类事件行为的监控捕获。Contact operation: generally corresponds to the Query() and Insert() functions, and the monitoring unit 14 can monitor and capture such event behaviors by hooking such functions with hook plug-ins.

(4)命令操作:(4) Command operation:

如SU提权操作或执行命令操作,均需用到Execve()函数,监控单元14通过监控此函数的返回消息,便可实现该类事件行为的监控。For example, the SU privilege escalation operation or command execution operation requires the Execve() function, and the monitoring unit 14 can monitor the behavior of such events by monitoring the return message of this function.

(5)界面及访问操作:(5) Interface and access operations:

如创造快捷方式的事件行为,则对应于SentBroacast()函数。同理,对于隐藏程序图标的操作,也可对应特定函数监控之。For example, the event behavior of creating a shortcut corresponds to the SentBroacast() function. Similarly, for the operation of hiding the program icon, it can also be monitored corresponding to a specific function.

如HTTP网络访问操作,则对应于Sentto()、Write()等函数。Such as HTTP network access operations, corresponding to Sentto (), Write () and other functions.

(6)程序操作:(6) Program operation:

如应用加载操作,指当前目标应用15加载相关应用的操作,通过对dexclassloader()、loadlibrary()等函数进行挂钩监控,可以实现对此类事件行为的捕获。For example, an application loading operation refers to an operation in which the current target application 15 loads a related application. By hooking and monitoring functions such as dexclassloader() and loadlibrary(), such event behaviors can be captured.

又如安装子包,则对应于StartActivity()函数。Another example is installing a subpackage, which corresponds to the StartActivity() function.

(7)其它危险操作:(7) Other dangerous operations:

例如,子进程侵入操作、衍生物操作、激活设备管理器操作等,分别对应于。For example, child process intrusion operation, derivative operation, activate device manager operation, etc., correspond to respectively.

其中,子进程是指目标应用15建立的子进程,在目标应用15创建子进程时,监控单元14将收到相应的消息,而判定其创建子进程的事件行为。由此,监控单元14进一步向该子进程以内联钩子的方式在该子进程中植入监控单元14,后续便可继续对该子进程的事件行为进行监控。因而,无论是目标应用15的自身进程,还是其创建的子进程,它们直接或间接所触发的事件行为,均能被本发明的监控单元14所监控,使主动防御效果更佳。Wherein, the sub-process refers to the sub-process created by the target application 15. When the target application 15 creates a sub-process, the monitoring unit 14 will receive a corresponding message and determine the event behavior of creating the sub-process. Thus, the monitoring unit 14 further implants the monitoring unit 14 into the sub-process in the form of an inline hook, and then the event behavior of the sub-process can be continuously monitored. Therefore, whether it is the target application 15's own process or its created sub-processes, the event behaviors triggered directly or indirectly by them can be monitored by the monitoring unit 14 of the present invention, so that the active defense effect is better.

而所述衍生物,是指目标应用15自行创建的文件,或者远程下载的文件,通常是指敏感的衍生物,例如安装包。通过挂钩fclose()函数可以捕获该事件。需要指出的是,当监控单元14捕获该事件行为后,可以按照前述的方法,进一步利用远程规则库接口发送请求到云端,由云端利用其黑、白、灰的安全等级行为规则判断该衍生物的安全等级,本发明通过远程规则库接口获得云端判定结果后,进一步弹窗询问用户是否建立对该敏感衍生物的主动防御,由此便可进一步巩固主动防御的效果。The derivative refers to a file created by the target application 15 itself, or a file downloaded remotely, and usually refers to a sensitive derivative, such as an installation package. This event can be captured by hooking the fclose() function. It should be pointed out that after the monitoring unit 14 captures the event behavior, it can further use the remote rule base interface to send a request to the cloud according to the aforementioned method, and the cloud can use its black, white, and gray security level behavior rules to judge the derivative. After obtaining the cloud judgment result through the remote rule library interface, the present invention further pops up a window to ask the user whether to establish an active defense against the sensitive derivative, thereby further consolidating the effect of active defense.

上述的事件行为仅为摘录之用,不能理解为对本发明监控的事件行为的限制。结合上述对事件行为的分类可知,本发明的监控单元14,可以对源自目标应用15的事件行为、无论是由目标应用15直接还是间接触发的事件行为进行监控。The above-mentioned event behaviors are only used for excerpts, and should not be construed as limitations on the event behaviors monitored by the present invention. In combination with the above classification of event behaviors, it can be known that the monitoring unit 14 of the present invention can monitor the event behaviors originating from the target application 15 , no matter the event behaviors triggered directly or indirectly by the target application 15 .

本发明的外壳应用安装包的文件名与目标应用15的安装包的文件名完全一致,因此,可以看出,外壳应用构成了目标应用15的伪装应用。外壳应用体积小,其构造过程较为迅速,对用户而言其构造和运行过程较为透明,基本不影响进行主动防御环境构建时的目标应用15安装和运行效率。The file name of the installation package of the shell application of the present invention is completely consistent with the file name of the installation package of the target application 15 , therefore, it can be seen that the shell application constitutes a disguised application of the target application 15 . The shell application is small in size, its construction process is relatively fast, and its construction and operation process is relatively transparent to users, and basically does not affect the installation and operation efficiency of the target application 15 when constructing an active defense environment.

此外,为了便于实现用户交互,本发明还为外壳应用配备一交互接口,通过该交互接口,可以向预注册的系统服务发送消息,通过系统服务向用户界面弹窗问询用户指令,系统服务获得用户指令后返回给本外壳应用的进程,外壳应用根据用户指令可以做前述所称的系列的后续处理,这一后续处理部分将在后续涉及主动防御方法部分进行详细的揭示。In addition, in order to facilitate user interaction, the present invention is also equipped with an interactive interface for the shell application. Through this interactive interface, messages can be sent to pre-registered system services, and user instructions can be inquired from the pop-up window of the user interface through the system services, and the system services can obtain After the user command returns to the process of the shell application, the shell application can perform the above-mentioned series of follow-up processing according to the user command, and this follow-up processing part will be disclosed in detail in the subsequent part related to the active defense method.

S13、安装该外壳应用。S13. Install the shell application.

完成该外壳应用的构造后,本发明将该外壳应用进行安装,而后,该目标应用15即具有了前述所阐述的主动防御环境,用户运行该目标应用15,会被引导至运行文件名相同的外壳应用,外壳应用一旦运行,便能实现对该目标应用15的主动防御。After completing the construction of the shell application, the present invention installs the shell application, and then, the target application 15 has the aforementioned active defense environment. When the user runs the target application 15, he will be directed to the file with the same name as the running file. The shell application, once the shell application runs, can realize active defense against the target application 15 .

由于本发明的方法的应用环境为非ROOT授权的环境,部分权限受限制,这种情况下,如果已安装目标应用15未卸载,则会先弹出一卸载该目标应用15的界面,引导用户卸载已装目标应用15;继而弹出一安装该外壳应用的界面,引导客户安装该外壳应用。当然,如果系统已获ROOT授权,本发明的方法可径行将其旧应用卸载然后安装外壳应用。Since the application environment of the method of the present invention is a non-ROOT authorized environment, some permissions are limited. In this case, if the installed target application 15 is not uninstalled, an interface for uninstalling the target application 15 will pop up first to guide the user to uninstall. The target application 15 has been installed; then an interface for installing the shell application pops up to guide the customer to install the shell application. Of course, if the system has been authorized by ROOT, the method of the present invention can directly uninstall the old application and then install the shell application.

需要进一步的强调的是,前述提及的卸载目标应用15的子步骤,如本步骤所述,可以按需被后续处理,其卸载的时点,并不影响本发明的方法的实现。It needs to be further emphasized that the sub-steps of uninstalling the target application 15 mentioned above, as described in this step, can be processed later as needed, and the timing of the uninstallation does not affect the implementation of the method of the present invention.

以上仅仅阐述了本发明的主动防御配置方法,进一步,可以利用该主动防御配置方法构建相应的主动防御配置装置。The above only illustrates the active defense configuration method of the present invention, and further, the active defense configuration method can be used to construct a corresponding active defense configuration device.

请参阅图3,本发明的免ROOT主动防御配置装置与前述配置方法具有严密的对应性,包括确定装置11、构造装置12以及安装装置13,如下进行具体阐述:Please refer to Figure 3, the ROOT-free active defense configuration device of the present invention has a strict correspondence with the aforementioned configuration method, including a determination device 11, a construction device 12, and an installation device 13, as follows:

所述的确定装置11,用于确定目标应用15,并将该目标应用15的安装包保存至指定目录。The determining means 11 is configured to determine the target application 15, and save the installation package of the target application 15 to a designated directory.

所述的目标应用15,即需要建构主动防御环境的目标应用15程序,就特定的处于非ROOT授权环境下的Android系统而言,出于权限限制的考虑,一般适用于第三方应用。The target application 15, that is, the target application 15 program that needs to construct an active defense environment, is generally applicable to third-party applications for the specific Android system in a non-ROOT authorized environment due to permission restrictions.

本发明所称的指定目录,是指本发明出于文件组织、管理效率的考虑而为这些需要建构主动防御环境而提供的自定义默认目录,所有通过本发明建立了主动防御环境的目标应用15的安装包,均可被移动或复制保存到该指定目录中,进一步还可以对其进行加密或隐藏,以确保其安全性。需要指出的是,这里的指定目录,还可以是系统已经存在的目录。既可以是单个目录,也可以是多个目录。概括而言,是为本发明所采用的用于存放由本发明建构主动防御环境的目标应用15安装包的目录。The designated directory referred to in the present invention refers to the self-defined default directory provided by the present invention for the purpose of constructing an active defense environment for these needs in consideration of file organization and management efficiency. All target applications that have established an active defense environment through the present invention15 All installation packages can be moved or copied to the specified directory, and further encrypted or hidden to ensure its security. It should be pointed out that the specified directory here may also be a directory that already exists in the system. It can be either a single directory or multiple directories. In a nutshell, it is the directory used by the present invention to store the installation package of the target application 15 constructed by the present invention to construct the active defense environment.

确定装置11的构造,非常灵活,以下提供几种构造该确定装置11的实施方式:The configuration of the determination device 11 is very flexible, and several implementations of the configuration of the determination device 11 are provided below:

方式一:method one:

对于已经完成安装的应用程序而言,本发明可以自动或受用户指令控制对这些已安装应用程序进行扫描,获得这些应用程序的安装信息,通过一选定单元将这些应用程序作为候选目标应用15列表如图9所示的显示在用户界面中,在图形用户界面的相应指示区域中为列表中的每个候选目标应用15提供相对应的选择开关,由用户对这些开关状态进行设定,从而获得用户对具体目标应用15的确定。具体而言,用户可以将某个目标应用15所对应的指示区域中的选择开关,从未选定状态切换至选定状态,这种情况下,即可视为用户完成了对该目标应用15的确定操作。For the application programs that have been installed, the present invention can scan these installed application programs automatically or controlled by user instructions, obtain the installation information of these application programs, and use these application programs as candidate target applications through a selection unit 15 The list is displayed in the user interface as shown in Figure 9, and a corresponding selection switch is provided for each candidate target application 15 in the list in the corresponding indication area of the graphical user interface, and the state of these switches is set by the user, thereby A user's determination of a specific target application 15 is obtained. Specifically, the user can switch the selection switch in the indication area corresponding to a certain target application 15 from the unselected state to the selected state. In this case, it can be considered that the user has completed the target application 15 confirm operation.

众所周知的,Android系统中,第三方应用的安装会涉及对如下目录做如下操作:data/app,第三方应用安装目录,安装时先把apk文件复制到此目录;data/dalvik-cache,将apk解压后的代码文件(.dex文件)安装到该目录下;data/data,用于建立并存放应用程序所需的数据。基于上述原理可知,第三方应用的apk文件即为其安装包,在data/app中可以找到该安装包。因此,对于已安装的目标应用15而言,本发明进而为确定装置11构造一处理单元,由其从data/app中复制相应的apk文件到指定目录中,然后卸载该目标应用15。As we all know, in the Android system, the installation of third-party applications will involve the following operations on the following directories: data/app, the third-party application installation directory, first copy the apk file to this directory during installation; data/dalvik-cache, copy the apk The decompressed code file (.dex file) is installed in this directory; data/data is used to create and store the data required by the application. Based on the above principles, it can be seen that the apk file of the third-party application is its installation package, which can be found in data/app. Therefore, for the installed target application 15, the present invention further constructs a processing unit for the determining device 11, which copies the corresponding apk file from data/app to the designated directory, and then uninstalls the target application 15.

方式二:Method 2:

参阅图8,对于准备或者正在进行安装的应用程序而言,本发明可以通过将自身注册为默认安装器的形式,通过一选定单元获取该应用程序的安装广播信息。继而,将这个新装应用程序作为目标应用15,将其安装包或签名之类的特征信息通过远程规则库接口发送到云端服务器中,由云端服务器对其做出安全性判断。一种实施例中,云端服务器为应用程序的安全级别设定黑、灰、白三种级别,分别代表不同危险程度,并设定对应的处理规则。例如,黑应用禁止安装,灰应用由用户自行选择,白应用则可径行安装。当然,可以进一步简化为灰、白两种,或者简化为黑、白两种。本领域技术人员熟悉服务器的这种云端控制技术,恕不赘述。无论如何,本发明将从本机远程规则库接口中获得云端服务器有关这些应用的处理规则的反馈,利用反馈结果做出相应的后续处理。具体而言,当针对当前目标应用15返回黑应用标识时,可以随即停止该目标应用15的安装;当标识为白应用或灰应用时,则可放行安装。出于交互性的考虑,当完成远程判断后,本发明将向用户界面弹窗提醒用户有关判断结果,并显示相应的处理建议,询问用户是否确定对当前新装应用建构主动防御环境,用户从中确定对当前新装目标应用15进行主动防御的标识后,即确定了该目标应用15。Referring to FIG. 8 , for an application program that is about to be installed or is being installed, the present invention can register itself as a default installer, and obtain the installation broadcast information of the application program through a selected unit. Then, take this newly installed application program as the target application 15, and send its feature information such as its installation package or signature to the cloud server through the remote rule base interface, and the cloud server makes a security judgment on it. In one embodiment, the cloud server sets three levels for the security level of the application program: black, gray, and white, respectively representing different risk levels, and sets corresponding processing rules. For example, black apps are prohibited from being installed, gray apps are selected by the user, and white apps can be installed directly. Of course, it can be further simplified into gray and white, or into black and white. Those skilled in the art are familiar with this cloud control technology of the server, so details are not repeated here. In any case, the present invention will obtain feedback from the cloud server on the processing rules of these applications from the local remote rule base interface, and use the feedback results to make corresponding follow-up processing. Specifically, when the black application identification is returned for the current target application 15, the installation of the target application 15 can be stopped immediately; when the identification is a white application or a gray application, the installation can be released. For the sake of interactivity, after the remote judgment is completed, the present invention will remind the user of the judgment result in a pop-up window on the user interface, and display corresponding processing suggestions, asking the user whether to confirm the construction of an active defense environment for the current newly installed application, from which the user can determine After actively defending the currently newly installed target application 15, the target application 15 is determined.

同理,用户确定该目标应用15之后,本发明会将该目标应用15的安装包存放至所述的指定目录中。另外,出于本发明后续将为该已确定的目标应用15建构主动防御环境的考虑,本发明会由一处理单元立即停止该目标应用15的安装,停止安装的操作既可以发明在用户确定该目标应用15之前也可以发生在之后。Similarly, after the user determines the target application 15, the present invention will store the installation package of the target application 15 in the specified directory. In addition, considering that the present invention will subsequently construct an active defense environment for the determined target application 15, the present invention will immediately stop the installation of the target application 15 by a processing unit. Before the target application 15 can also happen after.

其它变通方式:Other workarounds:

如前提供的两种典型的有关确定目标应用15的方式,可由本领域技术人员变通利用。例如,对于方式一中的已安装目标应用15而言,可以适用方式二中将已安装应用通过远程规则库接口发送到云端进行安全等级判断,并在返回结果后,参照方式二的处理方式,对已安装应用进行处理。又如,如果当前应用属于黑应用,而用户仍然希望安装该应用,则仍可允许用户在建立主动防御环境的前提下保留该已安装应用程序,或者允许相应的新装应用继续安装。The two typical methods for determining the target application 15 provided above can be utilized by those skilled in the art. For example, for the installed target application 15 in the first method, the installed application in the second method can be sent to the cloud through the remote rule base interface for security level judgment, and after returning the result, refer to the processing method in the second method, Process installed applications. For another example, if the current application is a black application and the user still wants to install the application, the user may still be allowed to keep the installed application under the premise of establishing an active defense environment, or allow the corresponding newly installed application to continue to be installed.

以上揭示关于确定装置11的两种典型构造方式及其变通方式,本领域技术人员足以据此掌握,本发明的主动防御配置装置的确定装置11中涉及如何确定目标应用15的多种途径,以及如何获得被确定的目标应用15的安装包并将其保存至指定目录中的多种实现方式。The two typical configurations of the determining device 11 and their alternatives disclosed above are sufficient for those skilled in the art to understand that the determining device 11 of the active defense configuration device of the present invention involves multiple ways of determining the target application 15, and How to obtain the installation package of the determined target application 15 and save it in a designated directory in various ways.

所述的构造装置12,其利用目标应用15的安装包配置外壳应用的安装包。The construction device 12 uses the installation package of the target application 15 to configure the installation package of the shell application.

确定需要建构主动防御环境的目标应用15后,进一步创建外壳应用。该构造装置12包括解析单元、代码单元、配置单元以及封装单元,以下详细揭示这些单元的功能实现:After determining the target application 15 that needs to construct an active defense environment, a shell application is further created. The construction device 12 includes a parsing unit, a code unit, a configuration unit and an encapsulation unit, and the function realization of these units is disclosed in detail below:

所述的解析单元,用于解析目标应用15安装包,生成外壳应用镜像。The parsing unit is configured to parse the installation package of the target application 15 to generate a shell application image.

众所周知,目标应用15安装包为压缩文件,将该安装包解压,即可获得其中的文件。较佳的,将目标应用15安装包解压至一个临时工作目录以完成解压工作。解压后,即可对目标应用安装包中的各个文件进行解析。另一种方式中,也可以在内存中直接解析该目标应用安装包。无论如何,本领域技术人员均能通过已知方式对目标应用进行解析,获得用于配置外壳应用的相关参数和资源,并据此生成外壳应用镜像。As we all know, the installation package of the target application 15 is a compressed file, and the files in it can be obtained by decompressing the installation package. Preferably, the target application 15 installation package is decompressed to a temporary working directory to complete the decompression work. After decompression, each file in the target application installation package can be parsed. In another manner, the target application installation package may also be directly parsed in memory. In any case, those skilled in the art can parse the target application in a known manner, obtain relevant parameters and resources for configuring the shell application, and generate a shell application image accordingly.

所述的代码单元,用于修改或替换镜像中的代码文件,以注入所述的桩模块。The code unit is used to modify or replace the code file in the image to inject the stub module.

公知的,apk安装包的构成文件中包含代码文件Classes.dex。本发明中,通过修改或者替换的方式,构造新的Classes.dex,使该新文件中包含本发明所提供的桩模块nStub。该桩模块通过加载利用HOOK技术实现的监控单元14,使监控单元14可在运行时实现对目标应用15所创建的进程的事件行为的监控捕获。As known, the constituent files of the apk installation package include the code file Classes.dex. In the present invention, a new Classes.dex is constructed through modification or replacement, so that the new file includes the stub module nStub provided by the present invention. The stub module loads the monitoring unit 14 realized by using HOOK technology, so that the monitoring unit 14 can monitor and capture the event behavior of the process created by the target application 15 during operation.

所述的配置单元,用于修改镜像中的配置文件的配置参数,以用于加载指定目录中的目标应用15。The configuration unit is used to modify the configuration parameters of the configuration file in the image, so as to load the target application 15 in the specified directory.

同理,安装包的构成文件中还包含配置文件Androidmanifest.xml,对该文件进行修改,对应修改外壳应用镜像中有关目标应用15的配置信息,使其适于加载指定目录中的目标应用15。此外,本发明利用Java反射调用机制,将LoadApk与ActivityThread涉及的运行时配置信息用反射替换成指定目录中目标应用15安装包的ClassLoader与资源,从而实现外壳应用在运行时对目标应用15的加载。Similarly, the configuration file of the installation package also includes the configuration file Androidmanifest.xml, which is modified to modify the configuration information of the target application 15 in the shell application image correspondingly, so that it is suitable for loading the target application 15 in the specified directory. In addition, the present invention uses the Java reflection calling mechanism to replace the runtime configuration information involved in LoadApk and ActivityThread with the ClassLoader and resources of the target application 15 installation package in the specified directory, thereby realizing the loading of the target application 15 by the shell application at runtime .

此外,图标作为一种可供人机识别的资源,在本发明中也作为配置文件之一被修改。为了使图标更易识别,本发明利用该目标应用15的原图标作为底稿,对其添加图戳,以原文件名保存替换原图标,如此,即可在外壳应用安装后,供用户通过该图戳识别其为已防御的应用。同一个目标应用15可能包括多个图标资源,可以仅对其中目标应用15所采用的主图标进行修改,也可对其包含的多个或所有图标进行类似的修改。In addition, the icon, as a resource that can be recognized by man and machine, is also modified as one of the configuration files in the present invention. In order to make the icon easier to identify, the present invention uses the original icon of the target application 15 as a draft, adds a stamp to it, and saves and replaces the original icon with the original file name, so that after the shell application is installed, it can be identified by the stamp for the user It is a defended application. The same target application 15 may include multiple icon resources, and only the main icon used by the target application 15 may be modified, or multiple or all icons contained in it may be modified similarly.

所述的封装单元,用于完成该外壳应用的封装。The encapsulation unit is used to complete the encapsulation of the shell application.

封装单元的功能实现为本领域技术人员所应理解。在完成上述的修改后,对外壳应用镜像进行打包和签名,便可完成外壳应用的封装。签名时,参照公知方式,可以采用手机识别码IME,或者采用随机码的方式进行签名。The function implementation of the encapsulation unit should be understood by those skilled in the art. After completing the above modifications, package and sign the shell application image to complete the packaging of the shell application. When signing, referring to known methods, the mobile phone identification code IME can be used, or a random code can be used to sign.

通过执行该构造装置12,便可基于目标应用15安装包构造相应的外壳应用安装包。可以理解,外壳应用属于轻应用,体积较小,其功能主要表现在对监控单元14和对目标应用15的先后加载。在运行时,监控单元14先被桩模块加载,加载后便开始挂钩后续被加载的目标应用15的所有或部分指定的事件行为,实际上相当于将目标应用15的事件行为的控制权交到监控单元14手中。By executing the construction device 12, a corresponding shell application installation package can be constructed based on the target application 15 installation package. It can be understood that the shell application is a light application with a small volume, and its function is mainly manifested in sequentially loading the monitoring unit 14 and the target application 15 . During operation, the monitoring unit 14 is first loaded by the stub module, and after loading, it starts to hook all or part of the specified event behaviors of the subsequently loaded target application 15, which is actually equivalent to handing over the control of the event behavior of the target application 15 to Monitoring unit 14 hands.

需要指出的是,所述的监控单元14,是通过从一后台沙箱HOOK框架中获取对应于特定的事件行为的挂钩插件,利用该挂钩插件监控目标应用15的特定事件行为而实现的。所述的后台沙箱HOOK框架,在云端进行集中管理,向各终端进行分发。其中,云端主要构造有Java挂钩插件库和Native挂钩插件库。监控单元14可以通过远程插件接口向后台沙箱HOOK框架发送请求,获得针对特定事件行为的HOOK函数,即所述的挂钩插件,借此建立对特定事件行为的监控捕获和处理。It should be pointed out that the monitoring unit 14 is realized by obtaining a hook plug-in corresponding to a specific event behavior from a background sandbox HOOK framework, and using the hook plug-in to monitor the specific event behavior of the target application 15 . The background sandbox HOOK framework is centrally managed in the cloud and distributed to each terminal. Among them, the main structure of the cloud is the Java hook plug-in library and the Native hook plug-in library. The monitoring unit 14 can send a request to the background sandbox HOOK framework through the remote plug-in interface to obtain a HOOK function for a specific event behavior, that is, the hook plug-in, so as to establish monitoring capture and processing of a specific event behavior.

由于监控单元14与目标应用15的加载,均为外壳应用进程所驱动,且监控单元14先于目标应用15加载,因而,监控单元14在理论上可以建立对目标应用15一切事件行为的监控。Since the loading of the monitoring unit 14 and the target application 15 are both driven by the shell application process, and the monitoring unit 14 is loaded before the target application 15, the monitoring unit 14 can theoretically monitor all event behaviors of the target application 15.

有关本发明的主动防御配置装置中监控单元14所处理的事件行为,由于与上述主动防御配置方法具有严密对应性,故不赘述。The events and behaviors processed by the monitoring unit 14 in the active defense configuration device of the present invention are closely related to the above-mentioned active defense configuration method, so they are not described in detail.

同理,本发明的外壳应用安装包的文件名与目标应用15的安装包的文件名完全一致,因此,可以看出,外壳应用构成了目标应用15的伪装应用。外壳应用体积小,其构造过程较为迅速,对用户而言构造和运行过程较为透明,基本不影响进行主动防御环境构建时的目标应用15安装和运行效率。Similarly, the file name of the installation package of the shell application in the present invention is completely consistent with the file name of the installation package of the target application 15 , therefore, it can be seen that the shell application constitutes a disguised application of the target application 15 . The shell application is small in size, and its construction process is relatively fast. The construction and operation process is relatively transparent to users, and basically does not affect the installation and operation efficiency of the target application 15 when constructing an active defense environment.

此外,为了便于实现用户交互,本发明还为外壳应用配备一交互接口,通过该交互接口,可以向预注册的系统服务发送消息,通过系统服务向用户界面弹窗问询用户指令,系统服务获得用户指令后返回给本外壳应用的进程,外壳应用根据用户指令可以做前述所称的系列的后续处理,这一后续处理部分将在后续涉及主动防御方法部分进行详细的揭示。In addition, in order to facilitate user interaction, the present invention is also equipped with an interactive interface for the shell application. Through this interactive interface, messages can be sent to pre-registered system services, and user instructions can be inquired from the pop-up window of the user interface through the system services, and the system services can obtain After the user command returns to the process of the shell application, the shell application can perform the above-mentioned series of follow-up processing according to the user command, and this follow-up processing part will be disclosed in detail in the subsequent part related to the active defense method.

所述的安装装置13,用于安装该外壳应用。The installation device 13 is used for installing the housing application.

完成该外壳应用后,执行安装装置13,以便直接安装该外壳应用,安装完成后,该目标应用15即具有了前述所阐述的主动防御环境,用户运行该目标应用15,会被引导至运行文件名相同的外壳应用,外壳应用一时运行,便能实现对该目标应用15的主动防御。After the shell application is completed, the installation device 13 is executed to directly install the shell application. After the installation is completed, the target application 15 has the active defense environment described above. When the user runs the target application 15, he will be directed to the running file The shell application with the same name can realize the active defense against the target application 15 once the shell application is running.

由于本发明的方法的应用环境为非ROOT授权的环境,部分权限受限制,这种情况下,如果已安装目标应用15未卸载,则会先弹出一卸载该目标应用15的界面,引导用户卸载已装目标应用15;继而弹出一安装该外壳应用的界面,引导客户安装该外壳应用。当然,如果系统已获ROOT授权,本发明的方法可径行将其旧应用卸载然后安装外壳应用。Since the application environment of the method of the present invention is a non-ROOT authorized environment, some permissions are limited. In this case, if the installed target application 15 is not uninstalled, an interface for uninstalling the target application 15 will pop up first to guide the user to uninstall. The target application 15 has been installed; then an interface for installing the shell application pops up to guide the customer to install the shell application. Of course, if the system has been authorized by ROOT, the method of the present invention can directly uninstall the old application and then install the shell application.

需要进一步的强调的是,前述提及的卸载目标应用15的子步骤,如本步骤所述,可以按需被后续处理,其卸载的时点,并不影响本发明的方法的实现。It needs to be further emphasized that the sub-steps of uninstalling the target application 15 mentioned above, as described in this step, can be processed later as needed, and the timing of the uninstallation does not affect the implementation of the method of the present invention.

本发明在前述的方法和装置中为应用程序建构了主动防御环境,在此基础上,从程序执行的视角,还提供了一种主动防御方法和一种主动防御装置。The present invention constructs an active defense environment for application programs in the aforementioned method and device, and on this basis, from the perspective of program execution, it also provides an active defense method and an active defense device.

请参阅图4,本发明的主动防御方法,是前述主动防御配置方法中构建的主动防御环境的具体应用,该方法建基于构建了主动防御环境配置的目标应用15,对目标应用15实施安全防护。结合图7,该方法包括如下步骤:Please refer to Fig. 4, the active defense method of the present invention is a specific application of the active defense environment constructed in the aforementioned active defense configuration method, the method is based on the target application 15 constructed with the active defense environment configuration, and implements security protection for the target application 15 . With reference to Figure 7, the method includes the following steps:

S31、响应运行目标应用35的指令,运行相应的外壳应用。S31. Run a corresponding shell application in response to an instruction to run the target application 35 .

参阅前述配置方法的说明可知,外壳应用被安装后,其文件名与原来的目标应用35的文件名相同,伪装成目标应用35,用户对目标应用35的操作,实际上,通过桌面图标指引的快捷方式,将被引导至运行预先伪装的外壳应用,此时,用户在用户界面上的点选操作便构成运行该外壳应用的运行指令。需要指出的是,运行目标应用35的指令并不局限于由用户触发,也包括如前所述的,由应用程序、定时任务或者通过其它公知途径以函数调用的方式执行的加载指令。外壳应用为轻应用,可以快速加载至内存中运行,对用户而言,其启动过程是透明的。Referring to the description of the aforementioned configuration method, it can be seen that after the shell application is installed, its file name is the same as that of the original target application 35, masquerading as the target application 35, and the user's operation on the target application 35 is actually guided by the desktop icon. The shortcut will be directed to run a pre-disguised shell application, and at this time, the user's click operation on the user interface constitutes an operation command to run the shell application. It should be noted that the instruction to run the target application 35 is not limited to being triggered by the user, but also includes, as mentioned above, a loading instruction executed by an application program, a timed task, or a function call through other known means. The shell application is a light application, which can be quickly loaded into the memory to run, and its startup process is transparent to the user.

外壳应用的图标是从目标应用35的默认图标改进的,一般是以该默认图标加图戳来实现这种改进,因而,从视觉效果上,还可起到一定的示警作用。The icon of the shell application is improved from the default icon of the target application 35, and the improvement is usually achieved by adding a picture to the default icon. Therefore, from the perspective of visual effects, it can also play a certain warning role.

一旦产生运行目标应用35的指令,本发明即作出响应,外壳应用随即被加载到JAVA虚拟机中运行。Once the command to run the target application 35 is generated, the present invention responds, and the shell application is loaded into the JAVA virtual machine to run.

S32、外壳应用的加载过程。S32. A loading process of the shell application.

如前的配置方法所述,本发明的外壳应用中,其代码文件Classes.dex配置有桩模块nstub,通过该桩模块可以加载监控模块;其配置文件Androidmanifest.xml运用Java反射调用原理,对其中的配置参数进行修改,使其适于加载保存在所述指定目录中的目标应用35,此外,还对目标应用35的运行时配置参数进行了适应性的修改,确定目标应用35能正常运行。As described in the previous configuration method, in the shell application of the present invention, its code file Classes.dex is configured with a stub module nstub, through which the monitoring module can be loaded; its configuration file Androidmanifest.xml uses the principle of Java reflection call, to which Modify the configuration parameters of the target application 35 to make it suitable for loading the target application 35 stored in the specified directory. In addition, the runtime configuration parameters of the target application 35 are also adaptively modified to ensure that the target application 35 can run normally.

因此,请参阅图5,外壳应用运行后,如步骤S321所揭示,首先通过桩模块调用加载监控单元34,所述监控单元34从一后台沙箱HOOK框架中获取对应于特定的事件行为的挂钩插件,利用该挂钩插件挂钩并监控目标应用35的特定事件行为。所述的后台沙箱HOOK框架,在云端进行集中管理,向各终端进行分发。其中,云端主要构造有Java挂钩插件库和Native挂钩插件库。监控单元34需要挂钩具体事件行为时,通过远程插件接口向后台沙箱HOOK框架发送请求,获得针对特定事件行为的HOOK函数,即所述的挂钩插件,借此建立对特定事件行为的监控捕获和处理。Therefore, referring to FIG. 5, after the shell application runs, as disclosed in step S321, the monitoring unit 34 is first invoked through the stub module, and the monitoring unit 34 obtains a hook corresponding to a specific event behavior from a background sandbox HOOK framework. A plug-in, using the hook plug-in to hook and monitor specific event behaviors of the target application 35 . The background sandbox HOOK framework is centrally managed in the cloud and distributed to each terminal. Among them, the main structure of the cloud is the Java hook plug-in library and the Native hook plug-in library. When the monitoring unit 34 needs to hook a specific event behavior, it sends a request to the background sandbox HOOK framework through the remote plug-in interface to obtain the HOOK function for the specific event behavior, that is, the hook plug-in, thereby establishing monitoring and capture of the specific event behavior. deal with.

进而,如步骤S322所揭示,运行中的外壳应用将进一步加载所述位于指定目录中的目标应用35。如前所述,目标应用35调用,是利用公知的Java反射调用机制实现的。外壳应用的进程将LoadApk与ActivityThread涉及的运行时配置信息用反射替换成指定目录中目标应用35安装包的ClassLoader与资源,从而实现对目标应用35的加载。Furthermore, as disclosed in step S322, the running shell application will further load the target application 35 located in the specified directory. As mentioned above, the invocation of the target application 35 is realized by using the well-known Java reflective invocation mechanism. The process of the shell application replaces the runtime configuration information involved in LoadApk and ActivityThread with the ClassLoader and resources of the installation package of the target application 35 in the specified directory by reflection, so as to realize the loading of the target application 35 .

如步骤S323显示,目标应用35被加载时,已被监控单元34利用挂钩插件建立了监控,因此,目标应用35的一切事件行为均在监控单元34的监控范围之内。位于目标应用35的安装包是完整未经修改的,因此,目标应用35被外壳应用加载后,能够完全合法、正常地运行,实现目标应用35原本能实现的所有功能。As shown in step S323 , when the target application 35 is loaded, it has been monitored by the monitoring unit 34 using the hook plug-in. Therefore, all event behaviors of the target application 35 are within the monitoring range of the monitoring unit 34 . The installation package located in the target application 35 is complete and unmodified. Therefore, after the target application 35 is loaded by the shell application, it can run completely legally and normally, and realize all the functions that the target application 35 can originally realize.

由于监控单元34与目标应用35的加载,均为外壳应用进程所驱动,同为外壳应用进程的一部分,且监控单元34先于目标应用35加载,因而,运行中的监控单元34即建立了对目标应用35一切事件行为的监控。目标应用35运行过程中产生的任何事件行为,其事件消息均会被监控单元34捕获并进行相应的处理。Because the loading of the monitoring unit 34 and the target application 35 are all driven by the shell application process, they are also part of the shell application process, and the monitoring unit 34 is loaded earlier than the target application 35. Therefore, the monitoring unit 34 in operation has established a pair of The target application 35 monitors all event behaviors. Any event behavior generated during the running of the target application 35 will be captured by the monitoring unit 34 and processed accordingly.

S33、捕获事件行为之后的处理过程。S33. A processing process after the event behavior is captured.

请结合图6,步骤S331显示,目标应用35产生的特定事件行为被监控单元34捕获,实质上是触发特定事件行为时,所产生的事件消息被监控单元34中相应的挂钩插件(钩子函数)所捕获。捕获该事件消息,即可知晓该事件的意图,继而可以进行后续的处理。Please refer to FIG. 6, step S331 shows that the specific event behavior generated by the target application 35 is captured by the monitoring unit 34, in essence, when a specific event behavior is triggered, the generated event message is captured by the corresponding hook plug-in (hook function) in the monitoring unit 34. captured. By capturing the event message, the intent of the event can be known, and subsequent processing can be performed.

步骤S332显示,对特定事件行为进行处理,需要获取事件行为处理策略。在这一子步骤中,可以进一步借助系统服务来实现人机交互功能。为了实现人机交互效果,本发明预先将一交互模块注册为系统服务,外壳应用可以通过其交互接口与该交互模块通信,从而实现外壳应用对用户指令或预设指令的获取。Step S332 shows that to process a specific event behavior, it is necessary to obtain an event behavior processing policy. In this sub-step, the human-computer interaction function can be further implemented with the help of system services. In order to realize the human-computer interaction effect, the present invention pre-registers an interaction module as a system service, and the shell application can communicate with the interaction module through its interaction interface, thereby realizing the acquisition of user instructions or preset instructions by the shell application.

事件行为策略的获取方式非常灵活多样,以下列举几种为本发明所择一或任意组合使用的策略:The acquisition methods of the event behavior strategy are very flexible and diverse. The following are several strategies selected by the present invention or used in any combination:

(1)监控单元34捕获特定事件行为后,通过外壳应用内建的交互接口,向所述交互模块发送请求,由交互模块向用户界面弹窗问询用户处理策略,如图11和图12所示,该弹窗界面可以直接告知用户有关事件行为的内容及其风险,由用户选择相应的选项作为处理策略。用户选择相应选项并确定后,交互模块获得针对该特定事件行为的处理策略,将其反馈给监控单元34,监控单元34即可根据该用户指令所产生的处理策略对目标应用35的相应事件行为进行下一步的处理。(1) After the monitoring unit 34 captures a specific event behavior, it sends a request to the interaction module through the built-in interaction interface of the shell application, and the interaction module inquires the user processing strategy from the user interface pop-up window, as shown in Figure 11 and Figure 12 The pop-up window interface can directly inform the user about the content and risks of the event behavior, and the user can choose the corresponding option as a processing strategy. After the user selects the corresponding option and confirms it, the interaction module obtains the processing strategy for the specific event behavior, and feeds it back to the monitoring unit 34, and the monitoring unit 34 can respond to the corresponding event behavior of the target application 35 according to the processing strategy generated by the user instruction. Proceed to the next step.

(2)在某些已被公认为相对低风险的事件行为发生时,例如对联系人的只读操作行为,或者在用户为本发明设置了自行检索针对特定事件行为所应采取的处理策略时,本发明利用一本地策略数据库检索相应的针对特定事件行为的处理策略。例如,如图10所示,某个应用的所有事件行为的默认处理策略可以被以表单的形式给出。也就是说,该本地策略数据库中,建立了特定事件行为与相应的处理策略之间的关联,并且存储了多种事件行为与相应的处理策略之间对应关系的记录数据,可以供本发明检索使用。本发明从本地策略数据库中获取相应的处理策略后,方能对相应事件行为做下一步的处理。(2) When certain event behaviors that have been recognized as relatively low risk occur, such as the read-only operation behavior on contacts, or when the user sets the processing strategy for the invention to search for a specific event behavior by itself , the present invention utilizes a local policy database to retrieve corresponding processing policies for specific event behaviors. For example, as shown in FIG. 10 , the default processing policy for all event behaviors of an application can be given in the form of a form. That is to say, in the local policy database, the association between a specific event behavior and the corresponding processing strategy is established, and the record data of the corresponding relationship between various event behaviors and corresponding processing strategies is stored, which can be retrieved by the present invention use. After the present invention obtains the corresponding processing strategy from the local policy database, the next step of processing the corresponding event behavior can be performed.

(3)如果用户为本发明设置了远程获取处理策略的选项,或者默认在本地策略数据库检索不到特定事件行为的具体策略时可以远程获取,又或通过前述第(1)种情况进行交互而在规定时限内得不到用户对弹窗的响应,诸如此类的情况,外壳应用均可通过其内建的远程策略接口,向预架构的云端发送请求,获得对应于该特定事件行为的相应的处理策略,并用于后续的处理。(3) If the user sets the option of remote acquisition processing policy for the present invention, or by default, the specific policy of specific event behavior can be obtained remotely when the local policy database cannot retrieve it, or through the interaction in the aforementioned case (1) The user’s response to the pop-up window cannot be obtained within the specified time limit. In such cases, the shell application can send a request to the pre-architected cloud through its built-in remote policy interface to obtain the corresponding processing corresponding to the specific event behavior strategy and used for subsequent processing.

需要指出的是,有关以上三种获取处理策略的方式,可以交叉配合使用,例如,一旦交互模块接收到监控单元34传递的事件消息的特征,即可依照默认设置,参照第(2)种方式先行检索本地策略数据库,获得系统推荐的处理策略(如果不能从本地策略数据库中获得,甚至可以进一步按第(3)种方式从云端策略数据库中获取)。继而,参照第(1)种方式,在弹窗界面设置系统推荐的处理策略为默认选项。如果用户未在规定时限内确认该默认选项,则以系统推荐的处理策略为准执行后续指令;如果用户将之改变为新的默认选项,则向监控单元34返回用户设置的处理策略。可见,人机交互过程是可以更为灵活自由地实现的。It should be pointed out that the above three ways of obtaining processing strategies can be used in cross-coordination. For example, once the interaction module receives the characteristics of the event message transmitted by the monitoring unit 34, it can follow the default setting and refer to the method (2). Search the local policy database in advance to obtain the processing policy recommended by the system (if it cannot be obtained from the local policy database, it can even be further obtained from the cloud policy database according to (3) method). Then, referring to method (1), set the processing strategy recommended by the system as the default option on the pop-up window interface. If the user does not confirm the default option within the specified time limit, the subsequent instructions will be executed based on the processing strategy recommended by the system; if the user changes it to a new default option, the processing strategy set by the user will be returned to the monitoring unit 34 . It can be seen that the human-computer interaction process can be realized more flexibly and freely.

所述的本地策略数据库,可以是云端策略数据库的一个复件,因此,本发明中,设置一个更新步骤,用于下载云端策略数据库用于更新本地策略数据库。The local policy database may be a copy of the cloud policy database. Therefore, in the present invention, an updating step is set for downloading the cloud policy database for updating the local policy database.

一般情况下,针对特定事件行为的策略可以设置为“拒绝”、“运行”、“询问”三个常见选项,其表征的具体意向为:In general, the policy for a specific event behavior can be set to three common options of "deny", "run", and "ask", and the specific intentions represented by it are:

拒绝:针对该特定事件行为,向目标应用35发送事件行为已经执行完毕的虚假消息,以禁止该事件行为实际发生;Rejection: for the specific event behavior, send a false message that the event behavior has been executed to the target application 35, so as to prohibit the actual occurrence of the event behavior;

运行:针对该特定事件行为不做任何改变,将相应的事件消息直接转送给系统消息机制,允许目标应用35继续其事件行为;Running: no change is made to the specific event behavior, and the corresponding event message is directly forwarded to the system message mechanism, allowing the target application 35 to continue its event behavior;

询问:独立或依附于前述两个选项任意之一,针对该特定事件行为,标记其状态为未知状态,后续重复发生该行为时,需要再行弹窗询问用户。Inquiry: Independently or attached to any of the above two options, for the specific event behavior, mark its status as an unknown state, and when the behavior occurs repeatedly in the future, it is necessary to pop up a window to ask the user again.

实际应用中,选项“询问”可被忽略,仅需考虑是否拒绝或允许当前事件行为发生即可。In practical applications, the option "ask" can be ignored, and only need to consider whether to reject or allow the current event behavior to occur.

所述的事件行为,多种多样,具体包括如下几大类型:The described event behaviors are various, including the following major types:

(1)终端、联网有关的操作:(1) Operations related to terminal and networking:

获取运营商信息:目标应用35例如通过getSimOperatorName()函数可以获得移动终端的IMSI,由此可进一步判断运营商的名称,进一步可以向运营商发送约定指令,实现扣费之类的非法目的。监控平台通过挂钩与此相关的消息,便可以对事件行为的捕获。Obtaining operator information: the target application 35 can obtain the IMSI of the mobile terminal, for example, through the getSimOperatorName() function, thereby further determining the name of the operator, and further sending an agreed command to the operator to achieve illegal purposes such as deduction. The monitoring platform can capture the event behavior by hooking the related messages.

切换APN操作:同理,目标应用35通过与APN切换有关的函数实现ANP切换控制的操作,也可被监控单元34通过调用相应的挂钩插件进行监控。APN switching operation: similarly, the target application 35 realizes the operation of ANP switching control through functions related to APN switching, and can also be monitored by the monitoring unit 34 by calling the corresponding hook plug-in.

类似的操作,还包括获取手机识别码IME的操作,也与上述同理。Similar operations also include the operation of obtaining the mobile phone identification code IME, which is also the same as above.

(2)通知栏广告操作:通知栏广告是最易被恶意程序利用的手段,监控单元34通过调用相应的挂钩插件对notify函数产生的事件消息进行监控,也可对其实施监控。(2) Notification bar advertisement operation: Notification bar advertisement is the method most likely to be used by malicious programs. The monitoring unit 34 can monitor the event message generated by the notify function by calling the corresponding hook plug-in, and can also monitor it.

(3)通信操作:(3) Communication operation:

如电话拔打操作,通过StartActivity()函数可以监控拔打电话的事件行为,利用相应的挂钩插件可以对拔打电话操作建立事件行为监控。For example, the call operation can monitor the event behavior of the call through the StartActivity() function, and use the corresponding hook plug-in to establish event behavior monitoring for the call operation.

短信操作,对应于SendTextMessage()之类的函数,同理,可以借助挂钩插件对这类函数建立事件行为监控。SMS operation corresponds to functions such as SendTextMessage(). Similarly, event behavior monitoring can be established for such functions with the help of hook plug-ins.

联系人操作:一般对应于Query()、Insert()函数,监控单元34利用挂钩插件挂钩此类函数可以实现对此类事件行为的监控捕获。Contact operation: generally corresponds to the Query() and Insert() functions, and the monitoring unit 34 can use the hook plug-in to hook such functions to realize the monitoring and capturing of such event behaviors.

(4)命令操作:(4) Command operation:

如SU提权操作或执行命令操作,均需用到Execve()函数,监控单元34通过监控此函数的返回消息,便可实现该类事件行为的监控。The Execve() function is required for the SU privilege escalation operation or command execution operation, and the monitoring unit 34 can monitor the behavior of such events by monitoring the return message of this function.

(5)界面及访问操作:(5) Interface and access operations:

如创造快捷方式的事件行为,则对应于SentBroacast()函数。同理,对于隐藏程序图标的操作,也可对应特定函数监控之。For example, the event behavior of creating a shortcut corresponds to the SentBroacast() function. Similarly, for the operation of hiding the program icon, it can also be monitored corresponding to a specific function.

如HTTP网络访问操作,则对应于Sentto()、Write()等函数。Such as HTTP network access operations, corresponding to Sentto (), Write () and other functions.

(6)程序操作:(6) Program operation:

如应用加载操作,指当前目标应用35加载相关应用的操作,通过对dexclassloader()、loadlibrary()等函数进行挂钩监控,可以实现对此类事件行为的捕获。For example, an application loading operation refers to an operation in which the current target application 35 loads a related application. By hooking and monitoring functions such as dexclassloader() and loadlibrary(), such event behaviors can be captured.

又如安装子包,则对应于StartActivity()函数。Another example is installing a subpackage, which corresponds to the StartActivity() function.

(7)其它危险操作:(7) Other dangerous operations:

例如,子进程侵入操作、衍生物操作、激活设备管理器操作等,分别对应于。For example, child process intrusion operation, derivative operation, activate device manager operation, etc., correspond to respectively.

其中,子进程是指目标应用35建立的子进程,在目标应用35创建子进程时,监控单元34将收到相应的消息,而判定其创建子进程的事件行为。由此,监控单元34进一步向该子进程以内联钩子的方式在该子进程中植入监控单元34,后续便可继续对该子进程的事件行为进行监控。因而,无论是目标应用35的自身进程,还是其创建的子进程,它们直接或间接所触发的事件行为,均能被本发明的监控单元34所监控,使主动防御效果更佳。Wherein, the sub-process refers to the sub-process established by the target application 35. When the target application 35 creates a sub-process, the monitoring unit 34 will receive a corresponding message and determine the event behavior of creating the sub-process. Thus, the monitoring unit 34 further embeds the monitoring unit 34 in the sub-process in the form of an inline hook, so that the event behavior of the sub-process can be continuously monitored subsequently. Therefore, whether it is the target application 35's own process or its created sub-processes, the event behaviors triggered directly or indirectly by them can be monitored by the monitoring unit 34 of the present invention, so that the active defense effect is better.

而所述衍生物,是指目标应用35自行创建的文件,或者远程下载的文件,通常是指敏感的衍生物,例如安装包。通过挂钩fclose()函数可以捕获该事件。需要指出的是,当监控单元34捕获该事件行为后,可以按照前述的方法,进一步利用远程规则库接口发送请求到云端,由云端利用其黑、白、灰的安全等级行为规则判断该衍生物的安全等级,本发明通过远程规则库接口获得云端判定结果后,进一步弹窗询问用户是否建立对该敏感衍生物的主动防御,由此便可进一步巩固主动防御的效果。The derivative refers to a file created by the target application 35 itself, or a file downloaded remotely, and usually refers to a sensitive derivative, such as an installation package. This event can be captured by hooking the fclose() function. It should be pointed out that after the monitoring unit 34 captures the event behavior, it can further use the remote rule base interface to send a request to the cloud according to the aforementioned method, and the cloud can use its black, white, and gray security level behavior rules to judge the derivative. After obtaining the cloud judgment result through the remote rule library interface, the present invention further pops up a window to ask the user whether to establish an active defense against the sensitive derivative, thereby further consolidating the effect of active defense.

上述的事件行为仅为摘录之用,不能理解为对本发明监控的事件行为的限制。The above-mentioned event behaviors are only used for excerpts, and should not be construed as limitations on the event behaviors monitored by the present invention.

步骤S333显示,依据上述的处理策略和上述关于事件行为的说明,本发明的主动防御方法便可对各种事件行为进行相应的处理,其处理过程的概括在前文中已散列给出,以下进一步列举几种典型的应用实例:Step S333 shows that according to the above-mentioned processing strategy and the above-mentioned description about event behavior, the active defense method of the present invention can handle various event behaviors accordingly. Further enumerate several typical application examples:

(1)对目标应用35的精细拦截的应用:(1) The application of fine interception to the target application 35:

部分恶意程序被安装后,在相当长的一段时间内处于正常使用的状态,麻痹用户的安全意识。但是,运行一段长时间之后,该目标应用35尝试从后台插入一短信引起用户的关注,达到广告和诈骗的效果。参阅图12,对该目标应用35建立主动防御机制后,本发明如前所述,通过监控单元34中相应的挂钩插件对短信操作函数的监控,一旦目标应用35产生短信操作的事件行为,便可捕获这一事件行为,继而,监控单元34通过其交互接口通知作为系统服务运行的交互模块,由交互模块向用户界面弹窗示警。用户点选“拒绝”的处理策略后,被逆反馈给监控单元34,其中相应的挂钩插件便能阻该事件行为的实际发生,达到防范风险的目的。After some malicious programs are installed, they are in normal use for a long period of time, paralyzing the user's security awareness. However, after running for a long time, the target application 35 attempts to insert a short message from the background to attract the attention of the user, thereby achieving the effect of advertisement and fraud. Referring to Fig. 12, after the active defense mechanism is established for the target application 35, the present invention, as described above, monitors the SMS operation function through the corresponding hook plug-in in the monitoring unit 34. Once the target application 35 generates an event behavior of SMS operation, it will This event behavior can be captured, and then the monitoring unit 34 notifies the interactive module running as a system service through its interactive interface, and the interactive module pops up a warning to the user interface. After the user clicks the processing strategy of "reject", it is fed back to the monitoring unit 34, and the corresponding hook plug-in can prevent the actual occurrence of the event behavior and achieve the purpose of preventing risks.

(2)对目标应用35释放恶意文件的应用。(2) An application that releases malicious files to the target application 35 .

目标应用35为一游戏软件,通过检查更新的方式下载并释放恶意子包,并且调用系统功能安装该子包。本发明对该目标应用35建立了主动防御之后,可以监控到其下载完文件而产生的事件行为,据此通过交互模块弹窗告警。用户指令拒绝之后,监控单元34中相应的挂钩插件便可直接删除该文件,或者仅仅拒绝该文件的安装行为。The target application 35 is a game software, which downloads and releases a malicious subpackage by checking for updates, and calls a system function to install the subpackage. After the present invention establishes an active defense for the target application 35, it can monitor the event behavior generated by the target application 35 after it finishes downloading the file, and an alarm will be popped up through the interactive module accordingly. After the user instruction is rejected, the corresponding hook plug-in in the monitoring unit 34 can directly delete the file, or simply reject the installation of the file.

本发明中,对于诸如此类的恶意子包,视为敏感衍生物,对衍生物是否存在恶意的判断,参照前述防御配置方法中所述及的确定安全等级的方式进行远程判断。具体而言,当检测到产生衍生物时,将相应的文件或者其签名之类的特征信息通过远程规则库接口发送给云端,并从云端获得其安全等级,如果为黑、灰应用,则在弹窗中建议用户拒绝安装;如果为白应用,则可允许其通行。通过这种方法,便可实现对敏感衍生物的安全防御。如果云端检测不到该衍生物的相关记录,可以要求本方法为其上传该文件,并由云端标示为未知应用,相应的,以灰应用予以标记,以备后用。In the present invention, such malicious subpackages are regarded as sensitive derivatives, and whether the derivatives are maliciously judged refers to the method of determining the security level described in the aforementioned defense configuration method for remote judgment. Specifically, when a derivative is detected, the corresponding file or characteristic information such as its signature is sent to the cloud through the remote rule base interface, and its security level is obtained from the cloud. In the pop-up window, the user is suggested to refuse the installation; if it is a white application, it can be allowed to pass. In this way, security defense against sensitive derivatives can be achieved. If the cloud cannot detect the relevant records of the derivative, you can request this method to upload the file for it, and the cloud will mark it as an unknown application, and correspondingly, mark it as a gray application for future use.

(3)对子进程侵入的应用。(3) The application of sub-process intrusion.

被监控的目标应用35在运行过程中创建子进程,而子进程进一步释放恶意事件行为。监控单元34监控到目标应用35创建子进程时,即获得子进程的入口,然后向该子进程植入本发明的监控单元34,所有HOOK插件(挂钩插件)都会被以内联钩子的方式加载到该子进程中并初始化好实现挂钩,以便建立对该子进程的事件行为的监控。由此,可以看出,无论是由目标应用35进程直接触发的事件行为,还是由目标应用35进程所创建的子进程所触发的间接事件行为,均能被监控单元34成功监控。The monitored target application 35 creates sub-processes during running, and the sub-processes further release malicious event behaviors. When the monitoring unit 34 monitors that the target application 35 creates a sub-process, it obtains the entry of the sub-process, and then implants the monitoring unit 34 of the present invention into the sub-process, and all HOOK plug-ins (hook plug-ins) will be loaded into The child process is initialized to implement the hook, so as to establish the monitoring of the event behavior of the child process. From this, it can be seen that no matter the event behavior directly triggered by the process of the target application 35 or the indirect event behavior triggered by the child process created by the process of the target application 35 can be successfully monitored by the monitoring unit 34 .

以上通过S31、S32、S33共三个关键步骤,详细描述了本发明的主动防御方法的实现及其应用,可以看出,以该方法工作的主动防御技术,具有充分的可行性。The realization and application of the active defense method of the present invention have been described in detail through the three key steps of S31, S32, and S33 above. It can be seen that the active defense technology working with this method has sufficient feasibility.

进一步,适应上述主动防御方法,本发明进一步提供一种主动防御装置,两者也自然具有严密的对应性,以下对该装置进行具体揭示:Further, adapting to the above-mentioned active defense method, the present invention further provides an active defense device, both of which naturally have a strict correspondence, and the specific disclosure of the device is as follows:

本发明的主动防御装置,包括启动模块31、安防模块32以及处理模块33,各模块的具体功能及实现如下所示:The active defense device of the present invention includes a starting module 31, a security module 32 and a processing module 33, and the specific functions and realizations of each module are as follows:

所述的启动模块31,用于响应运行目标应用35的指令,运行相应的外壳应用。The startup module 31 is configured to run a corresponding shell application in response to an instruction to run the target application 35 .

参阅前述配置方法的说明可知,外壳应用被安装后,其文件名与原来的目标应用35的文件名相同,伪装成目标应用35,用户对目标应用35的操作,实际上,通过桌面图标指引的快捷方式,将被引导至运行预先伪装的外壳应用,此时,用户在用户界面上的点选操作便构成运行该外壳应用的运行指令。需要指出的是,运行目标应用35的指令并不局限于由用户触发,也包括如前所述的,由应用程序、定时任务或者通过其它公知途径以函数调用的方式执行的加载指令。外壳应用为轻应用,可以快速加载至内存中运行,对用户而言,其启动过程是透明的。Referring to the description of the aforementioned configuration method, it can be seen that after the shell application is installed, its file name is the same as that of the original target application 35, masquerading as the target application 35, and the user's operation on the target application 35 is actually guided by the desktop icon. The shortcut will be directed to run a pre-disguised shell application, and at this time, the user's click operation on the user interface constitutes an operation command to run the shell application. It should be noted that the instruction to run the target application 35 is not limited to being triggered by the user, but also includes, as mentioned above, a loading instruction executed by an application program, a timed task, or a function call through other known means. The shell application is a light application, which can be quickly loaded into the memory to run, and its startup process is transparent to the user.

外壳应用的图标是从目标应用35的默认图标改进的,一般是以该默认图标加图戳来实现这种改进,因而,从视觉效果上,还可起到一定的示警作用。The icon of the shell application is improved from the default icon of the target application 35, and the improvement is usually achieved by adding a picture to the default icon. Therefore, from the perspective of visual effects, it can also play a certain warning role.

一旦产生运行目标应用35的指令,本发明即作出响应,外壳应用随即被加载到JAVA虚拟机中运行。Once the command to run the target application 35 is generated, the present invention responds, and the shell application is loaded into the JAVA virtual machine to run.

所述的安防模块32,其主要实现外壳应用的加载过程,利用外壳应用先后加载监控单元34及所述目标应用35,由该监控单元34对该目标应用35的事件行为进行监控。The security module 32 mainly implements the loading process of the shell application. The shell application loads the monitoring unit 34 and the target application 35 successively, and the monitoring unit 34 monitors the event behavior of the target application 35 .

本发明的外壳应用中,其代码文件Classes.dex配置有桩模块nstub,通过该桩模块可以加载监控模块;其配置文件Androidmanifest.xml运用Java反射调用原理,对其中的配置参数进行修改,使其适于加载保存在所述指定目录中的目标应用35,此外,还对目标应用35的运行时配置参数进行了适应性的修改,确定目标应用35能正常运行。In the application of the shell of the present invention, its code file Classes.dex is configured with a pile module nstub, and the monitoring module can be loaded by the pile module; its configuration file Androidmanifest.xml uses the Java reflection calling principle to modify the configuration parameters therein so that it It is suitable for loading the target application 35 stored in the specified directory. In addition, the runtime configuration parameters of the target application 35 are also adaptively modified to ensure that the target application 35 can run normally.

因此,外壳应用运行后,首先通过桩模块调用监控单元34,所述监控单元34从一后台沙箱HOOK框架中获取对应于特定的事件行为的挂钩插件,利用该挂钩插件挂钩并监控目标应用35的特定事件行为。所述的后台沙箱HOOK框架,在云端进行集中管理,向各终端进行分发。其中,云端主要构造有Java挂钩插件库和Native挂钩插件库。监控单元34需要挂钩具体事件行为时,通过远程插件接口向后台沙箱HOOK框架发送请求,获得针对特定事件行为的HOOK函数,即所述的挂钩插件,借此建立对特定事件行为的监控捕获和处理。Therefore, after the shell application runs, the monitoring unit 34 is first invoked through the stub module, and the monitoring unit 34 obtains a hook plug-in corresponding to a specific event behavior from a background sandbox HOOK framework, and uses the hook plug-in to hook and monitor the target application 35 specific event behavior. The background sandbox HOOK framework is centrally managed in the cloud and distributed to each terminal. Among them, the main structure of the cloud is the Java hook plug-in library and the Native hook plug-in library. When the monitoring unit 34 needs to hook a specific event behavior, it sends a request to the background sandbox HOOK framework through the remote plug-in interface to obtain the HOOK function for the specific event behavior, that is, the hook plug-in, thereby establishing monitoring and capture of the specific event behavior. deal with.

进而,运行中的外壳应用将进一步加载所述位于指定目录中的目标应用35。如前所述,目标应用35调用,是利用公知的Java反射调用机制实现的。安防模块32中构造有配置模块,其由外壳应用的进程将LoadApk与ActivityThread涉及的运行时配置信息用反射替换成指定目录中目标应用35安装包的ClassLoader与资源,从而实现对目标应用35的加载。目标应用35被加载时,已被监控单元34利用挂钩插件建立了监控,因此,目标应用35的一切事件行为均在监控单元34的监控范围之内。位于目标应用35的安装包是完整未经修改的,因此,目标应用35被外壳应用加载后,能够完全合法、正常地运行,实现目标应用35原本能实现的所有功能。Furthermore, the running shell application will further load the target application 35 located in the specified directory. As mentioned above, the invocation of the target application 35 is realized by using the well-known Java reflective invocation mechanism. A configuration module is constructed in the security module 32, which uses reflection to replace the runtime configuration information involved in LoadApk and ActivityThread with the ClassLoader and resources of the target application 35 installation package in the specified directory by the process of the shell application, thereby realizing the loading of the target application 35 . When the target application 35 is loaded, it has already been monitored by the monitoring unit 34 using a hook plug-in. Therefore, all event behaviors of the target application 35 are within the monitoring range of the monitoring unit 34 . The installation package located in the target application 35 is complete and unmodified. Therefore, after the target application 35 is loaded by the shell application, it can run completely legally and normally, and realize all the functions that the target application 35 can originally realize.

由于监控单元34与目标应用35的加载,均为外壳应用进程所驱动,同为外壳应用进程的一部分,且监控单元34先于目标应用35加载,因而,运行中的监控单元34即建立了对目标应用35一切事件行为的监控。目标应用35运行过程中产生的任何事件行为,其事件消息均会被监控单元34捕获并进行相应的处理。Because the loading of the monitoring unit 34 and the target application 35 are all driven by the shell application process, they are also part of the shell application process, and the monitoring unit 34 is loaded earlier than the target application 35. Therefore, the monitoring unit 34 in operation has established a pair of The target application 35 monitors all event behaviors. Any event behavior generated during the running of the target application 35 will be captured by the monitoring unit 34 and processed accordingly.

所述的处理模块33,用于执行捕获事件行为之后的处理过程。The processing module 33 is configured to execute the processing after capturing the event behavior.

目标应用35产生的特定事件行为被监控单元34捕获,实质上是触发特定事件行为时,所产生的事件消息被监控单元34中相应的挂钩插件(钩子函数)所捕获。捕获该事件消息,即可知晓该事件的意图,继而可以进行后续的处理。The specific event behavior generated by the target application 35 is captured by the monitoring unit 34 , in essence, when the specific event behavior is triggered, the generated event message is captured by the corresponding hook plug-in (hook function) in the monitoring unit 34 . By capturing the event message, the intent of the event can be known, and subsequent processing can be performed.

对特定事件行为进行处理,需要获取事件行为处理策略。在这一子步骤中,可以进一步借助系统服务来实现人机交互功能。为了实现人机交互效果,本发明预先将一交互模块注册为系统服务,外壳应用可以通过其交互接口与该交互模块通信,从而实现外壳应用对用户指令或预设指令的获取。To process a specific event behavior, it is necessary to obtain an event behavior processing strategy. In this sub-step, the human-computer interaction function can be further implemented with the help of system services. In order to realize the human-computer interaction effect, the present invention pre-registers an interaction module as a system service, and the shell application can communicate with the interaction module through its interaction interface, thereby realizing the acquisition of user instructions or preset instructions by the shell application.

如前所述,事件行为策略的获取方式非常灵活多样,通过构造一策略生成装置来执行,以下列举几种为本发明所择一或任意组合使用的策略:As mentioned above, the acquisition mode of the event behavior strategy is very flexible and diverse, and is executed by constructing a strategy generating device. The following lists several strategies for the present invention to choose one or use in any combination:

(1)监控单元34捕获特定事件行为后,通过外壳应用内建的交互接口,向所述交互模块发送请求,由交互模块向用户界面弹窗问询用户处理策略,该弹窗界面可以直接告知用户有关事件行为的内容及其风险,由用户选择相应的选项作为处理策略。用户选择相应选项并确定后,交互模块获得针对该特定事件行为的处理策略,将其反馈给监控单元34,监控单元34即可根据该用户指令所产生的处理策略对目标应用35的相应事件行为进行下一步的处理。(1) After the monitoring unit 34 captures a specific event behavior, it sends a request to the interaction module through the built-in interaction interface of the shell application, and the interaction module inquires the user's processing strategy from the pop-up window of the user interface, and the pop-up window interface can directly inform The content and risk of the user's event behavior, the user selects the corresponding option as a processing strategy. After the user selects the corresponding option and confirms it, the interaction module obtains the processing strategy for the specific event behavior, and feeds it back to the monitoring unit 34, and the monitoring unit 34 can respond to the corresponding event behavior of the target application 35 according to the processing strategy generated by the user instruction. Proceed to the next step.

(2)在某些已被公认为相对低风险的事件行为发生时,例如对联系人的只读操作行为,或者在用户为本发明设置了自行检索针对特定事件行为所应采取的处理策略时,本发明利用一本地策略数据库检索相应的针对特定事件行为的处理策略。也就是说,该本地策略数据库中,建立了特定事件行为与相应的处理策略之间的关联,并且存储了多种事件行为与相应的处理策略之间对应关系的记录数据,可以供本发明检索使用。本发明从本地策略数据库中获取相应的处理策略后,方能对相应事件行为做下一步的处理。(2) When certain event behaviors that have been recognized as relatively low risk occur, such as the read-only operation behavior on contacts, or when the user sets the processing strategy for the invention to search for a specific event behavior by itself , the present invention utilizes a local policy database to retrieve corresponding processing policies for specific event behaviors. That is to say, in the local policy database, the association between the specific event behavior and the corresponding processing strategy is established, and the record data of the corresponding relationship between various event behaviors and corresponding processing strategies is stored, which can be retrieved by the present invention use. After the present invention obtains the corresponding processing strategy from the local policy database, the next step of processing the corresponding event behavior can be performed.

(3)如果用户为本发明设置了远程获取处理策略的选项,或者默认在本地策略数据库检索不到特定事件行为的具体策略时可以远程获取,又或通过前述第(1)种情况进行交互而在规定时限内得不到用户对弹窗的响应,诸如此类的情况,外壳应用均可通过其内建的远程策略接口,向预架构的云端发送请求,获得对应于该特定事件行为的相应的处理策略,并用于后续的处理。(3) If the user sets the option of remote acquisition processing policy for the present invention, or by default, the specific policy of specific event behavior can be obtained remotely when the local policy database cannot retrieve it, or through the interaction in the aforementioned case (1) If the user fails to respond to the pop-up window within the specified time limit, the shell application can send a request to the pre-architected cloud through its built-in remote policy interface to obtain the corresponding processing corresponding to the specific event behavior strategy and used for subsequent processing.

需要指出的是,有关以上三种获取处理策略的方式,可以交叉配合使用,例如,一旦交互模块接收到监控单元34传递的事件消息的特征,即可依照默认设置,参照第(2)种方式先行检索本地策略数据库,获得系统推荐的处理策略(如果不能从本地策略数据库中获得,甚至可以进一步按第(3)种方式从云端策略数据库中获取)。继而,参照第(1)种方式,在弹窗界面设置系统推荐的处理策略为默认选项。如果用户未在规定时限内确认该默认选项,则以系统推荐的处理策略为准执行后续指令;如果用户将之改变为新的默认选项,则向监控单元34返回用户设置的处理策略。可见,人机交互过程是可以更为灵活自由地实现的。It should be pointed out that the above three ways of obtaining processing strategies can be used in cross-coordination. For example, once the interaction module receives the characteristics of the event message transmitted by the monitoring unit 34, it can follow the default setting and refer to the method (2). Search the local policy database in advance to obtain the processing policy recommended by the system (if it cannot be obtained from the local policy database, it can even be further obtained from the cloud policy database according to (3) method). Then, referring to method (1), set the processing strategy recommended by the system as the default option on the pop-up window interface. If the user does not confirm the default option within the specified time limit, the subsequent instructions will be executed based on the processing strategy recommended by the system; if the user changes it to a new default option, the processing strategy set by the user will be returned to the monitoring unit 34 . It can be seen that the human-computer interaction process can be realized more flexibly and freely.

所述的本地策略数据库,可以是云端策略数据库的一个复件,因此,本发明中,设置一个更新步骤,用于下载云端策略数据库用于更新本地策略数据库。The local policy database may be a copy of the cloud policy database. Therefore, in the present invention, an updating step is set for downloading the cloud policy database for updating the local policy database.

一般情况下,针对特定事件行为的策略可以设置为“拒绝”、“运行”、“询问”三个常见选项,其表征的具体意向为:In general, the policy for a specific event behavior can be set to three common options of "deny", "run", and "ask", and the specific intentions represented by it are:

拒绝:针对该特定事件行为,向目标应用35发送事件行为已经执行完毕的虚假消息,以禁止该事件行为实际发生;Rejection: for the specific event behavior, send a false message that the event behavior has been executed to the target application 35, so as to prohibit the actual occurrence of the event behavior;

运行:针对该特定事件行为不做任何改变,将相应的事件消息直接转送给系统消息机制,允许目标应用35继续其事件行为;Running: no change is made to the specific event behavior, and the corresponding event message is directly forwarded to the system message mechanism, allowing the target application 35 to continue its event behavior;

询问:独立或依附于前述两个选项任意之一,针对该特定事件行为,标记其状态为未知状态,后续重复发生该行为时,需要再行弹窗询问用户。Inquiry: Independently or attached to any of the above two options, for the specific event behavior, mark its status as an unknown state, and when the behavior occurs repeatedly in the future, it is necessary to pop up a window to ask the user again.

实际应用中,选项“询问”可被忽略,仅需考虑是否拒绝或允许当前事件行为发生即可。In practical applications, the option "ask" can be ignored, and only need to consider whether to reject or allow the current event behavior to occur.

所述的事件行为,多种多样,具体包括如下几大类型:The described event behaviors are various, including the following major types:

(1)终端、联网有关的操作:(1) Operations related to terminal and networking:

获取运营商信息:目标应用35例如通过getSimOperatorName()函数可以获得移动终端的IMSI,由此可进一步判断运营商的名称,进一步可以向运营商发送约定指令,实现扣费之类的非法目的。监控平台通过挂钩与此相关的消息,便可以对事件行为的捕获。Obtaining operator information: the target application 35 can obtain the IMSI of the mobile terminal, for example, through the getSimOperatorName() function, thereby further determining the name of the operator, and further sending an agreed command to the operator to achieve illegal purposes such as deduction. The monitoring platform can capture the event behavior by hooking the related messages.

切换APN操作:同理,目标应用35通过与APN切换有关的函数实现ANP切换控制的操作,也可被监控单元34通过调用相应的挂钩插件进行监控。APN switching operation: similarly, the target application 35 realizes the operation of ANP switching control through functions related to APN switching, and can also be monitored by the monitoring unit 34 by calling the corresponding hook plug-in.

类似的操作,还包括获取手机识别码IME的操作,也与上述同理。Similar operations also include the operation of obtaining the mobile phone identification code IME, which is also the same as above.

(2)通知栏广告操作:通知栏广告是最易被恶意程序利用的手段,监控单元34通过调用相应的挂钩插件对notify函数产生的事件消息进行监控,也可对其实施监控。(2) Notification bar advertisement operation: Notification bar advertisement is the method most likely to be used by malicious programs. The monitoring unit 34 can monitor the event message generated by the notify function by calling the corresponding hook plug-in, and can also monitor it.

(3)通信操作:(3) Communication operation:

如电话拔打操作,通过StartActivity()函数可以监控拔打电话的事件行为,利用相应的挂钩插件可以对拔打电话操作建立事件行为监控。For example, the call operation can monitor the event behavior of the call through the StartActivity() function, and use the corresponding hook plug-in to establish event behavior monitoring for the call operation.

短信操作,对应于SendTextMessage()之类的函数,同理,可以借助挂钩插件对这类函数建立事件行为监控。SMS operation corresponds to functions such as SendTextMessage(). Similarly, event behavior monitoring can be established for such functions with the help of hook plug-ins.

联系人操作:一般对应于Query()、Insert()函数,监控单元34利用挂钩插件挂钩此类函数可以实现对此类事件行为的监控捕获。Contact operation: generally corresponds to the Query() and Insert() functions, and the monitoring unit 34 can use the hook plug-in to hook such functions to realize the monitoring and capturing of such event behaviors.

(4)命令操作:(4) Command operation:

如SU提权操作或执行命令操作,均需用到Execve()函数,监控单元34通过监控此函数的返回消息,便可实现该类事件行为的监控。The Execve() function is required for the SU privilege escalation operation or command execution operation, and the monitoring unit 34 can monitor the behavior of such events by monitoring the return message of this function.

(5)界面及访问操作:(5) Interface and access operations:

如创造快捷方式的事件行为,则对应于SentBroacast()函数。同理,对于隐藏程序图标的操作,也可对应特定函数监控之。For example, the event behavior of creating a shortcut corresponds to the SentBroacast() function. Similarly, for the operation of hiding the program icon, it can also be monitored corresponding to a specific function.

如HTTP网络访问操作,则对应于Sentto()、Write()等函数。Such as HTTP network access operations, corresponding to Sentto (), Write () and other functions.

(6)程序操作:(6) Program operation:

如应用加载操作,指当前目标应用35加载相关应用的操作,通过对dexclassloader()、loadlibrary()等函数进行挂钩监控,可以实现对此类事件行为的捕获。For example, an application loading operation refers to an operation in which the current target application 35 loads a related application. By hooking and monitoring functions such as dexclassloader() and loadlibrary(), such event behaviors can be captured.

又如安装子包,则对应于StartActivity()函数。Another example is installing a subpackage, which corresponds to the StartActivity() function.

(7)其它危险操作:(7) Other dangerous operations:

例如,子进程侵入操作、衍生物操作、激活设备管理器操作等,分别对应于。For example, child process intrusion operation, derivative operation, activate device manager operation, etc., correspond to respectively.

其中,子进程是指目标应用35建立的子进程,在目标应用35创建子进程时,监控单元34将收到相应的消息,而判定其创建子进程的事件行为。由此,监控单元34进一步向该子进程以内联钩子的方式在该子进程中植入监控单元34,后续便可继续对该子进程的事件行为进行监控。因而,无论是目标应用35的自身进程,还是其创建的子进程,它们直接或间接所触发的事件行为,均能被本发明的监控单元34所监控,使主动防御效果更佳。Wherein, the sub-process refers to the sub-process established by the target application 35. When the target application 35 creates a sub-process, the monitoring unit 34 will receive a corresponding message and determine the event behavior of creating the sub-process. Thus, the monitoring unit 34 further embeds the monitoring unit 34 in the sub-process in the form of an inline hook, so that the event behavior of the sub-process can be continuously monitored subsequently. Therefore, whether it is the target application 35's own process or its created sub-processes, the event behaviors triggered directly or indirectly by them can be monitored by the monitoring unit 34 of the present invention, so that the active defense effect is better.

而所述衍生物,是指目标应用35自行创建的文件,或者远程下载的文件,通常是指敏感的衍生物,例如安装包。通过挂钩fclose()函数可以捕获该事件。需要指出的是,当监控单元34捕获该事件行为后,可以按照前述的方法,进一步利用远程规则库接口发送请求到云端,由云端利用其黑、白、灰的安全等级行为规则判断该衍生物的安全等级,本发明通过远程规则库接口获得云端判定结果后,进一步弹窗询问用户是否建立对该敏感衍生物的主动防御,由此便可进一步巩固主动防御的效果。The derivative refers to a file created by the target application 35 itself, or a file downloaded remotely, and usually refers to a sensitive derivative, such as an installation package. This event can be captured by hooking the fclose() function. It should be pointed out that after the monitoring unit 34 captures the event behavior, it can further use the remote rule base interface to send a request to the cloud according to the aforementioned method, and the cloud can use its black, white, and gray security level behavior rules to judge the derivative. After obtaining the cloud judgment result through the remote rule library interface, the present invention further pops up a window to ask the user whether to establish an active defense against the sensitive derivative, thereby further consolidating the effect of active defense.

上述的事件行为仅为摘录之用,不能理解为对本发明监控的事件行为的限制。The above-mentioned event behaviors are only used for excerpts, and should not be construed as limitations on the event behaviors monitored by the present invention.

依据上述的处理策略和上述关于事件行为的说明,本发明的主动防御方法便可对各种事件行为进行相应的处理。以下列举几种典型的应用实例:According to the above-mentioned processing strategies and the above-mentioned explanations about event behaviors, the active defense method of the present invention can handle various event behaviors accordingly. Several typical application examples are listed below:

(1)对目标应用35的精细拦截的应用:(1) Application of fine interception to the target application 35:

部分恶意程序被安装后,在相当长的一段时间内处于正常使用的状态,麻痹用户的安全意识。但是,运行一段长时间之后,该目标应用35尝试从后台插入一短信引起用户的关注,达到广告和诈骗的效果。对该目标应用35建立主动防御机制后,本发明如前所述,通过监控单元34中相应的挂钩插件对短信操作函数的监控,一旦目标应用35产生短信操作的事件行为,便可捕获这一事件行为,继而,监控单元34通过其交互接口通知作为系统服务运行的交互模块,由交互模块向用户界面弹窗示警。用户点选“拒绝”的处理策略后,被逆反馈给监控单元34,其中相应的挂钩插件便能阻该事件行为的实际发生,达到防范风险的目的。After some malicious programs are installed, they are in normal use for a long period of time, paralyzing the user's security awareness. However, after running for a long time, the target application 35 attempts to insert a short message from the background to attract the user's attention, thereby achieving the effect of advertising and fraud. After the active defense mechanism is established for the target application 35, as mentioned above, the present invention monitors the SMS operation function through the corresponding hook plug-in in the monitoring unit 34. Once the target application 35 generates an event behavior of SMS operation, it can capture this The event behavior, and then, the monitoring unit 34 notifies the interactive module running as a system service through its interactive interface, and the interactive module pops up a warning to the user interface. After the user clicks the processing strategy of "deny", it is fed back to the monitoring unit 34, and the corresponding hook plug-in can prevent the actual occurrence of the event behavior and achieve the purpose of preventing risks.

(2)对目标应用35释放恶意文件的应用。(2) An application that releases malicious files to the target application 35 .

目标应用35为一游戏软件,通过检查更新的方式下载并释放恶意子包,并且调用系统功能安装该子包。本发明对该目标应用35建立了主动防御之后,可以监控到其下载完文件而产生的事件行为,据此通过交互模块弹窗告警。用户指令拒绝之后,监控单元34中相应的挂钩插件便可直接删除该文件,或者仅仅拒绝该文件的安装行为。The target application 35 is a game software, which downloads and releases a malicious subpackage by checking for updates, and calls a system function to install the subpackage. After the present invention establishes an active defense for the target application 35, it can monitor the event behavior generated by the target application 35 after it finishes downloading the file, and an alarm will be popped up through the interactive module accordingly. After the user instruction is rejected, the corresponding hook plug-in in the monitoring unit 34 can directly delete the file, or simply reject the installation of the file.

本发明中,对于诸如此类的恶意子包,视为敏感衍生物,对衍生物是否存在恶意的判断,参照前述防御配置方法中所述及的确定安全等级的方式进行远程判断。具体而言,当检测到产生衍生物时,将相应的文件或者其签名之类的特征信息通过远程规则库接口发送给云端,并从云端获得其安全等级,如果为黑、灰应用,则在弹窗中建议用户拒绝安装;如果为白应用,则可允许其通行。通过这种方法,便可实现对敏感衍生物的安全防御。如果云端检测不到该衍生物的相关记录,可以要求本方法为其上传该文件,并由云端标示为未知应用,相应的,以灰应用予以标记,以备后用。In the present invention, such malicious subpackages are regarded as sensitive derivatives, and whether the derivatives are maliciously judged refers to the method of determining the security level described in the aforementioned defense configuration method for remote judgment. Specifically, when a derivative is detected, the corresponding file or characteristic information such as its signature is sent to the cloud through the remote rule base interface, and its security level is obtained from the cloud. In the pop-up window, the user is suggested to refuse the installation; if it is a white application, it can be allowed to pass. In this way, security defense against sensitive derivatives can be achieved. If the cloud cannot detect the relevant records of the derivative, you can request this method to upload the file for it, and the cloud will mark it as an unknown application, and correspondingly, mark it as a gray application for future use.

(3)对子进程侵入的应用。(3) The application of sub-process intrusion.

被监控的目标应用35在运行过程中创建子进程,而子进程进一步释放恶意事件行为。监控单元34监控到目标应用35创建子进程时,即获得子进程的入口,然后向该子进程植入本发明的监控单元34,所有HOOK插件(挂钩插件)都会被以内联钩子的方式加载到该子进程中并初始化好实现挂钩,以便建立对该子进程的事件行为的监控。由此,可以看出,无论是由目标应用35进程直接触发的事件行为,还是由目标应用35进程所创建的子进程所触发的间接事件行为,均能被监控单元34成功监控。The monitored target application 35 creates sub-processes during running, and the sub-processes further release malicious event behaviors. When the monitoring unit 34 monitors that the target application 35 creates a sub-process, it obtains the entry of the sub-process, and then implants the monitoring unit 34 of the present invention into the sub-process, and all HOOK plug-ins (hook plug-ins) will be loaded into The child process is initialized to implement the hook, so as to establish the monitoring of the event behavior of the child process. From this, it can be seen that no matter the event behavior directly triggered by the process of the target application 35 or the indirect event behavior triggered by the child process created by the process of the target application 35 can be successfully monitored by the monitoring unit 34 .

由上述的分析可见,本发明的主动防御装置,相应于主动防御方法,具有高效的可行性。It can be seen from the above analysis that the active defense device of the present invention, corresponding to the active defense method, has high efficiency and feasibility.

为便于本领域技术人员进一步实现本发明,以下进一步揭示云端服务器与终端设备如何相互配合实现安装包安全等级判断的相关内容:In order to facilitate those skilled in the art to further realize the present invention, the following further discloses how the cloud server and the terminal device cooperate with each other to realize the relevant content of judging the security level of the installation package:

如前所述,由客户端通过远程规则库接口发送到云端服务器的特征信息,包括:Android安装包的包名,和/或,版本号,和/或,数字签名,和/或,Android组件receiver的特征,和/或,Android组件service的特征,和/或,Android组件activity的特征,和/或,可执行文件中的指令或字符串,和/或,Android安装包目录下各文件的MD5值(签名)。As mentioned above, the feature information sent by the client to the cloud server through the remote rule base interface includes: the package name of the Android installation package, and/or, the version number, and/or, the digital signature, and/or, the Android component The characteristics of the receiver, and/or, the characteristics of the Android component service, and/or, the characteristics of the Android component activity, and/or, the instructions or strings in the executable file, and/or, the characteristics of each file in the Android installation package directory MD5 value (signature).

实现了本发明的方法或装置的客户端,将指定的特征信息上传到服务器(云端),在服务器预置的规则库中查找与指定的单个特征信息或其组合相匹配的特征记录;其中,所述服务器预置的规则库中包含特征记录及特征记录对应的安全级别,每条特征记录中包含单个特征信息或特征信息的组合;The client that realizes the method or device of the present invention uploads the specified feature information to the server (cloud), and searches for a feature record that matches the specified single feature information or its combination in the rule library preset by the server; wherein, The rule library preset by the server includes feature records and security levels corresponding to the feature records, and each feature record includes a single feature information or a combination of feature information;

服务器端规则库中预置了数千条特征记录,其中,第一条特征记录中列出了某种病毒的Android安装包包名,第二条特征记录中列出了某个正常应用的Android安装包版本号及其数字签名的MD5值,第三条特征记录中列出了某个正常应用的Android安装包包名及其receiver特征,第四条特征记录中列出了某种木马的Android安装包包名、版本号及其ELF文件中的特定字符串,等等。Thousands of feature records are preset in the server-side rule base. Among them, the first feature record lists the Android installation package name of a certain virus, and the second feature record lists the Android installation package name of a normal application. The version number of the installation package and the MD5 value of its digital signature, the third feature record lists the Android installation package name of a normal application and its receiver features, and the fourth feature record lists a certain Trojan Android Install the package name, version number and specific strings in its ELF file, etc.

关于安全等级的标识,即黑,白(安全)或者灰(未知,可疑)三种标识,可以进一步的表示为:Regarding the identification of the security level, that is, three identifications of black, white (safe) or gray (unknown, suspicious), it can be further expressed as:

安全:该应用是一个正常的应用,没有任何威胁用户手机安全的行为;Security: The application is a normal application, without any behavior that threatens the security of the user's mobile phone;

危险:该应用存在安全风险,有可能该应用本身就是恶意软件;也有可能该应用本来是正规公司发布的正常软件,但是因为存在安全漏洞,导致用户的隐私、手机安全受到威胁;Dangerous: This application has security risks. It is possible that the application itself is malicious software; it is also possible that the application is originally a normal software released by a regular company, but because of security holes, the user's privacy and mobile phone security are threatened;

谨慎:该应用是一个正常的应用,但是存在一些问题,例如会让用户不小心被扣费,或者有不友好的广告遭到投诉等;当发现这类应用之后,会提示用户谨慎使用并告知该应用可能的行为,但是由用户自行决定是否清除该应用;Cautious: The app is a normal app, but there are some problems, such as users being charged accidentally, or complaints about unfriendly advertisements, etc.; when such an app is found, the user will be prompted to use it with caution and inform possible behavior of the app, but it is at the user's discretion whether to clear the app;

木马:该应用是病毒、木马或者其他恶意软件,此处为了简单统称为木马,但并不表示该应用仅仅是木马。Trojan horse: The application is a virus, Trojan horse or other malicious software, which is collectively referred to as a Trojan horse here for simplicity, but it does not mean that the application is just a Trojan horse.

应当理解,云端与客户端之间的配合,可以由本领域技术人员根据本发明所揭示的内容进一步扩充、变换、增删而改善。因而,以上揭示的内容不应理解为实现本发明的方法和装置的限制。It should be understood that the cooperation between the cloud and the client can be improved by further expansion, transformation, addition and deletion by those skilled in the art according to the content disclosed in the present invention. Accordingly, the above disclosure should not be construed as limiting the method and apparatus for implementing the present invention.

经过测试,本发明相对于现有技术有了较宽广的应用范围和应用效果,以下略加阐述:After testing, the present invention has wider range of application and application effect relative to the prior art, as follows:

由于本发明已经将HOOK框架做成了服务平台,以挂钩插件的方式为终端配置监控单元34,因此,其加载仅需依赖于相应的配置文件,管理高效且易于实现,对技术人员而言,一些简单的函数调用仅需编写配置文件即可实现挂钩插件的配置,HOOK重入、并发性能高。Since the present invention has made the HOOK framework into a service platform, and configures the monitoring unit 34 for the terminal in the form of a hook plug-in, its loading only needs to depend on the corresponding configuration file, and the management is efficient and easy to implement. For technicians, Some simple function calls only need to write the configuration file to realize the configuration of the hook plug-in, HOOK is reentrant and has high concurrency performance.

采用外壳应用先后实现对监控单元34和目标应用35的加载,继而借助监控单元34对目标应用35的事件行为建立监控,可以实现对Java函数、Native函数的挂钩。The shell application is used to load the monitoring unit 34 and the target application 35 successively, and then monitor the event behavior of the target application 35 by means of the monitoring unit 34, which can realize the hooking of Java functions and Native functions.

本发明不仅适用于Dalvik模式,也适用于ART模式,功能表现上两者无异,使用者不需适应不同模式编写不同的代码,简化开发工作(小范围内测试Android版本号4.4.2、4.4.3、4.4.4)。The present invention is not only applicable to the Dalvik mode, but also to the ART mode. There is no difference between the two in terms of functional performance, and the user does not need to adapt to different modes to write different codes, which simplifies the development work (test Android version numbers 4.4.2, 4.4 in a small range .3, 4.4.4).

经实测,有如下数据佐证本发明的实例的优越性:After actual measurement, the following data are provided to prove the superiority of the examples of the present invention:

(1)本发明的开发实例,在16部手机上对107款主流应用软件(如QQ、微信,微博,手机卫士,支付类、多种团购app,各视频播放软件等)进行了稳定性深度测试,均能正常运行。(1) In the development example of the present invention, on 16 mobile phones, 107 mainstream application software (such as QQ, WeChat, Weibo, mobile phone guard, payment class, multiple group buying apps, each video player software, etc.) have been stabilized Depth test, all can run normally.

(2)本发明的开发实例,测试涵盖手机Android操作系统版本号从2.3到4.4.3。机型包括nexus4/5、7,三星,小米,华为,联想,索尼,HTC及部分山寨手机,均获得较为优异的表现。(2) The development example of the present invention, test covers mobile phone Android operating system version number from 2.3 to 4.4.3. Models include nexus4/5, 7, Samsung, Xiaomi, Huawei, Lenovo, Sony, HTC and some counterfeit mobile phones, all of which achieved relatively excellent performance.

(3)本发明的开发实例,支持加固应用,如支持360加固、网秦加固,腾讯加固、梆梆和爱加密、APKProtect等,对于以上各家厂商提供的加固应用的测试显示,本发明的实例均可正常运行。(3) The development examples of the present invention support reinforcement applications, such as support for 360 reinforcement, NetQin reinforcement, Tencent reinforcement, Bangbang and love encryption, APKProtect, etc. For the reinforcement applications provided by the above manufacturers, the test shows that the present invention Instances are running normally.

(4)本发明的开发实例的测试效果显示,手机端生成外壳包的成功率为99.7%(基数为100W)。(4) The test result of the development example of the present invention shows that the success rate of generating the shell package at the mobile terminal is 99.7% (the base is 100W).

综上所述,本发明所提供的主动防御技术更为安全高效。To sum up, the active defense technology provided by the present invention is safer and more efficient.

以上所述仅是本发明的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above descriptions are only part of the embodiments of the present invention. It should be pointed out that those skilled in the art can make some improvements and modifications without departing from the principles of the present invention. It should be regarded as the protection scope of the present invention.

Claims (16)

1.一种主动防御方法,其特征在于,其包括如下步骤:1. A kind of active defense method, it is characterized in that, it comprises the steps: 响应运行目标应用的指令,运行相应的外壳应用;Responding to an instruction to run a target application, run a corresponding shell application; 利用外壳应用先后加载监控单元及所述目标应用,由该监控单元调用从远程插件接口获得的对应于特定事件行为的挂钩插件,在运行时挂钩所述目标应用进程所触发的事件行为,并在所述监控单元监测到目标应用进程释放子进程的事件行为时,向所述目标应用的子进程以内联钩子的形式注入监控单元,以对该目标应用及其创建的子进程的事件行为进行监控捕获;Use the shell application to load the monitoring unit and the target application successively, and the monitoring unit calls the hook plug-in corresponding to the specific event behavior obtained from the remote plug-in interface, hooks the event behavior triggered by the target application process at runtime, and When the monitoring unit monitors the event behavior of the target application process releasing the sub-process, it injects the monitoring unit into the sub-process of the target application in the form of an inline hook, so as to monitor the event behavior of the target application and the sub-process it creates capture; 特定事件行为被捕获后,获取事件行为处理策略,依据所述处理策略对该特定事件行为进行处理。After the specific event behavior is captured, an event behavior processing strategy is obtained, and the specific event behavior is processed according to the processing strategy. 2.根据权利要求1所述的主动防御方法,其特征在于包括如下前置步骤:在图形用户界面中提供快捷方式用于获取所述运行目标应用的指令,该快捷方式的图标由目标应用默认图标修改而得。2. The active defense method according to claim 1, characterized in that it comprises the following pre-step: providing a shortcut in the graphical user interface for obtaining instructions for running the target application, and the icon of the shortcut is defaulted by the target application The icon has been modified. 3.根据权利要求1所述的主动防御方法,其特征在于,所述监控模块所监控的事件行为包括以下任意一种或多种行为类型:获取运营商信息、APN操作、通知栏广告操作、获取手机识别码操作、创建快捷方式、电话拔打操作、短信插入或删除操作、联系人插入或删除操作、URL访问操作、子进程侵入操作、应用加载操作、命令操作、衍生物操作、激活设备管理器操作。3. The active defense method according to claim 1, wherein the event behavior monitored by the monitoring module includes any one or more of the following behavior types: obtaining operator information, APN operation, notification bar advertisement operation, Obtain mobile phone identification code operations, create shortcuts, call operations, insert or delete text messages, insert or delete contacts, URL access operations, sub-process intrusion operations, application loading operations, command operations, derivative operations, activate devices Manager action. 4.根据权利要求1所述的主动防御方法,其特征在于,所述监控模块监控到目标应用触发产生衍生物的事件行为时,通过远程规则库接口获取针对该衍生物的处理规则并处理该衍生物。4. The active defense method according to claim 1, wherein when the monitoring module detects that the target application triggers an event behavior that generates a derivative, it acquires a processing rule for the derivative through a remote rule base interface and processes the derivative. derivative. 5.根据权利要求1所述的主动防御方法,其特征在于,该方法包括将预设的交互模块注册为系统服务的步骤,外壳应用通过其内建的交互接口与该交互模块通信,借助该交互模块向用户界面弹窗实现人机交互。5. The active defense method according to claim 1, characterized in that the method comprises the step of registering a preset interactive module as a system service, and the shell application communicates with the interactive module through its built-in interactive interface, by means of which The interaction module realizes human-computer interaction to the pop-up window of the user interface. 6.根据权利要求1所述的主动防御方法,其特征在于,所述外壳应用采用JAVA反射调用的方式动态加载所述目标应用。6. The active defense method according to claim 1, wherein the shell application dynamically loads the target application by way of JAVA reflection call. 7.根据权利要求1所述的主动防御方法,其特征在于,捕获事件行为后,以如下任意方式至少之一获取针对该事件行为的所述处理策略:7. The active defense method according to claim 1, characterized in that, after the event behavior is captured, the processing strategy for the event behavior is obtained in at least one of the following arbitrary ways: 向用户界面弹窗告警,接收用户指令以获得所述的处理策略;Alerting the user interface with a pop-up window, receiving user instructions to obtain the processing strategy; 从本地策略数据库中检索获得对应的处理策略;Retrieving the corresponding processing policy from the local policy database; 通过远程策略接口向云端发送请求并获得对应反馈的处理策略。Send a request to the cloud through the remote policy interface and obtain the corresponding feedback processing policy. 8.根据权利要求1至7中任意一项所述的主动防御方法,其特征在于,还包括如下步骤:下载云端策略数据库并更新本地策略数据库,该本地策略数据库用于提供对应于具体目标应用的特定事件行为的处理策略。8. The active defense method according to any one of claims 1 to 7, further comprising the steps of: downloading the cloud policy database and updating the local policy database, the local policy database is used to provide information corresponding to specific target applications The processing strategy for specific event behavior. 9.一种主动防御装置,其特征在于,其包括:9. An active defense device, characterized in that it comprises: 启动模块,用于响应运行目标应用的指令,运行相应的外壳应用;A startup module, configured to run a corresponding shell application in response to an instruction to run the target application; 安防模块,其利用外壳应用先后加载监控单元及所述目标应用,由该监控单元调用从远程插件接口获得的对应于特定事件行为的挂钩插件,在运行时挂钩所述目标应用进程所触发的事件行为,并在监控单元监测到目标应用进程释放子进程的事件行为时,向目标应用的子进程以内联钩子的形式注入监控单元,以对该目标应用及其创建的子进程的事件行为进行监控捕获;The security module, which uses the shell application to successively load the monitoring unit and the target application, and the monitoring unit invokes the hook plug-in corresponding to the specific event behavior obtained from the remote plug-in interface, and hooks the event triggered by the target application process at runtime Behavior, and when the monitoring unit monitors the event behavior of the target application process releasing the child process, inject the monitoring unit into the target application's child process in the form of an inline hook to monitor the event behavior of the target application and its created child processes capture; 处理模块,用于在特定事件行为被捕获后,获取事件行为处理策略,依据所述处理策略对该特定事件行为进行处理。The processing module is configured to obtain an event behavior processing strategy after the specific event behavior is captured, and process the specific event behavior according to the processing strategy. 10.根据权利要求9所述的主动防御装置,其特征在于包括:10. The active defense device according to claim 9, characterized in that it comprises: 快捷方式,其置于图形用户界面中,用于获取所述运行目标应用的指令,该快捷方式的图标由目标应用默认图标修改而得。A shortcut, which is placed in the graphical user interface, is used to obtain the instruction for running the target application, and the icon of the shortcut is modified from the default icon of the target application. 11.根据权利要求9所述的主动防御装置,其特征在于,所述监控模块所监控的事件行为包括以下任意一种或多种行为类型:获取运营商信息、APN操作、通知栏广告操作、获取手机识别码操作、创建快捷方式、电话拔打操作、短信插入或删除操作、联系人插入或删除操作、URL访问操作、子进程侵入操作、应用加载操作、命令操作、衍生物操作、激活设备管理器操作。11. The active defense device according to claim 9, wherein the event behavior monitored by the monitoring module includes any one or more of the following behavior types: obtaining operator information, APN operation, notification bar advertisement operation, Obtain mobile phone identification code operations, create shortcuts, call operations, insert or delete text messages, insert or delete contacts, URL access operations, sub-process intrusion operations, application loading operations, command operations, derivative operations, activate devices Manager action. 12.根据权利要求9所述的主动防御装置,其特征在于,所述监控模块监控到目标应用触发产生衍生物的事件行为时,通过远程规则库接口获取针对该衍生物的处理规则并处理该衍生物。12. The active defense device according to claim 9, wherein when the monitoring module monitors that the target application triggers an event behavior that generates derivatives, it obtains the processing rules for the derivatives through the remote rule base interface and processes the derivatives. derivative. 13.根据权利要求9所述的主动防御装置,其特征在于,该装置包括交互模块,被注册为系统服务,外壳应用通过其内建的交互接口与该交互模块通信,借助该交互模块向用户界面弹窗实现人机交互。13. The active defense device according to claim 9, characterized in that the device includes an interaction module, which is registered as a system service, and the shell application communicates with the interaction module through its built-in interaction interface, and communicates to the user with the help of the interaction module The interface pop-up window realizes human-computer interaction. 14.根据权利要求9所述的主动防御装置,其特征在于,所述安防模块包括配置模块,用于通过JAVA反射调用的方式动态加载所述目标应用。14. The active defense device according to claim 9, wherein the security module includes a configuration module, configured to dynamically load the target application through JAVA reflection calling. 15.根据权利要求9所述的主动防御装置,其特征在于,针对事件行为的所述处理策略由如下策略生成装置之一提供:15. The active defense device according to claim 9, wherein the processing strategy for event behavior is provided by one of the following strategy generation devices: 用于向用户界面弹窗告警,接收用户指令以获得所述的处理策略;It is used to alert the user interface with a pop-up window, and receive user instructions to obtain the processing strategy; 用于从本地策略数据库中检索获得对应的处理策略;Used to retrieve the corresponding processing policy from the local policy database; 用于通过远程策略接口向云端发送请求并获得对应反馈的处理策略。The processing strategy used to send requests to the cloud through the remote strategy interface and obtain corresponding feedback. 16.根据权利要求9至15中任意一项所述的主动防御装置,其特征在于,还包括:16. The active defense device according to any one of claims 9 to 15, further comprising: 更新模块,用于下载云端策略数据库并更新本地策略数据库,该本地策略数据库用于检索对应于具体目标应用的特定事件行为的处理策略。The update module is used to download the cloud policy database and update the local policy database, and the local policy database is used to retrieve the processing policy corresponding to the specific event behavior of the specific target application.
CN201410539274.8A 2014-10-13 2014-10-13 Active defense method and device Active CN104239797B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410539274.8A CN104239797B (en) 2014-10-13 2014-10-13 Active defense method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410539274.8A CN104239797B (en) 2014-10-13 2014-10-13 Active defense method and device

Publications (2)

Publication Number Publication Date
CN104239797A CN104239797A (en) 2014-12-24
CN104239797B true CN104239797B (en) 2017-07-07

Family

ID=52227839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410539274.8A Active CN104239797B (en) 2014-10-13 2014-10-13 Active defense method and device

Country Status (1)

Country Link
CN (1) CN104239797B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653903B (en) * 2015-12-18 2019-10-08 小米科技有限责任公司 The management method and device of application program permission
US10257223B2 (en) * 2015-12-21 2019-04-09 Nagravision S.A. Secured home network
CN106909833A (en) * 2015-12-23 2017-06-30 北京奇虎科技有限公司 A kind of safety protecting method and device
CN106682495B (en) * 2016-11-11 2020-01-10 腾讯科技(深圳)有限公司 Safety protection method and safety protection device
CN108632214B (en) * 2017-03-20 2022-02-22 中兴通讯股份有限公司 Method and device for realizing moving target defense
CN109241769B (en) * 2018-08-09 2020-05-15 福州瑞芯微电子股份有限公司 Electronic equipment privacy safety early warning method and system
CN115250188B (en) * 2021-04-27 2023-09-19 中国移动通信集团广东有限公司 Network security protection methods, devices and systems

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7779422B1 (en) * 2005-10-05 2010-08-17 Mcafee, Inc. System, method, and computer program product for compatibility among hooking applications
CN103368904A (en) * 2012-03-27 2013-10-23 百度在线网络技术(北京)有限公司 Mobile terminal, and system and method for suspicious behavior detection and judgment
CN103544434A (en) * 2013-11-12 2014-01-29 北京网秦天下科技有限公司 Method and terminal used for ensuring safe operation of application program
CN103646209A (en) * 2013-12-20 2014-03-19 北京奇虎科技有限公司 Cloud-security-based bundled software blocking method and device
CN103984891A (en) * 2005-07-29 2014-08-13 Bit9公司 Network security systems and methods
CN104023122A (en) * 2014-05-06 2014-09-03 可牛网络技术(北京)有限公司 Security defense method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103984891A (en) * 2005-07-29 2014-08-13 Bit9公司 Network security systems and methods
US7779422B1 (en) * 2005-10-05 2010-08-17 Mcafee, Inc. System, method, and computer program product for compatibility among hooking applications
CN103368904A (en) * 2012-03-27 2013-10-23 百度在线网络技术(北京)有限公司 Mobile terminal, and system and method for suspicious behavior detection and judgment
CN103544434A (en) * 2013-11-12 2014-01-29 北京网秦天下科技有限公司 Method and terminal used for ensuring safe operation of application program
CN103646209A (en) * 2013-12-20 2014-03-19 北京奇虎科技有限公司 Cloud-security-based bundled software blocking method and device
CN104023122A (en) * 2014-05-06 2014-09-03 可牛网络技术(北京)有限公司 Security defense method and device

Also Published As

Publication number Publication date
CN104239797A (en) 2014-12-24

Similar Documents

Publication Publication Date Title
CN104239786B (en) ROOT-free active defense configuration method and device
CN105427096B (en) Payment security sandbox implementation method and system and application program monitoring method and system
CN104462879B (en) Application program exempts from Root progress control methods and device
CN104376255B (en) Application program running control method and device
CN104239797B (en) Active defense method and device
CN104462961B (en) Mobile terminal and its privacy authority optimization method
CN104462880B (en) Application program shell adding collocation method and device
CN104375494B (en) Security sandbox construction method and security sandbox construction device
CN104376256B (en) Program process hatching control and device
US9438613B1 (en) Dynamic content activation for automated analysis of embedded objects
CN104408367A (en) Application program configuration method and device
Zhou et al. Dissecting android malware: Characterization and evolution
CN103279706B (en) Intercept the method and apparatus installing Android application program in the terminal
US9483644B1 (en) Methods for detecting file altering malware in VM based analysis
US9208328B2 (en) Security system and method for operating systems
CN102902919B (en) A kind of identifying processing methods, devices and systems of suspicious operation
US9065826B2 (en) Identifying application reputation based on resource accesses
US20150332043A1 (en) Application analysis system for electronic devices
CN104376263B (en) The method and apparatus that application behavior intercepts
CN104392176A (en) Mobile terminal and method for intercepting device manager authority thereof
KR20140074252A (en) Secure execution of unsecured apps on a device
CN104881601A (en) Floating window display setup, control method and device
CN105631312B (en) The processing method and system of rogue program
CN104486086B (en) Digital signature method and mobile terminal and server
CN104850779A (en) Safe application program installing method and safe application program installing device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220728

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right