WO2019114812A1 - 一种阻止恶意代码编译的方法、存储介质及电子装置 - Google Patents

一种阻止恶意代码编译的方法、存储介质及电子装置 Download PDF

Info

Publication number
WO2019114812A1
WO2019114812A1 PCT/CN2018/121085 CN2018121085W WO2019114812A1 WO 2019114812 A1 WO2019114812 A1 WO 2019114812A1 CN 2018121085 W CN2018121085 W CN 2018121085W WO 2019114812 A1 WO2019114812 A1 WO 2019114812A1
Authority
WO
WIPO (PCT)
Prior art keywords
class name
original class
original
code
compiled
Prior art date
Application number
PCT/CN2018/121085
Other languages
English (en)
French (fr)
Inventor
涂斌健
梁虹
Original Assignee
捷开通讯(深圳)有限公司
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 捷开通讯(深圳)有限公司 filed Critical 捷开通讯(深圳)有限公司
Publication of WO2019114812A1 publication Critical patent/WO2019114812A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/568Computer malware detection or handling, e.g. anti-virus arrangements eliminating virus, restoring damaged files

Definitions

  • the present application relates to the field of computer security, and in particular, to a method, a storage medium, and an electronic device for preventing malicious code from being compiled.
  • third-party applications have emerged in large numbers, and inevitably some third-party applications carry malicious code, as well as computer malware such as viruses, worms and Trojans.
  • the code has significant security threats to the operating system.
  • the technical problem to be solved by the present application is to provide a method, a storage medium and an electronic device for preventing malicious code from being compiled, which can prevent malicious code from referring to a compiled interface by a fixed class name, thereby effectively preventing execution of malicious code.
  • a technical solution adopted by the present application is to provide a method for preventing malicious code from being compiled.
  • the method for preventing malicious code compilation includes obtaining the original class name of the compiled interface; processing the original class name to generate a new class name; and modifying the original class name to a new class name so that the malicious code cannot refer to the compiled interface at compile time.
  • the storage medium stores program data, the program data can be read by a computer, and the program data, when executed by the processor, implements the method steps described above.
  • the electronic device includes a coupled processor and a memory, the memory storing a computer program, and when the processor executes the computer program, implementing the steps of the above method.
  • the present application discloses a method, a storage medium and an electronic device for preventing malicious code compilation.
  • the method for preventing malicious code compilation includes obtaining the original class name of the compiled interface; processing the original class name to generate a new class name; and modifying the original class name to a new class name so that the malicious code cannot reference the compiled interface at compile time.
  • the application modifies the original class name of the compiled interface to a new class name different from the previous one, so that the malicious code cannot directly refer to the original class name of the system, and thus cannot compile the compiled interface at compile time, and automatically collapses.
  • the possibility of malicious code to refer to the compiled interface by a fixed class name is prevented from the source of the system, effectively preventing the execution of malicious code.
  • FIG. 1 is a schematic flow chart of an embodiment of a method for preventing malicious code compilation provided by the present application
  • FIG. 2 is a schematic flow chart of another embodiment of a method for preventing malicious code compilation provided by the present application
  • FIG. 3 is a schematic flow chart of still another embodiment of a method for preventing malicious code compilation provided by the present application
  • FIG. 4 is a schematic structural diagram of an embodiment of a storage medium provided by the present application.
  • FIG. 5 is a schematic structural diagram of an embodiment of an electronic device provided by the present application.
  • the mobile terminal in the embodiment of the present application includes an electronic device such as a smart phone, a tablet computer, a smart wearable device, a digital audio and video player, an electronic reader, a handheld game machine, and an in-vehicle electronic device.
  • an electronic device such as a smart phone, a tablet computer, a smart wearable device, a digital audio and video player, an electronic reader, a handheld game machine, and an in-vehicle electronic device.
  • first”, “second”, and “third” in the embodiments of the present application are used for the purpose of description only, and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated.
  • features defining “first”, “second”, and “third” may include at least one of the features, either explicitly or implicitly.
  • the meaning of “a plurality” is at least two, such as two, three, etc., unless specifically defined otherwise.
  • the terms “comprises” and “comprising” and “comprising” are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units not listed, or alternatively Other steps or units inherent to these processes, methods, products or equipment.
  • references to "an embodiment” herein mean that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of the present application.
  • the appearances of the phrases in various places in the specification are not necessarily referring to the same embodiments, and are not exclusive or alternative embodiments that are mutually exclusive. Those skilled in the art will understand and implicitly understand that the embodiments described herein can be combined with other embodiments.
  • FIG. 1 a flow chart of an embodiment of a method for preventing malicious code compilation is provided by the present application.
  • Get the original class name of the compiled interface Specifically, first, it is determined whether the original class name of the compiled interface is the original class name of the preset specific compiled interface; if yes, the original class name is obtained; if not, the compiled interface is skipped, and the original class name of the next compiled interface is obtained.
  • the preset specific compilation interface satisfies at least the following conditions: a compilation interface that requests the privilege on the Local Application Connection ActivityManagerService, or a compilation interface through which the local information can be falsified.
  • the default class name of the preset specific compilation interface includes at least ActivityThread, ActivityManagerNative, and InstrumentationInfo.
  • the qualified compiling interfaces are merged into a list in advance, and each compiling interface corresponds to an original class name, and corresponding original class names are obtained according to the list.
  • a list of class names of a particular compiled interface is set in the initial system, and the list of class names is updated accordingly each time the list of class names is modified.
  • the original class name is processed to generate a new class name.
  • the current timestamp is obtained, and a timestamp is added to the original class name to form a new class name.
  • add a timestamp at the end of the original class name such as modifying the original class name "android.app.ActivityThread”
  • obtain the modification time such as 170432, add it to the middle or other location of the original class name, or add it to any location of the original class name to form a new class name.
  • the original class name is legally modified to form a new class name.
  • This application does not limit the way in which the original class name is generated.
  • Modify the original class name to the new class name including modifying the original class name of the compiled interface to be the new class name, and modifying the original class name referenced in the code to be the new class name.
  • this embodiment discloses a method for preventing malicious code compilation, including: obtaining the original class name of the compiled interface; processing the original class name to generate a new class name; and modifying the original class name to a new one.
  • the class name so that malicious code cannot reference the compilation interface at compile time.
  • the application modifies the original class name of the compiled interface to a new class name different from the previous one, so that the malicious code cannot directly refer to the original class name of the system, and thus cannot compile the compiled interface at compile time, and automatically collapses.
  • the possibility of malicious code to refer to the compiled interface by a fixed class name is prevented from the source of the system, effectively preventing the execution of malicious code.
  • FIG. 2 a schematic flowchart of another embodiment of a method for preventing malicious code compilation provided by the present application is provided.
  • step S25 It is judged whether the crash information is detected, and if so, step S25 is performed; if not, the operation is ended. After the crash information is generated, or after the duration is set, the crash information in the system is detected again.
  • the crash information is generated, the system will detect it immediately to perform the next step; or after a set period of time, the system automatically runs to detect whether there is a crash message to avoid the system cannot be the first time due to the existence of certain bugs. Respond to the generation of crash information.
  • Malicious code is compiled by the system's native class name to perform illegal behavior. After the original class name is modified, the class name of the compiled interface referenced by the malicious code does not exist, the malicious code cannot be compiled, and then the operation error occurs, the malicious code crashes, and the crash information is generated, and the crash information is detected by the system.
  • the system runs the following malicious code:
  • the malicious code replaces the original mAppThread object with its own object, so that the original system framework eventually runs into its own code and can do whatever it wants.
  • the technical solution of the present application cuts off the compilation of malicious code at the source. Since the class name "ActivityThread” that the malicious code needs to refer to is modified, it returns directly when it tries to execute the code "Class.forName("ActivityThread"), and the class name "ActivityThread” does not exist, so malicious code cannot be performed. The next step of compilation causes the malicious code to crash and generate crash information.
  • the crash information is sent to the server, and the crash information is transmitted to the server using the communication network in the system.
  • the computing power and database information of the terminal device such as a smart phone are limited.
  • the terminal device transmits the data to the server, and the computing power of the server can complete the task extremely efficiently.
  • S26 Receive an instruction returned by the server in response to the crash information.
  • the server analyzes the cause of the crash information, determines whether it is caused by the operation of the class name of the preset specific compiler interface, and causes the code to crash, and feeds back the instruction.
  • the corresponding operation is performed on the code that caused the crash information.
  • the instruction includes a first instruction and a second instruction. If the server returns the first instruction, determining that the code is a malicious code, asking the user whether to prohibit the malicious code from compiling. If the server returns a second instruction, it is determined that the code is a normal code, allowing the code to be compiled.
  • malware code or normal code exists in the application. If the code is determined to be malicious code, the application that prompts the user to contain the malicious code may be infected by a virus, and an instruction is sent to ask the user whether to prohibit the application from running. If the user chooses to disable the application from running, all components of the application are blocked from running. Otherwise, the system does not perform any operations on the application and the malicious code still cannot be compiled.
  • the malicious code that the user chooses to prohibit may be collected in a database, and the compilation of similar malicious code is prohibited according to the data of the database, so that the system is not subject to the security threat of similar malicious code.
  • FIG. 3 is a schematic flowchart diagram of still another embodiment of a method for preventing malicious code compilation provided by the present application.
  • step S32 Determining whether a third instruction is received; wherein the third instruction is generated when the system is turned on and the system is updated. If yes, step S32 is performed. If the third command is not accepted, the original state of the system is maintained.
  • the third instruction may be generated only by the system update.
  • the class name of the specific compiled interface is restored to the original class name, which can be easily referenced by the malicious code, and is compiled, so the system must be pre- Set the class name of the specific build interface to be modified immediately.
  • step S34 Modify the original class name to a new class name. After the set time period, step S32 is performed.
  • step S32 is performed. That is, after the original class name is changed to the new class name, steps S32, S33, and S34 are repeatedly executed in accordance with the set timing so that the class name of the compiled interface changes according to the set timing.
  • the class name of a preset specific build interface is updated every three days or one week.
  • FIG. 4 a schematic structural diagram of an embodiment of a storage medium provided by the present application.
  • the storage medium 40 stores program data 41 that, when executed by the processor, implements a method of preventing malicious code compilation as described in Figures 1-3.
  • the program data 41 is stored in a storage medium 40 and includes instructions for causing a computer device (either a router, a personal computer, a server or a network device, etc.) or a processor to perform all of the methods described in various embodiments of the present application or Part of the steps.
  • the storage medium 40 may be any medium that can store program data, such as a USB flash drive, a removable hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • FIG. 5 a schematic structural diagram of an embodiment of an electronic device provided by the present application is provided.
  • the electronic device 50 includes a coupled processor 52 and a memory 51 that stores a computer program that, when executed by the processor 52, implements a method of preventing malicious code compilation as described in Figures 1-3.
  • the present application discloses a method, a storage medium and an electronic device for preventing malicious code from being compiled.
  • the method for preventing malicious code compilation includes obtaining the original class name of the compiled interface; processing the original class name to generate a new class name; and modifying the original class name to a new class name so that the malicious code cannot refer to the compiled interface at compile time.
  • the application modifies the original class name of the compiled interface to a new class name different from the previous one, so that the malicious code cannot directly refer to the original class name of the system, and thus cannot compile the compiled interface at compile time, and automatically collapses.
  • the possibility of malicious code referencing the compiled interface through a fixed class name is prevented from the source of the system.
  • This application can be used in a variety of general purpose or special purpose computing system environments or configurations.
  • the disclosed method and apparatus may be implemented in other manners.
  • the device implementations described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used. Combinations can be integrated into another system, or some features can be ignored or not executed.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

Landscapes

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

Abstract

一种阻止恶意代码编译的方法、存储介质及电子装置。该阻止恶意代码编译的方法包括获取编译接口的原类名(S11);对原类名进行处理,生成新类名(S12);将原类名修改为新类名(S13),以使恶意代码在编译时无法引用编译接口。通过上述方法,能够阻止恶意代码通过固定的类名引用编译接口,能够有效的防止恶意代码的执行。

Description

一种阻止恶意代码编译的方法、存储介质及电子装置 技术领域
本申请涉及计算机安全领域,特别是涉及一种阻止恶意代码编译的方法、存储介质及电子装置。
背景技术
随着各种操作系统移动终端平台的日益发展,第三方应用程序大量涌现,不可避免地某些第三方应用程序中携带有恶意代码,以及诸如病毒、蠕虫和木马的计算机恶意软件均携带有恶意代码,对操作系统有显著的安全威胁。
发明内容
本申请主要解决的技术问题是提供一种阻止恶意代码编译的方法、存储介质及电子装置,能够阻止恶意代码通过固定的类名引用编译接口,有效的防止恶意代码的执行。
为解决上述技术问题,本申请采用的一个技术方案是:提供一种阻止恶意代码编译的方法。该阻止恶意代码编译的方法包括获取编译接口的原类名;对原类名进行处理,生成新类名;将原类名修改为新类名,以使恶意代码在编译时无法引用编译接口。
为解决上述技术问题,本申请采用的另一个技术方案是:提供一种存储介质。该存储介质存储有程序数据,程序数据可被计算机读取,程序数据在被处理器执行时,实现上述的方法步骤。
为解决上述技术问题,本申请采用的又一个技术方案是:提供一种电子装置。该电子装置包括连接的处理器和存储器,存储器存储有计算机程序,处理器执行该计算机程序时,实现上述方法的步骤。
本申请的有益效果是:区别于现有技术的情况,本申请公开了一种阻止恶意代码编译的方法、存储介质及电子装置。该阻止恶意代码编译的方 法包括获取编译接口的原类名;对原类名进行处理,生成新类名;将原类名修改为新类名,以使恶意代码在编译时无法引用编译接口。通过上述方式,本申请将编译接口的原类名修改为与之前不同的新类名,以使恶意代码无法直接引用系统的原生类名,进而在编译时无法引用编译接口,自动崩溃,本申请从系统源头上阻止了恶意代码通过固定的类名引用编译接口的可能性,有效的防止恶意代码的执行。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请提供的阻止恶意代码编译的方法一实施例的流程示意图;
图2是本申请提供的阻止恶意代码编译的方法另一实施例的流程示意图;
图3是本申请提供的阻止恶意代码编译的方法又一实施例的流程示意图;
图4是本申请提供的存储介质一实施例的结构示意图;
图5是本申请提供的电子装置一实施例的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例中的移动终端,包括智能手机、平板电脑、智能穿戴设备、数字音视频播放器、电子阅读器、手持游戏机和车载电子设备等电子设备。
本申请实施例中的术语“第一”、“第二”、“第三”仅用于描述目的, 而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”、“第三”的特征可以明示或者隐含地包括至少一个该特征。本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
参阅图1,本申请提供的阻止恶意代码编译的方法一实施例的流程示意图。
S11:获取编译接口的原类名。
获取编译接口的原类名。具体地,首先判断编译接口的原类名是否为预设特定编译接口的原类名;若是,获取原类名;若否,跳过该编译接口,获取下一编译接口的原类名。
可以理解地,并非所有编译接口均涉及到敏感数据,对涉及敏感信息或可危害系统安全的编译接口设置预防措施,其他的编译接口不设置预防措施,可减少系统资源的不必要浪费。对特定的编译接口设置预防措施,可从根源上阻止恶意代码的执行,因为恶意代码得利用系统资源达到其目的,若恶意代码无法获取其需要的编译接口的类名,也就无法运行。
该预设特定编译接口至少满足下述条件,可以在本地应用连接上ActivityManagerService(活动管理器服务)请求特权的编译接口,或可以通过其篡改本地信息的编译接口。该预设特定编译接口的原类名至少包括ActivityThread、ActivityManagerNative、InstrumentationInfo。
可选地,预先将符合条件的编译接口汇整成一个列表,每一个编译接口对应一个原类名,根据该列表获取相应的多个原类名。或者,在初始系 统中设置一特定编译接口的类名列表,在每次修改该类名列表后,相应地更新该类名列表。
S12:对原类名进行处理,生成新类名。
对原类名进行处理,生成新类名。具体地,获取当前时间戳,在原类名中添加时间戳,形成新类名。例如,在原类名末尾添加时间戳,如修改原类名“android.app.ActivityThread”,获取当前时间戳20250831,生成新类名“android.app.ActivityThread_20250831”。或者,获取修改时间,如170432,将其添加于原类名的中部或其他位置,也可将其分散添加于原类名的任意位置,以形成新类名。
可选地,还可有其他的方式以形成新类名。例如,完全修改原类名为合法的随机字符串组合,以形成新类名,本申请对生成原类名的方式不作限制。
S13:将原类名修改为新类名。
将原类名修改为新类名,包括修改编译接口的原类名为新类名,以及修改代码中引用的原类名为新类名。
生成新类名之后,先修改相应的编译接口的原类名为新类名,以避免恶意代码对系统原生特定类名的引用,再修改已被代码引用的原类名为新类名,以时其他正常应用能够正常运行。
区别于现有技术的情况,本实施例公开了一种阻止恶意代码编译的方法包括:获取编译接口的原类名;对原类名进行处理,生成新类名;将原类名修改为新类名,以使恶意代码在编译时无法引用编译接口。通过上述方式,本申请将编译接口的原类名修改为与之前不同的新类名,以使恶意代码无法直接引用系统的原生类名,进而在编译时无法引用编译接口,自动崩溃,本申请从系统源头上阻止了恶意代码通过固定的类名引用编译接口的可能性,有效的防止恶意代码的执行。
接下来的实施例将着重于介绍,修改系统类名后,对恶意代码的处置措施。
参阅图2,本申请提供的阻止恶意代码编译的方法另一实施例的流程示意图。
S21:获取编译接口的原类名。
S22:对原类名进行处理,生成新类名。
S23:将原类名修改为新类名。
S24:判断是否检测到崩溃信息。
判断是否检测到崩溃信息,若是,执行步骤S25;若否,结束运行。待崩溃信息产生后,或设定时长后,再次检测系统内的崩溃信息。
可以理解地,崩溃信息产生,系统会马上检测到,以执行下一步骤;或经过设定时长后,系统自动运行检测是否存在崩溃信息,以避免因某些Bug的存在,系统不能第一时间对崩溃信息的产生作出反应。
恶意代码通过系统原生类名进行编译,以执行非法行为。原生类名经修改后,恶意代码引用的编译接口的类名不存在,恶意代码无法进行编译,进而运行出错,恶意代码崩溃,产生崩溃信息,该崩溃信息被系统检测到。
例如,系统运行如下恶意代码:
Class<?>clzAT=Class.forName(“ActivityThread”);
final Field f=clzAT.getField("mAppThread");
f.setObject(/*替换原来的mAppThread*/);
通过以上代码,可以直接钩取(Hook)整个系统进程中所有与Activity相关的引用。
恶意代码把原本的mAppThread对象替换成自己的对象,从而是原本的系统框架最终跑到自己的代码里,可以为所欲为。
本申请的技术方案在源头切断恶意代码的编译。由于恶意代码需要引用的类名“ActivityThread”被修改,因而在它尝试执行代码“Class.forName(“ActivityThread”)”的时候就直接返回空,类名“ActivityThread”不存在,故而恶意代码无法进行下一步的编译,而导致恶意代码崩溃,产生崩溃信息。
S25:将崩溃信息发送至服务器。
将崩溃信息发送至服务器,利用系统中的通信网络将该崩溃信息传输至服务器。可以理解地,例如智能电话等终端设备的运算能力及数据库信息有限,对于一些费时费力的任务,终端设备会将其传输至服务器,借助服务器的计算能力可以极有效率地完成任务。
S26:接收服务器响应崩溃信息返回的指令。
服务器会分析崩溃信息的产生原因,判断其是否因对预设特定编译接口的类名进行操作,而导致代码崩溃产生的,并反馈指令。
S27:响应指令,对引起崩溃信息的代码执行相应操作。
响应该指令,对引起崩溃信息的代码执行相应操作。该指令包括第一指令及第二指令,若服务器返回第一指令,判定该代码为恶意代码,询问用户是否禁止该恶意代码进行编译。若服务器返回第二指令,判定该代码为正常代码,允许该代码进行编译。
可以理解地,恶意代码或正常代码均存在于应用程序中,若判定该代码为恶意代码,提示用户含有该恶意代码的应用程序可能被病毒感染,并发送指令询问用户是否禁止该应用程序运行。若用户选择禁止该应用程序运行,则系统会禁止该应用程序的所有组件运行。否则,系统不对该应用程序执行任何操作,并且该恶意代码仍然无法进行编译。
可选地,可将用户选择禁止的恶意代码收集于一个数据库中,根据该数据库的数据禁止相似恶意代码的编译,避免系统二次遭受类似恶意代码的安全威胁。
考虑到动态地改变编译接口的类名,有助于系统进一步阻止恶意代码通过固定的类名引用编译接口。请参阅图3,本申请提供的阻止恶意代码编译的方法又一实施例的流程示意图。
S31:判断是否接收到第三指令。
判断是否接收到第三指令;其中,第三指令由系统开启及系统更新时产生。若是,则执行步骤S32。若未接受到第三指令,保持系统原状态。
可以理解地,为从最初始时间就将预设特定编译接口的原类名保护起来,在系统更新及系统开启时,系统产生第三指令,该第三指令用于启动系统对预设特定编译接口的原类名进行修改,不留给恶意代码任何利用原生代码进行编译的空间。
可选的,第三指令可仅由系统更新时产生,系统更新后,预设特定编译接口的类名恢复成原生类名,可被恶意代码轻易地引用,而进行编译,因而必须对系统预设特定编译接口的类名立即进行修改。
S32:获取编译接口的原类名。
S33:对原类名进行处理,生成新类名。
S34:将原类名修改为新类名,经过设定时间段后,执行步骤S32。
将原类名修改为新类名,经过设定时间段后,执行步骤S32。即原类名修改为新类名后,按照设定时序重复执行步骤S32、S33、S34,以使编译接口的类名按照设定时序发生变化。
鉴于现如今,多数终端设备均及时充电而保持长时间开启状态,因而有必要以设定时序重复执行步骤S32、S33、S34,以更加有效地防止恶意代码获取类名进行编译。例如,以每三天或一周时间段更新一次预设特定编译接口的类名。
参阅图4,本申请提供的存储介质一实施例的结构示意图。
该存储介质40存储有程序数据41,程序数据41在被处理器执行时,实现如图1至图3所描述的阻止恶意代码编译的方法。
该程序数据41存储于一个存储介质40中,包括若干指令用于使得一台计算机设备(可以路由器、个人计算机、服务器或者网络设备等)或处理器执行本申请各个实施例所述方法的全部或部分步骤。可选的,存储介质40可以为U盘、移动硬盘、只读存储器(ROM)、随机存取存储器(RAM)、磁盘或者光盘等各种可以存储程序数据的介质。
参阅图5,本申请提供的电子装置一实施例的结构示意图。
该电子装置50包括连接的处理器52和存储器51,存储器51存储有计算机程序,处理器52执行该计算机程序时,实现如图1至图3所描述的阻止恶意代码编译的方法。
区别于现有技术的情况,本申请公开了一种阻止恶意代码编译的方法、存储介质及电子装置。该阻止恶意代码编译的方法包括获取编译接口的原类名;对原类名进行处理,生成新类名;将原类名修改为新类名,以使恶意代码在编译时无法引用编译接口。通过上述方式,本申请将编译接口的原类名修改为与之前不同的新类名,以使恶意代码无法直接引用系统的原生类名,进而在编译时无法引用编译接口,自动崩溃,本申请从系统源头上阻止了恶意代码通过固定的类名引用编译接口的可能性。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于存储介质实施例及电子装置实施例而言,由于其基 本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本申请可用于众多通用或专用的计算系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。
在本申请所提供的几个实施方式中,应该理解到,所揭露的方法以及设备,可以通过其它的方式实现。例如,以上所描述的设备实施方式仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。
另外,在本申请各个实施方式中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述仅为本申请的实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种阻止恶意代码编译的方法,其中,包括:
    获取编译接口的原类名;
    对所述原类名进行处理,生成新类名;
    将所述原类名修改为所述新类名,以使恶意代码在编译时无法引用所述编译接口。
  2. 根据权利要求1所述的方法,其中,所述将所述原类名修改为所述新类名的步骤之后,还包括:
    判断是否检测到崩溃信息;
    若是,将所述崩溃信息发送至服务器;
    接收所述服务器响应所述崩溃信息返回的指令;
    响应所述指令,对引起所述崩溃信息的代码执行相应操作。
  3. 根据权利要求2所述的方法,其中,所述响应所述指令对引起所述崩溃信息的代码执行相应操作的步骤,包括:
    若所述服务器返回第一指令,判定所述代码为恶意代码,询问用户是否禁止所述恶意代码进行编译;
    若所述服务器返回第二指令,判定所述代码为正常代码,允许所述代码进行编译。
  4. 根据权利要求1所述的方法,其中,所述获取编译接口的原类名的步骤之后,包括:
    判断所述编译接口的原类名是否为预设特定编译接口的原类名;
    若是,获取所述原类名;
    若否,跳过所述编译接口,获取下一编译接口的原类名。
  5. 根据权利要求1所述的方法,其中,所述对所述原类名进行处理,生成新类名的步骤,包括:
    获取当前时间戳;
    在所述原类名中添加所述时间戳,形成所述新类名。
  6. 根据权利要求1所述的方法,其中,所述将所述原类名修改为所述新类名的步骤,包括:
    修改所述编译接口的原类名为所述新类名;
    修改代码中引用的所述原类名为所述新类名。
  7. 根据权利要求1所述的方法,其中,所述将所述原类名修改为所述新类名的步骤之后,还包括:
    按照设定时序重复执行所述获取编译接口的原类名,至所述将所述原类名修改为所述新类名的步骤,以使所述编译接口的类名按照所述设定时序发生变化。
  8. 根据权利要求1所述的方法,其中,所述获取编译接口的原类名的步骤之前,还包括:
    判断是否接收到第三指令;其中,所述第三指令由系统开启及系统更新时产生;
    若是,则执行所述获取编译接口的原类名的步骤。
  9. 一种存储介质,存储有程序数据,所述程序数据可被计算机读取,所述程序数据在被处理器时执行:
    获取编译接口的原类名;
    对所述原类名进行处理,生成新类名;
    将所述原类名修改为所述新类名,以使恶意代码在编译时无法引用所述编译接口。
  10. 根据权利要求9所述的存储介质,其中,所述程序数据在被处理器时还执行:
    在将所述原类名修改为所述新类名的步骤之后:
    判断是否检测到崩溃信息;
    若是,将所述崩溃信息发送至服务器;
    接收所述服务器响应所述崩溃信息返回的指令;
    响应所述指令,对引起所述崩溃信息的代码执行相应操作。
  11. 根据权利要求10所述的存储介质,其中,所述响应所述指令对引起所述崩溃信息的代码执行相应操作的步骤包括:
    若所述服务器返回第一指令,判定所述代码为恶意代码,询问用户是否禁止所述恶意代码进行编译;
    若所述服务器返回第二指令,判定所述代码为正常代码,允许所述代码进行编译。
  12. 根据权利要求9所述的存储介质,其中,所述程序数据在被处理器时还执行:
    在所述获取编译接口的原类名的步骤之后:
    判断所述编译接口的原类名是否为预设特定编译接口的原类名;
    若是,获取所述原类名;
    若否,跳过所述编译接口,获取下一编译接口的原类名。
  13. 根据权利要求9所述的存储介质,其中,所述将所述原类名修改为所述新类名的步骤,包括:
    修改所述编译接口的原类名为所述新类名;
    修改代码中引用的所述原类名为所述新类名。
  14. 根据权利要求9所述的存储介质,其中,所述程序数据在被处理器时还执行:
    在所述获取编译接口的原类名的步骤之前:
    判断是否接收到第三指令;其中,所述第三指令由系统开启及系统更新时产生;
    若是,则执行所述获取编译接口的原类名的步骤。
  15. 一种电子装置,包括连接的处理器和存储器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时执行:
    获取编译接口的原类名;
    对所述原类名进行处理,生成新类名;
    将所述原类名修改为所述新类名,以使恶意代码在编译时无法引用所述编译接口。
  16. 根据权利要求15所述的电子装置,其中,所述处理器执行所述计算机程序时还执行:
    在将所述原类名修改为所述新类名的步骤之后:
    判断是否检测到崩溃信息;
    若是,将所述崩溃信息发送至服务器;
    接收所述服务器响应所述崩溃信息返回的指令;
    响应所述指令,对引起所述崩溃信息的代码执行相应操作。
  17. 根据权利要求16所述的电子装置,其中,所述响应所述指令对引起所述崩溃信息的代码执行相应操作的步骤包括:
    若所述服务器返回第一指令,判定所述代码为恶意代码,询问用户是否禁止所述恶意代码进行编译;
    若所述服务器返回第二指令,判定所述代码为正常代码,允许所述代码进行编译。
  18. 根据权利要求15所述的电子装置,其中,所述处理器执行所述计算机程序时还执行:
    在所述获取编译接口的原类名的步骤之后:
    判断所述编译接口的原类名是否为预设特定编译接口的原类名;
    若是,获取所述原类名;
    若否,跳过所述编译接口,获取下一编译接口的原类名。
  19. 根据权利要求15所述的电子装置,其中,所述将所述原类名修改为所述新类名的步骤,包括:
    修改所述编译接口的原类名为所述新类名;
    修改代码中引用的所述原类名为所述新类名。
  20. 根据权利要求15所述的电子装置,其中,所述处理器执行所述计算机程序时还执行:
    在所述获取编译接口的原类名的步骤之前:
    判断是否接收到第三指令;其中,所述第三指令由系统开启及系统更新时产生;
    若是,则执行所述获取编译接口的原类名的步骤。
PCT/CN2018/121085 2017-12-14 2018-12-14 一种阻止恶意代码编译的方法、存储介质及电子装置 WO2019114812A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711360428.7 2017-12-14
CN201711360428.7A CN108256326A (zh) 2017-12-14 2017-12-14 一种阻止恶意代码编译的方法、存储介质及电子装置

Publications (1)

Publication Number Publication Date
WO2019114812A1 true WO2019114812A1 (zh) 2019-06-20

Family

ID=62723404

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/121085 WO2019114812A1 (zh) 2017-12-14 2018-12-14 一种阻止恶意代码编译的方法、存储介质及电子装置

Country Status (2)

Country Link
CN (1) CN108256326A (zh)
WO (1) WO2019114812A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108256326A (zh) * 2017-12-14 2018-07-06 捷开通讯(深圳)有限公司 一种阻止恶意代码编译的方法、存储介质及电子装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577757A (zh) * 2013-11-15 2014-02-12 北京奇虎科技有限公司 病毒防御方法和装置
US20140181973A1 (en) * 2012-12-26 2014-06-26 National Taiwan University Of Science And Technology Method and system for detecting malicious application
CN103914656A (zh) * 2014-03-25 2014-07-09 安一恒通(北京)科技有限公司 避免被恶意软件监控的方法和装置
CN106650330A (zh) * 2016-12-22 2017-05-10 合肥国信车联网研究院有限公司 一种基于Dex加载器的Android应用软件加固保护方法
CN108256326A (zh) * 2017-12-14 2018-07-06 捷开通讯(深圳)有限公司 一种阻止恶意代码编译的方法、存储介质及电子装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140181973A1 (en) * 2012-12-26 2014-06-26 National Taiwan University Of Science And Technology Method and system for detecting malicious application
CN103577757A (zh) * 2013-11-15 2014-02-12 北京奇虎科技有限公司 病毒防御方法和装置
CN103914656A (zh) * 2014-03-25 2014-07-09 安一恒通(北京)科技有限公司 避免被恶意软件监控的方法和装置
CN106650330A (zh) * 2016-12-22 2017-05-10 合肥国信车联网研究院有限公司 一种基于Dex加载器的Android应用软件加固保护方法
CN108256326A (zh) * 2017-12-14 2018-07-06 捷开通讯(深圳)有限公司 一种阻止恶意代码编译的方法、存储介质及电子装置

Also Published As

Publication number Publication date
CN108256326A (zh) 2018-07-06

Similar Documents

Publication Publication Date Title
JP6912583B2 (ja) サービス処理方法および装置
US10949247B2 (en) Systems and methods for auditing a virtual machine
KR102546601B1 (ko) 정적 바이너리 계측을 사용하여 커널 제어-흐름 무결성을 보호하기 위한 방법 및 장치
JP5985631B2 (ja) 信頼レベルのアクティブ化
US8966511B2 (en) Computer system and method for preventing dynamic-link library injection attack
US10963558B2 (en) Malware detection method and malware detection apparatus
US10176327B2 (en) Method and device for preventing application in an operating system from being uninstalled
US11132436B2 (en) FPGA cloud host development method and system
US9111089B1 (en) Systems and methods for safely executing programs
US9104841B2 (en) Methods and systems for executing protected content
US20130239215A1 (en) Detecting malicious computer code in an executing program module
GB2502660A (en) Detecting malicious computer code in an executing program
US9971582B2 (en) Selecting application wrapper logic components based on features of a mobile application to be wrapped
US10372908B2 (en) System and method for detecting malware in a stream of bytes
US9965620B2 (en) Application program interface (API) monitoring bypass
CN107908957B (zh) 一种智能终端的安全运行管理方法及系统
CN107122656B (zh) 一种通过自调试防止外部调试的方法和装置
CN112231198B (zh) 一种恶意进程调试方法、装置、电子设备及介质
Stirparo et al. In-memory credentials robbery on android phones
Ramachandran et al. Android anti-virus analysis
WO2019114812A1 (zh) 一种阻止恶意代码编译的方法、存储介质及电子装置
TW201814442A (zh) 在應用中實現輔助功能的方法及裝置
CN109783156B (zh) 一种应用的启动控制方法及装置
Almisreb et al. A review on mobile operating systems and application development platforms
US11941411B2 (en) Application starting method and related device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18889539

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18889539

Country of ref document: EP

Kind code of ref document: A1