WO2013139215A1 - 病毒apk的识别方法及装置 - Google Patents

病毒apk的识别方法及装置 Download PDF

Info

Publication number
WO2013139215A1
WO2013139215A1 PCT/CN2013/072474 CN2013072474W WO2013139215A1 WO 2013139215 A1 WO2013139215 A1 WO 2013139215A1 CN 2013072474 W CN2013072474 W CN 2013072474W WO 2013139215 A1 WO2013139215 A1 WO 2013139215A1
Authority
WO
WIPO (PCT)
Prior art keywords
virus
signature
file
apk
installation package
Prior art date
Application number
PCT/CN2013/072474
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 北京奇虎科技有限公司
Priority to US14/386,681 priority Critical patent/US9619650B2/en
Publication of WO2013139215A1 publication Critical patent/WO2013139215A1/zh
Priority to US15/440,901 priority patent/US10152594B2/en

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/561Virus type analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/563Static detection by source code analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/564Static detection by virus signature recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/565Static detection by checking file integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/03Indexing scheme relating to G06F21/50, monitoring users, programs or devices to maintain the integrity of platforms
    • G06F2221/033Test or assess software

Definitions

  • the present invention relates to the technical field of network information security, and in particular to a method for identifying a virus APK, and a device for identifying a virus APK. Background technique
  • the Android is a Linux-based open source operating system, mainly used in mobile terminals such as mobile phones. Currently, there is no unified Chinese name.
  • the Android platform consists of an operating system, middleware, user interface, and application software.
  • APK is the abbreviation of Android application package file, which is the Android installation package, which can also be understood as the application software installed on the Android terminal.
  • APKs are file formats like Symbian Sis or Sisx. Install by exporting the APK file directly to the Android emulator or Android terminal. Apk file and sis-like, the android sdk compiled project is packaged into an installer file, the format is apk. The APK file is actually in zip format, but the suffix name is modified to apk. After UnZip decompression, you can see the Dex file. Dex is the full name of Dalvik VM executes, ie Android Dalvik executable, not standard Java bytecode but Dalvik Bytecode. Android needs UnZip first when running a program, and then runs directly like Symbian, which is different from PE files in Windows Mobile.
  • APKs can be imported into mobile terminals via data lines or wireless data transmission, or directly through the market (tool software, such as Android Market), web pages, etc. Way to download and install.
  • tools such as Android Market
  • APKs have emerged, including virus APKs.
  • some APKs customize payment services such as SMS, make pay phones, and back up sensitive data in users' mobile phones. Malicious behavior such as a specific server to damage the user's rights.
  • the first one is to identify the virus APK by the HASH, signature, and package name of the APK file.
  • the principle is to extract the KEY by using the HASH algorithm for the APK, and then the virus can be identified according to the KEY, or by the virus APK.
  • the person's APK digital signature, package name, etc. identify it.
  • the above-mentioned existing method of identifying the HASH based on the APK file can easily change the KEY by the HASH algorithm by re-ambiguating, or adding a new resource file or even modifying the code in the APK file, thereby causing the KEY to be changed by the HASH algorithm.
  • the existing signature-based identification method can be bypassed by replacing the signature;
  • the above existing identification based on the package name can also be bypassed by modifying the package name.
  • changing the obfuscation method, modifying the APK file (adding delete resources, code, etc.) or replacing the signature is easy for the virus maker, so the virus maker can easily create new virus variants to bypass the security software. Identification.
  • the second is to identify the class name in the APK file by using the class name in the APK file.
  • the principle is to analyze the classes in the classes and extract the names of several classes as virus signatures, and then parse them.
  • the virus APK's classes.dex file to see if it contains a specific class name to identify it.
  • the present invention has been made in order to provide an overcoming of the above problems or at least A method and apparatus for identifying a virus APK that partially solves or alleviates the above problems.
  • a method for identifying a virus APK including: a preset virus database, the virus database includes a virus signature; and detecting whether the specified file in the target Android installation package APK includes the The virus signature; if yes, determining that the target Android installation package APK is a virus APK.
  • a virus APK identification device including: a virus database generation module, configured to preset a virus database, the virus database includes a virus signature; and a virus detection module for detecting Whether the virus signature is included in the specified file in the target Android installation package APK; the virus identification module is configured to determine the target Android installation package when the virus signature is included in the specified file in the target Android installation package APK APK is a virus APK.
  • a computer program comprising computer readable code causing the server to perform any of claims 1-8 when run on a server The method for identifying the virus APK.
  • a computer readable medium storing the computer program according to claim 17 is provided.
  • the beneficial effects of the present invention are as follows:
  • the present application scans and analyzes a specified file in a source APK file, such as an executable file, a text file, etc., and generates corresponding virus signatures according to preset rules for instructions, constants, or header information containing virus information. Code, and compiled into a virus database; after the virus APK identification process, detecting the specified file in the target APK file, determining whether the specified file contains the virus signature in the virus database, thereby determining whether the target APK is a virus APK .
  • FIG. 1 is a flow chart of a method for identifying a virus APK in the present application
  • FIG. 2 is a flow chart of a method for identifying a virus APK in the present application
  • FIG. 3 is a virus APK of the present application.
  • Block diagram of an embodiment of an identification device FIG. 4 schematically shows a block diagram of a server for performing a method according to the invention
  • FIG. 5 schematically shows a method for maintaining or carrying out a method according to the invention.
  • the storage unit of the program code is a program code.
  • One of the core concepts of the embodiment of the present application is to generate a corresponding file according to a preset rule for a command, a constant, or a header information containing a virus information by scanning a specified file in a source APK file, such as an executable file or a text file.
  • the virus signature code is compiled into a virus database; after the virus APK is identified, the specified file in the target APK file is detected, and it is determined whether the specified file contains the virus signature in the virus database, thereby determining whether the target APK is Virus APK.
  • FIG. 1 a flow chart of a method 1 for identifying a virus APK of the present application is shown, which may specifically include the following steps:
  • Step 101 The virus database is preset, and the virus database includes a virus signature.
  • the specified file includes an executable file, and the virus database may be preset by using the following substeps:
  • Sub-step S1 l scanning the executable file in the source Android installation package APK; sub-step S12, extracting specific data in the executable file, determining whether the specific data contains virus information, wherein the specific data includes Executing the header information of the file, the constants in the pool of executable constants, and/or the operation instructions in the executable;
  • Sub-step S13 if yes, generating a virus signature according to the specific data
  • Sub-step S14 saving the virus signature to the virus database.
  • the executable file may include a Dex file
  • the Dex file is mainly Is the classes.dex file in the APK, which is Dalvik Executable (Dalvik virtual machine executable). It is well known that Dalvik is a Java virtual machine for the Android platform.
  • the Dalvik VM (Dalvik VM) is one of the core components of the Android mobile device platform. It can support the running of Java applications that have been converted to .dex (Dalvik Executable) format.
  • the .dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. Dalvik is optimized to allow multiple instances of virtual machines to run simultaneously in limited memory, and each Dalvik application is executed as a separate Linux process.
  • the Dex file may also include other files in the Dex format.
  • the specific data in the executable file can be extracted in the following order:
  • the constants in the constant pool in the specified file may include string strings, types types, domain fields, and constants in the method methods.
  • the constants in the executable constant pool may be determined by the following substeps. Contains virus information:
  • Sub-step S21 determining whether the constant in the string strings contains malicious information such as predefined malicious website information, malicious file name or malicious number information; and/or,
  • Sub-step S22 determining whether the constants in the type, domain, and method methods of the type call a custom class name, a custom function name, or an Android system SDK class name, and an Android system function name.
  • the virus information in the constant may be directly used as a virus signature, and the virus signature generated in the embodiment includes a constant signature and a class name function name signature.
  • the constant pool in the classes.dex file of an APK contains the following string: com.noshufou.android.su
  • the constant pool in the classes.dex file of an APK contains the following method: Lcom/ android/ main/ SmsReceiver;
  • the constant pool in the classes.dex file of an APK contains the following type:
  • the constant pool in an APK's classes.dex file contains the following fields: Lcom/androidkernel/flash/b/br$l; ihis$0:Lcom/androidkernel/flash/b/br; After that, it can be directly used as a virus signature and saved to the virus database.
  • Dalvik VM is based on register design.
  • the data used in the program such as strings, types, fields and methods, is stored in a special data storage area (constant pool), which is referenced by the corresponding index in the program, while the character literal constant is directly Saved in instructions, the opcodes are divided into two categories:
  • Example 4 Put the class com . qihoo360. mobile safe . service .NetTraffic Service into the locator v3.
  • the user class name, function name, and string in the classes.dex and JAR files in the APK will be confused or modified, but the Dalvik VM instructions and the classes provided to the Android system SDK will not be affected by the user class. Names, function names, variable names, etc. are affected by confusion or modification, so the APK can be identified by a set of ordered specific instructions. Because the Dalvik VM is register-based, its instructions can only manipulate registers, character literal constants, data memory areas, and register addresses are variable, so fuzzy matching is required when identifying, ie by identifying the fixed part of the instruction - Opcode and its associated character literal constant parameters or strings, types, fields and methods in the data storage area, of course, you can also directly use the instruction and its operand itself as a virus signature. In a preferred embodiment of the present application, the following operation steps may be used to determine whether the operation instruction includes virus information:
  • Sub-step S31 determining whether the operand includes a predefined illegal operand; and / or,
  • Sub-step S32 Determine whether the combination of the operation code and the operand meets a predefined illegal matching rule.
  • the virus signature can be generated according to the operation instruction by the following sub-steps:
  • Sub-step S41 the operation instruction itself is used as a virus signature; and/or, sub-step S42, an operation code of the operation instruction, and a character string or a wildcard of the operand are used as a virus signature.
  • the virus signature generated by applying the embodiment includes an operand signature, an instruction signature, and an instruction signature sequence.
  • the feature code of the above example 1 may be 1303 6100
  • the feature code of the example 2 may be 1700 0000 0040
  • the feature code of the example 3 may be laOO 7d00
  • the feature code of the example 4 may be lc03 6e04
  • the feature code of the example 5 may be
  • the signature of the example 6 may be 3221 0400
  • the signature of the example 7 may be 3800 1500
  • the signature of the example 8 may be 6el0 0e29 0500
  • the signature of the example 9 may be 7010 042a 0800
  • the code can be b021.
  • the feature code of the above example 1 may be 13$* (where * represents a fuzzy match, the same below, it should be noted that "*,” is used as an example only, and any character may be used in practice), for example
  • the signature of 2 may be 17 $ *
  • the signature of example 3 may be 1 a$
  • the signature of example 4 may be 31$*
  • the signature of example 6 may be 32$*
  • the signature of example 7 may be For 38$*
  • the signature of example 8 can be 6e$Ljava/io/File;.length:()
  • the signature of example 9 can be
  • example 10 70$Ljava/lang/StringBuilder; ⁇ init>, the signature of example 10 can be b0$*.
  • Signature selection scheme three Mix the above scenario 1 and scenario 2.
  • the specific instruction set itself in classes.dex in the above APK, and the string or wildcard of the specific opcode and its operands in classes.dex in the APK are all used as virus signatures.
  • $ is used as a delimiter, and any other characters may be used as a delimiter in practice; in the embodiment of the present application, * is used as a wildcard, and in practice, Any other character can be used as a wildcard.
  • a virus includes the following feature string in its string constant pool:
  • Zjphonecall.txt and zjsms.txt which include the malicious phone number and the special SMS number in these two files, can be extracted as a virus signature.
  • virus X undercover. Apk contains the following instructions to back up user privacy data to http://www.mybackup.me, listed in the order in which they appear:
  • 0003 move-result-object v2 extracts its virus signature as: 0c02 or 0c$*
  • Instructions (operation instructions) in the classes.dex file of an APK are as follows:
  • the header information of the executable file includes summary information.
  • Checksum and/or signature information Signature it may be determined whether the header information includes virus information by determining whether the summary information checksum and/or the signature information Signature contains a predefined illegal character string. .
  • the summary information checksum and/or the signature information Signature may also be directly used as a virus signature. That is, in this embodiment, the virus signature includes a header information signature.
  • checksum of the classes. dex file header header in the APK is: l lf26cac; Signature is:
  • 2911621AD071F675ADF0F590C3F1AFB5443BEBBE is extracted as a virus signature, and the virus signature is saved to the database.
  • the step of saving the virus signature to the virus database may include the following sub-steps:
  • Sub-step S51 storing the header information feature code, the constant feature code, the operand feature code, the instruction feature code, the instruction feature code sequence, and the class name function name feature code in different storage areas in the database; or
  • Sub-step S52 the header information feature code, the constant feature code, the operand feature code, The instruction signature, the instruction signature sequence, and the class name function name signature are stored in the database, and the classification labels are respectively marked.
  • Step 102 Detecting whether the target file in the Android installation package APK includes the virus signature, and the specified file includes an executable file;
  • the virus signature may include: a header information signature, a constant signature, an operand signature, an instruction signature, an instruction signature sequence, and a class name function name signature.
  • the step 102 may specifically include the following sub-steps:
  • Sub-step S41 locating the header information of the executable file in the target Android installation package APK, matching the header information with the header information feature code in the virus database, and if yes, determining the target Android installation package APK
  • the specified file contains a virus signature; and/or,
  • Sub-step S42 positioning a constant in the executable file constant pool in the target Android installation package APK, matching the constant with the constant signature in the virus database, and if matching, determining the specified file in the target Android installation package APK Contains virus signatures;
  • Sub-step S43 locating the operand in the executable file operation instruction in the target Android installation package APK, matching the operand with the operand signature in the virus database, and if yes, determining the target Android installation package APK
  • the specified file contains a virus signature; and/or,
  • Sub-step S44 positioning the opcode in the executable file operation instruction in the target Android installation package APK, matching the operation code with the instruction signature in the virus database, and if yes, determining the designation in the target Android installation package APK
  • the file contains the virus signature; and/or,
  • Sub-step S45 positioning the opcode in the executable file operation instruction in the target Android installation package APK, matching the operation code with the instruction signature sequence in the virus database, and if yes, determining the target Android installation package APK
  • the specified file contains a virus signature; and/or,
  • Sub-step S46 positioning target Android installation package APK in the executable file constant pool
  • the constant and the class name and/or function name called by the operand in the operation instruction and match the class name and/or function name with the class name function name signature in the virus database. If it matches, determine the target Android installation.
  • the virus signature is included in the specified file in the package APK.
  • the matching can be done as follows:
  • Method 1 Directly scan sequentially by byte.
  • Method 2 The virus signature sequence is scanned in sequence, and only the virus signature command appears in sequence, and does not need to appear continuously.
  • Method 3 Just have all or part of the signature command.
  • Step 103 If yes, determine that the target Android installation package APK is a virus APK. To make the present application better understood by those skilled in the art, the following is illustrated by way of a few specific examples.
  • the embodiment of the present application is also applicable to the case of nesting an APK in an APK, that is, when other APKs are included in the APK, the embodiment of the present application can also be applied to perform executable files, text files, and the like in the APK and its nested APK. Parsing and virus extraction, for example, embedding a root.apk in a 1.APK to obtain root privileges, applying the embodiment of the present application, in addition to extracting the virus signature from 1.APK, it will also extract from root.apk Virus signature. It is easily understood by those skilled in the art that the embodiments of the present application are also applicable to the case of multiple nested APKs, which is not limited herein.
  • Embodiment 2 of the method for identifying a virus APK of the present application is shown, which may specifically include the following steps:
  • Step 201 The virus database is preset, and the virus database includes a virus signature.
  • the step 201 may include the following sub-steps: sub-step S51, scanning the source Android installation package APK a specified file, the specified file including an executable file and/or a text file;
  • Sub-step S52 extracting specific data in the executable file, and determining whether the specific data includes virus information, where the specific data includes header information of the executable file, a constant in the pool of executable file constants, and / or, an operation instruction in the executable file;
  • Sub-step S53 if yes, generating a virus signature according to the specific data
  • Sub-step S54 extracting the linux command in the text file, and determining whether the linux command includes virus information
  • Sub-step S55 If yes, generate a virus signature according to the linux command.
  • Sub-step S56 saving the virus signature to the virus database.
  • the virus signature further includes a linux command signature. For example, extract the corresponding linux command from the text file in ⁇ as follows: cat /system/bin/sh > I data/ data/$ 1 /files/ sh.new
  • the above command is written into the virus database as a virus signature.
  • Step 202 Detect whether the target file in the Android installation package APK includes the virus signature, and the specified file includes an executable file and a text file.
  • the step 202 may include the following substeps: locating a text file in the target Android installation package APK, and using the linux command in the text file with the linux command signature in the virus database. Match, if it matches, then judge The virus signature is included in the specified file in the target Android installation package APK.
  • Step 203 If yes, determine that the target Android installation package APK is a virus APK.
  • the embodiment of the present application is applicable to the process of client software and cloud killing, that is, the above virus
  • the process of identifying the APK can be done on the client side or on the server side or the cloud. This application does not limit this.
  • Scene 1 According to the user's virus scan start operation, first check whether the APK changes and whether the scan result is cached. If the APK is not changed and the scan result is cached, the scan result is directly output, otherwise the blacklist scan is performed, if the APK is found therein If yes, the output scan results the virus APK and adds it to the cache. If it is not found, the whitelist scan is performed. If the APK is found, the output scan result is safe and added to the cache. If not found, the virus database is used for virus. The signature scans and outputs the scan results as well as added to the cache.
  • Scene 2 The user newly installs the APK, the anti-virus program receives the newly installed APK message, and starts to scan the newly installed APK of the user.
  • the blacklist scan is performed. If the APK is found to exist, the output scan result is found to be a virus and is added to the cache. If it is found, the whitelist scan is performed. If the APK is found to exist, the output scan result is safe and added to the cache. If not found, the virus database is used for virus signature scanning, and the scan result is output and added to the cache.
  • the application analyzes the specified file in the source APK file, such as an executable file, a text file, etc., and generates a corresponding virus signature according to preset rules for instructions, constants or header information containing the virus information, and compiles into a virus database.
  • the specified file in the target APK file is detected, and it is determined whether the specified file contains the virus signature in the virus database, thereby determining whether the target APK is a virus APK.
  • no matter how the virus manufacturer modifies the confusion mode, adds resources, modifies the code (changes the class name, function name, etc.), replaces the signature, the package name, etc., the virus variants of the virus are not generated.
  • embodiments of the present application are applicable not only to various Android terminals, that is, terminals using an Android platform (operating system), including computers, PCs, notebook computers, mobile phones, tablets, and the like; and also applicable to other computer systems.
  • a virus signature extraction scheme used on top of for example, Windows, Linux).
  • FIG. 3 a block diagram of a structure of an apparatus for identifying a virus APK of the present application is shown, which may specifically include the following modules:
  • a virus database generating module 301 configured to preset a virus database, where the virus database includes a virus signature;
  • the virus detection module 302 is configured to detect whether the virus signature is included in a specified file in the target Android installation package APK.
  • the virus identification module 303 is configured to: when the virus signature is included in the specified file in the target Android installation package APK, determine that the target Android installation package APK is a virus APK.
  • the specified file includes an executable file
  • the virus database generating module 301 may include the following sub-modules:
  • a source file scanning submodule for scanning a specified file in the source Android installation package APK, the specified file including an executable file;
  • a specific data extraction submodule configured to extract specific data in the executable file, and determine whether the specific data includes virus information, where the specific data includes a header information of the executable file, and an executable file constant pool Constants, and/or, operating instructions in the executable;
  • a first feature code generating submodule configured to generate a virus signature according to the specific data when the specific data includes virus information
  • the signature storage submodule is configured to save the virus signature to the virus database.
  • the feature code saving submodule may further include the following units: a partition saving unit, configured to save the header information feature code, the constant feature code, the operand feature code, the instruction feature code, the instruction feature code sequence, and the class name function name feature code in different storage areas in the database; or ,
  • a label saving unit configured to save the header information feature code, the constant feature code, the operand feature code, the instruction feature code, the instruction feature code sequence, and the class name function name signature in the database, and respectively mark the classification label.
  • the executable file may include a Dex file
  • the Dex file may include a classes.dex file, a file with a .jar extension, and a file in a Dex format.
  • the virus signature may include: a header information signature, a constant signature, an operand signature, an instruction signature, an instruction signature sequence, and a class name function name signature;
  • the operation instructions in the executable file include an operation code and an operand;
  • the virus detection module 302 may include the following sub-module: a first detection sub-module, configured to locate header information of an executable file in the target Android installation package APK, and the header information and the virus database The header information feature code is matched, and if it matches, it is determined that the specified file in the target Android installation package APK contains the virus signature; and/or,
  • the second detecting submodule is configured to locate a constant in the executable file constant pool in the target Android installation package APK, and match the constant with the constant signature in the virus database, and if yes, determine the target Android installation package APK
  • the specified file contains the virus signature; and/or,
  • the third detecting submodule is configured to locate an operand in the executable file operation instruction in the target Android installation package APK, and match the operand with the operand signature in the virus database, and if yes, determine the target Android installation.
  • the virus signature is included in the specified file in the package APK; and/or,
  • a fourth detection submodule configured to locate an operation code in an executable file operation instruction in the target Android installation package APK, and match the operation code with an instruction signature in a virus database, and if yes, determine a target Android installation package.
  • the specified file in the APK contains the virus signature; and/or,
  • the fifth detecting submodule is configured to locate an opcode in the executable file operation instruction in the target Android installation package APK, and match the operation code with the instruction signature sequence in the virus database, and if yes, determine the target Android installation.
  • a sixth detection submodule configured to locate a constant in the executable file constant pool in the target Android installation package APK and a class name and/or a function name called by the operand in the operation instruction, and the class name and/or the function name are The class name function name signature in the virus database is matched. If it matches, it is determined that the specified file in the target Android installation package APK contains the virus signature.
  • the header information feature code, the constant feature code, the operand feature code, and the class name function name feature code may be directly generated according to the header information, the constant, the operand, and the class name function name including the virus information;
  • the instruction signature, the instruction signature sequence may be generated directly according to an operation instruction containing virus information, or may be generated according to a string or a wildcard containing an opcode and an operand of the virus information.
  • the specified file may further include a text file.
  • the virus database generating module 301 may further include the following sub-module: a linux command extraction sub-module for extracting The linux command in the text file determines whether the linux command includes virus information;
  • the second signature generation submodule is configured to generate a virus signature according to the linux command when the linux command includes virus information.
  • virus signature module may further include a linux command signature
  • virus detection module 302 may further include the following submodule:
  • the seventh detecting submodule is configured to locate a text file in the target Android installation package APK, and match the linux command in the text file with the linux command signature in the virus database, and if yes, determine the target Android installation package APK The virus signature is included in the specified file.
  • the constant in the constant pool in the executable file may include a string string, a type type, a domain field, and a constant in a method method;
  • the header information of the executable file may include a summary information checksum and / or signature information Signature.
  • the description of the present embodiment is not exhaustive, and reference may be made to the related description in the foregoing embodiment, and details are not described herein. .
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor can be used in practice.
  • Some or all of the functions of some or all of the components of the identification device of the virus AP K according to an embodiment of the present invention are implemented.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals.
  • Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • Fig. 4 shows a server, such as an application server, which can implement the identification method of the virus ⁇ according to the present invention.
  • the server conventionally includes a processor 410 and a computer program product or computer readable medium in the form of a memory 420.
  • Memory 420 can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk or ROM.
  • Memory 420 has a memory space 430 for executing program code 431 of any of the above methods.
  • storage space 430 for program code may include various program code 431 for implementing various steps in the above methods, respectively. These program code can be read from or written to one or more computer program products.
  • Such computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such a computer program product is typically a portable or fixed storage unit as described with reference to Figure 5.
  • the storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 420 in the server of Fig. 4.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 43 ⁇ , i.e., code that can be read by a processor, such as 410, which, when executed by the server, causes the server to perform various steps in the methods described above.
  • an embodiment or “one or more embodiments” as used herein means that a particular feature, structure, or characteristic described in connection with the embodiments is included in at least one embodiment of the invention. Moreover, it is noted that the examples of the words “in one embodiment” herein are not necessarily all referring to the same embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Measuring Or Testing Involving Enzymes Or Micro-Organisms (AREA)

Abstract

本发明公开了一种病毒APK的识别方法及装置,其中,所述方法包括:预置病毒数据库,所述病毒数据库中包括病毒特征码;检测目标Android安装包APK中的指定文件中是否包含所述病毒特征码;若是,则确定所述目标Android安装包APK为病毒APK。本申请可以快速、准确、有效地识别出病毒APK及其变种,提高APK应用的安全性。

Description

病毒 APK的识别方法及装置 技术领域
本发明涉及网络信息安全的技术领域, 特别是涉及一种病毒 APK的 识别方法, 以及, 一种病毒 APK的识别装置。 背景技术
Android是一种以 Linux为基础的开放源码操作系统, 主要使用于手 机等移动终端, 目前尚未有统一中文名称。 Android平台由操作系统、 中 间件、 用户界面和应用软件组成。
APK是 Android application package file的缩写, 即 Android安装包, 也可以理解为 Android终端上安装的应用软件。 APK是类似 Symbian Sis 或 Sisx的文件格式。通过将 APK文件直接传到 Android模拟器或 Android 终端中执行即可安装。 apk文件和 sis—样, 把 android sdk编译的工程打 包成一个安装程序文件, 格式为 apk。 APK文件其实是 zip格式, 但后缀 名被修改为 apk, 通过 UnZip解压后, 可以看到 Dex文件, Dex是 Dalvik VM executes的全称, 即 Android Dalvik执行程序, 并非标准的 Java字节 码而是 Dalvik字节码。 Android在运行一个程序时首先需要 UnZip , 然后 类似 Symbian那样直接运行, 和 Windows Mobile中的 PE文件有区别。
具体而言, APK文件的结构如下表所示:
Figure imgf000002_0001
在具体应用时, APK可以通过数据线或者无线数据传输的方式导入 移动终端, 或者, 直接通过 market (工具软件, 如安卓市场) 、 网页等 方式下载安装。 随着 Android终端的普及和发展, 各种各样的 APK应运 而生, 这其中就包括了病毒 APK, 例如, 一些 APK通过诸如短信定制付 费服务、 拨打付费电话、 备份用户手机中的敏感数据至特定服务器等恶 意行为来损害用户的权益。
目前, 已经出现了一些专门针对移动终端的安全软件 (如手机杀毒 软件)来对这些病毒 APK进行查杀。 这些现有的安全软件查杀病毒 APK 的方法主要有以下两种:
第一种是通过 APK文件的 HASH、签名、 Package名字来对病毒 APK 进行识别,其原理是通过对 APK使用 HASH算法提取 KEY,之后即可依 据此 KEY去识别病毒 APK, 或者, 通过病毒 APK制作者的 APK数字签 名、 包名等对其进行识别。
然而, 上述现有的基于 APK文件的 HASH进行识别的方式, 很容易 通过重新混淆、 或者, 在 APK文件中添加新的资源文件乃至修改代码等 方式, 使通过 HASH算法提取 KEY发生改变, 进而导致无法识别; 上述 现有的基于签名的识别方式可以通过更换签名的方式绕过; 上述现有的 基于 Package名字来识别的方式也可通过修改包名的方式来绕过。而且更 改混淆方式, 修改 APK文件 (添加删除资源, 代码等) 或者更换签名对 病毒制造者而言都艮容易, 所以病毒制造者^ ^轻易地就可以制造新的病 毒变种从而绕过安全软件的识别。
第二种是通过 APK文件中的 classes. dex中的类名对其进行识别, 其 原理是通过分析 classes . dex中的类然后从中提取出若干个类的名字作为 病毒特征码, 之后即可解析病毒 APK的 classes.dex文件, 看其中是否包 含特定的类名来对其进行识别。
然而, 这种通过扫描类名来进行识别的方式, 一方面因为仅仅检查 类名从而容易误报, 另一方面也很容易被病毒制造者通过混淆或者直接 修改类名而绕过。
因此, 目前需要本领域技术人员解决的一个技术问题就是, 提供一 种病毒 APK的识别机制, 用以快速、 准确、 有效地识别出病毒 APK及 其变种, 提高 APK应用的安全性。 发明内容
鉴于上述问题, 提出了本发明以便提供一种克服上述问题或者至少 部分地解决或者减緩上述问题的病毒 APK的识别方法和装置。
根据本发明的一个方面,提供了一种病毒 APK的识别方法,其包括: 预置病毒数据库, 所述病毒数据库中包括病毒特征码; 检测目标 Android 安装包 APK中的指定文件中是否包含所述病毒特征码; 若是, 则确定所 述目标 Android安装包 APK为病毒 APK。
根据本发明的另一个方面, 提供了一种病毒 APK的识别装置, 其包 括: 病毒数据库生成模块, 用于预置病毒数据库, 所述病毒数据库中包 括病毒特征码; 病毒检测模块, 用于检测目标 Android安装包 APK中的 指定文件中是否包含所述病毒特征码; 病毒识别模块, 用于在所述目标 Android安装包 APK中的指定文件中包含病毒特征码时, 确定所述目标 Android安装包 APK为病毒 APK。
根据本发明的又一个方面, 提供了一种计算机程序, 其包括计算机 可读代码, 当所述计算机可读代码在服务器上运行时, 导致所述服务器 执行根据权利要求 1-8中的任一个所述的病毒 APK的识别方法。
根据本发明的再一个方面, 提供了一种计算机可读介质, 其中存储 了如权利要求 17所述的计算机程序。
本发明的有益效果为: 本申请通过扫描分析源 APK文件中的指定文 件, 如可执行文件、 文本文件等, 针对包含病毒信息的指令、 常量或头 部信息按预置规则生成相应的病毒特征码, 并汇编成病毒数据库; 之后 病毒 APK识别的过程中, 检测目标 APK文件中的指定文件, 判断该指 定文件中是否包含所述病毒数据库中的病毒特征码, 从而确定目标 APK 是否为病毒 APK。 应用本申请实施例, 无论病毒制造者如何通过修改混 淆方式、 增加资源、 修改代码 (改变类名、 函数名等) 、 更换签名、 包 名等方式来制作病毒变种其病毒 APK的特征码都不会变, 从而本申请可 以快速、 准确、 有效地识别出病毒 APK及其变种, 而且有针对性的更改 程序逻辑以及特定字符串(恶意号码、 恶意网址)来制作病毒变种相对病毒 制造者而言是比较麻烦、 耗时的, 从而这种方式也能有效的提高病毒制 作者制作病毒变种的难度, 提高 APK应用的安全性。
上述说明仅是本发明技术方案的概述, 为了能够更清楚了解本发明 的技术手段, 而可依照说明书的内容予以实施, 并且为了让本发明的上 述和其它目的、 特征和优点能够更明显易懂, 以下特举本发明的具体实 施方式。 附图说明
通过阅读下文优选实施方式的详细描述, 各种其他的优点和益处对 于本领域普通技术人员将变得清楚明了。 附图仅用于示出优选实施方式 的目的, 而并不认为是对本发明的限制。 而且在整个附图中, 用相同的 参考符号表示相同的部件。 在附图中:
图 1是本申请的一种病毒 APK的识别方法实施例 1的流程图; 图 2是本申请的一种病毒 APK的识别方法实施例 2的流程图; 图 3是本申请的一种病毒 APK的识别装置实施例的结构框图; 图 4示意性地示出了用于执行根据本发明的方法的服务器的框图; 图 5 示意性地示出了用于保持或者携带实现根据本发明的方法的程 序代码的存储单元。 具体实施例
下面结合附图和具体的实施方式对本发明作进一步的描述。
本申请实施例的核心构思之一在于, 通过扫描分析源 APK文件中的 指定文件, 如可执行文件、 文本文件等, 针对包含病毒信息的指令、 常 量或头部信息按预置规则生成相应的病毒特征码, 并汇编成病毒数据库; 之后病毒 APK识别的过程中, 检测目标 APK文件中的指定文件, 判断 该指定文件中是否包含所述病毒数据库中的病毒特征码, 从而确定目标 APK是否为病毒 APK。
参考图 1 , 示出了本申请的一种病毒 APK的识别方法实施例 1的步 骤流程图, 具体可以包括如下步骤:
步骤 101、 预置病毒数据库, 所述病毒数据库中包括病毒特征码; 在本申请的一种优选实施例中, 所述指定文件包括可执行文件, 可 以通过如下子步骤预置所述病毒数据库:
子步骤 Sl l、 扫描源 Android安装包 APK中的可执行文件; 子步骤 S12、提取所述可执行文件中的特定数据, 判断所述特定数据 是否包含病毒信息, 其中, 所述特定数据包括可执行文件的头部信息、 可执行文件常量池中的常量, 和 /或, 可执行文件中的操作指令;
子步骤 S13、 若是, 则根据所述特定数据生成病毒特征码;
子步骤 S14、 将所述病毒特征码保存至病毒数据库中。
对于 APK而言, 所述可执行文件可以包括 Dex文件, Dex文件主要 是 APK中的 classes. dex文件, 即 Dalvik Executable ( Dalvik虚拟机可执 行文件)。 公知的是, Dalvik是用于 Android平台的 Java虚拟机。 Dalvik 虚拟机( Dalvik VM ) 是 Android移动设备平台的核心组成部分之一。 它 可以支持已转换为 .dex (即 Dalvik Executable )格式的 Java应用程序的 运行, .dex格式是专为 Dalvik设计的一种压缩格式, 适合内存和处理器 速度有限的系统。 Dalvik 经过优化, 允许在有限的内存中同时运行多个 虚拟机的实例,并且每一个 Dalvik应用作为一个独立的 Linux 进程执行。 独立的进程可以防止在虚拟机崩溃的时候所有程序都被关闭。 Android安装包中的 JAR文件其实就是 Dex文件,只不过其扩展名为 .jar, 对于 APK中除 classes. dex之外的其他文件, 只要判定其为 Dex文件即可 决定是否进行扫描。
在实际应用中, 所述 Dex文件还可以包括其它 Dex格式的文件。 在本申请的一种优选实施例中, 所述可执行文件中的特定数据可以 按如下顺序来提取:
1 ) 可执行文件常量池中的常量;
具体而言, 所述指定文件中常量池中的常量可以包括字符串 strings, 类型 types、 域 fields和方法 methods中的常量, 所述可执行文件常量池 中的常量, 可以通过以下子步骤判断是否包含病毒信息:
子步骤 S21、 判断所述字符串 strings中的常量是否包含预定义的恶 意网址信息、 恶意文件名或恶意号码信息等恶意信息; 和 /或,
子步骤 S22、 判断所述类型 types、 域 fields和方法 methods中的常量 是否调用自定义的类名、 自定义的函数名或 Android系统 SDK类名、 Android系统函数名。
在具体应用中, 可以直接将所述常量中的病毒信息作为病毒特征码, 在实施例中生成的病毒特征码包括常量特征码、 类名函数名特征码。
例如, 某个 APK的 classes. dex文件中的常量池中包含如下字符串: com.noshufou.android.su
I system/ app/ com. google, update . apk
在判定其为病毒信息后, 可直接将其作为病毒特征码并保存至病毒 数据库中。
例如, 某个 APK的 classes. dex文件中的常量池中包含如下 method: Lcom/ android/ main/ SmsReceiver;
Lcom/android/main/ActionReceiver;
在判定其为病毒信息后, 可直接将其作为病毒特征码并保存至病毒 数据库中。
例如, 某个 APK的 classes. dex文件中的常量池中包含如下 type:
Lcom/androidkernel/flash/Main$l;
在判定其为病毒信息后, 可直接将其作为病毒特征码并保存至病毒 数据库中。
例如, 某个 APK的 classes. dex文件中的常量池中包含如下 field: Lcom/androidkernel/flash/b/br$l ;ihis$0:Lcom/androidkernel/flash/b/br; 在判定其为病毒信息后, 可直接将其作为病毒特征码并保存至病毒 数据库中。
2 ) 可执行文件中的操作指令;
Dalvik VM是基于寄存器设计的,程序中使用的数据如 strings, types, fields和 methods保存在专门的数据存储区 (常量池) 中, 在程序当中通 过对应的索引来引用, 而字符文字常量则直接保存在 instructions (操作 指令) 中, 其操作码 (opcode)分为两类:
一类将指定的数据放入寄存器, 如参见如下例 1至例 4:
例 1 :
1303 6100 |0000: const/16 v3, #int 97 II #61 将整数 97放入寄存器 v3中。
例 2:
1700 0000 0040 |0049: const-wide/32 νθ, #float 2.000000 II
#40000000
将浮点数 2.000000放入寄存器 νθ中。
例 3 :
Figure imgf000007_0001
将字符串" .2fMB "放入寄存器 νθ中。
例 4: 将类 com . qihoo360. mobile safe . service .NetTraffic Service放入哥存器 v3中。
另外一类则基于寄存器进行操作, 如参见如下例 5至例 10:
例 5 :
3100 0305 |0042: cmp-long νθ, v3, v5
比较寄存器 v3和 v5中的 long值, 将比较结果存入寄存器 v0。
例 6:
3221 0400 |001a: if-eq vl, v2, OOle II +0004 条件 if, 根据 vl和 v2是否相等来决定执行流程。
例 7 :
3800 1500 |001e: if-eqz νθ, 0033 II +0015 条件 if, 判断 νθ是否等于 0来决定执行流程。
例 8:
6el0 0e29 0500 |0006: invoke-virtual {v5},
Ljava/io/File;. length :() J // method@290e
调用 File的 lengthO函数。
例 9:
7010 042a 0800 |01 Id: invoke-direct {v8},
Lj ava/lang/ StringBuilder ; . <init>: () V II method@2a04
调用 StringBuilder的 init函数。
例 10:
b021 |0035: add-int/2addr vl, v2 将 vl+v2的结果保存在 vl中。
APK中的 classes. dex文件和 JAR文件中的用户类名, 函数名, 字符 串会受到混淆或者修改而发生改变,但 Dalvik VM的指令以及对 Android 系统 SDK提供的类的调用不会受到用户类名, 函数名, 变量名等被混淆 或者修改的影响, 因此可以通过一组有序的特定指令来识别 APK。 因为 Dalvik VM是基于寄存器的, 因此其指令本身只能操作寄存器, 字符文字 常量, 数据存储区, 而寄存器地址是可变的, 因此识别时要模糊匹配也 即通过识别指令中的固定部分—— opcode及其相关的字符文字常量参数 或者数据存储区中的 strings, types, fields和 methods等, 当然也可以直接 使用指令及其操作数本身作为病毒特征码。 在本申请的一种优选实施例中, 可以通过如下子步骤判断所述操作 指令是否包含病毒信息:
子步骤 S31、 判断所述操作数中是否包含预定义的非法操作数; 和 /或,
子步骤 S32、判断所述操作码和操作数的组合是否符合预定义的非法 搭配规则。
在本申请的一种优选实施例中, 可以通过如下子步骤根据所述操作 指令生成病毒特征码:
子步骤 S41、 将所述操作指令本身作为病毒特征码; 和 /或, 子步骤 S42、 将所述操作指令的操作码, 以及, 操作数的字符串或通 配符作为病毒特征码。
应用本实施例生成的病毒特征码包括操作数特征码、 指令特征码、 指令特征码序列。
特征码生成方案一:
直接使用 APK中的 classes. dex文件和 JAR文件中的特定指令集本身 作为病毒特征码。
例如,上述例 1的特征码可以为 1303 6100 ,例 2的特征码可以为 1700 0000 0040 , 例 3的特征码可以为 laOO 7d00 , 例 4的特征码可以为 lc03 6e04 , 例 5的特征码可以为 3100 0305 , 例 6的特征码可以为 3221 0400 , 例 7的特征码可以为 3800 1500 , 例 8的特征码可以为 6el0 0e29 0500 , 例 9的特征码可以为 7010 042a 0800 , 例 10的特征码可以为 b021。
特征码生成方案二:
使用 APK中的 classes. dex文件和 JAR文件中的特定 opcode及其操 作数的字符串或通配符作为病毒特征码。
例如, 上述例 1的特征码可以为 13$* (其中 *代表模糊匹配, 下同, 需要说明的是, 此处的 "*,,仅用作举例, 实际中可以使用任意字符) , 例
2的特征码可以为 17 $ * , 例 3的特征码可以为 1 a$ , 例 4的特征码可以为 以为 31$* , 例 6的特征码可以为 32$* , 例 7的特征码可以为 38$* , 例 8 的特征码可以为 6e$Ljava/io/File;.length:() , 例 9的特征码可以为
70$Ljava/lang/StringBuilder; <init>, 例 10的特征码可以为 b0$*。
特征码选择方案三: 混合使用上述方案一和方案二。 即将上述 APK中的 classes.dex中的 特定指令集本身, 以及, APK中的 classes.dex中的特定 opcode及其操作 数的字符串或通配符全部作为病毒特征码。
需要说明的是, 在本申请实施例中, 釆用 $为分隔符, 在实际中还可 釆用任意其他字符作为分隔符; 在本申请实施例中, 釆用 *作为通配符, 在实际中还可釆用任意其他字符作为通配符。
为使本领域技术人员更好地理解上述特征码生成的过程, 以下通过 一个具体示例进行说明。
针对提取 classes.dex中的常量池( string、 type , field和 meth ) 当中 的常量提取的特征码如下: 例如, 某病毒在其字符串常量池当中包括以 下特征字符串:
zjphonecall.txt和 zjsms.txt, 在这 2个文件中包括了恶意电话号码以 及特服短信号码则可提取其作为病毒特征码。
针对反汇编 classes.dex提取的特征码如下:
例如, 病毒 X卧底. apk中包含以下指令用以备份用户隐私数据至 http://www.mybackup.me , 按照其出现的先后顺序列举如下:
2200 f600 |0000: new-instance νθ, Ljava/lang/StringBuilder; II type@00f6
提取其病毒特征码为: 2200f600或 22$Ljava/lang/StringBuilder 7010 9804 0000 |0002: invoke-direct {νθ} ,
Ljava/lang/StringBuilder; <init>:()V II method@0498
提取其病毒特征码为: 701098040000或
70$Ljava/lang/StringBuilder;.<init>
laOl 5506 |0005: const-string vl , "http:〃 www.mybackup.me" II string@0655
提取其病毒特征码为: 701098040000 或 l a$http://www.mybackup.me 6e20 9e04 1000 |0007: invoke -virtual {νθ, vl } ,
Lj ava/lang/ StringBuilder;. append: (Lj ava/lang/ String ;)Lj ava/lang/ StringBuild er; II method@049e
提取其病毒特征码为: 6e209e041000或
6e$Ljava/lang/StringBuilder;. append
3902 0900 |0005 : if-nez v2, OOOe II +0009 提取其病毒特征码为: 39020900 或 39$*
0c02 |0003: move-result-object v2 提取其病毒特征码为: 0c02或 0c$*
最终获得的特征码为:
特征码选择方案一:
2200f6007010980400007010980400006e209e041000390209000c02 特征码选择方案二:
22$Ljava/lang/StringBuilder$70$Ljava/lang/StringBuilder;.<init>$la$ht tp://www.mybackup.me$6e$Ljava/lang/StringBuilder;.append$39$*$0c$* 特征码选择方案三:
22$Ljava/lang/StringBuilder$701098040000$la$http://www.mybackup. me$6e$Ljava/lang/StringBuilder;.append$39$*$0c02
又如, 某个 APK的 classes. dex文件中的 Instructions (操作指令 )如 下所示:
laOc bb08 |009b: const-string vl2, "tiger" II string@08bb laOd le03 |009d: const-string vl3, "P5" II string@031e
7120 1404 dcOO |009f: invoke-static {vl2, vl3},
Lcom/ androidkernel/ flash/ util/LogUtil ;.i:(Lj ava/lang/ String ;Lj ava/lang/ String ;) V // method@0414
2205 9700 |00a2: new-instance v5,
Lcom/androidkernel/flash/http/base/Dl Struct; II type@0097
7010 1603 0500 |00a4: invoke-direct {v5},
Lcom/androidkernel/flash/http/base/DlStruct;.<init>:()V II method@0316 laOc 7200 |00a7: const-string vl2, "AA" II string@0072 7020 f402 ceOO |00a9: invoke-direct {vl4, vl2},
Lcom/ androidkernel/ flash/helper/Tiger; . getUrl: (Lj ava/lang/ String;)Lj ava/lan g/String; II method@02f4
OcOb |00ac: move-result-object vl l 当判定上述操作码和操作数的搭配符合预定义的非法搭配规则, 或 者, 判定上述操作数中包含预定义的非法操作数时, 可按如下方式生成 特征码:
方式一: 0f402ce000c0b
方式二:
1 a$tiger$ la$P5$71 $Lcom/ androidkernel/ flash/ util/LogUtil ;.i:(Lj ava/lan g/String;Ljava/lang/String;)V$22$Lcom/androidkernel/f ash/http/base/DlStru ct;$70$Lcom/androidkernel/flash/http/base/DlStruct; <init>:()V$la$AA$70$ Lcom/ androidkernel/ flash/helper/Tiger; . getUrl: (Lj ava/lang/ String;)Lj ava/lan g/String;$0c$*
方式三:
la0cbb08$la$P5$71201404dc00$22$*$70$Lcom/androidkernel/flash/ht tp/base/DlStruct; <init>:()V$la$AA$70$Lcom/androidkernel/flash/helper/Ti ger;. getUrl: (Lj ava/lang/ String ; )Lj ava/lang/ String; $0 c $ *
3 ) 可执行文件的头部信息。
在具体实现中, 所述可执行文件的头部信息中包括摘要信息
checksum和 /或签名信息 Signature , 在这种情况下, 可以通过判断所述摘 要信息 checksum和 /或签名信息 Signature中是否包含预定义的非法字符 串, 来确定所述头部信息中是否包含病毒信息。
在具体应用中,也可以直接将所述摘要信息 checksum和 /或签名信息 Signature作为病毒特征码。 即在本实施例中, 所述病毒特征码包括头部 信息特征码。
例如, APK中的 classes. dex文件头部信息 header的 checksum为: l lf26cac; Signature为:
2911621AD071F675ADF0F590C3F1AFB5443BEBBE, 在判定其为木马病 毒后, 直接将 l lf26cac和
2911621AD071F675ADF0F590C3F1AFB5443BEBBE提取为病毒特征码, 并将所述病毒特征码保存至数据库中。
作为本申请实施例具体应用的一种示例, 所述将病毒特征码保存至 病毒数据库中的步骤可以包括如下子步骤:
子步骤 S51、 将所述头部信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码分别保存在数据库中 不同的存储区域; 或者,
子步骤 S52、 将所述头部信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码保存在数据库中, 并 分别标记分类标签。
当然, 上述保存病毒特征码的方式仅仅用作示例, 本领域技术人员 根据实际情况釆用任一种保存方式都是可行的, 本申请对此无需加以限 制。
步骤 102、 检测目标 Android安装包 APK中的指定文件中是否包含 所述病毒特征码, 所述指定文件包括可执行文件;
作为本申请实施例具体应用的一种示例, 所述病毒特征码可以包括: 头部信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征 码序列、 类名函数名特征码; 在这种情况下, 所述步骤 102具体可以包 括如下子步骤:
子步骤 S41、 定位目标 Android安装包 APK中可执行文件的头部信 息, 将所述头部信息与病毒数据库中的头部信息特征码进行匹配, 若匹 配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或,
子步骤 S42、 定位目标 Android安装包 APK中可执行文件常量池中 的常量, 将所述常量与病毒数据库中的常量特征码进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征码;
和 /或,
子步骤 S43、 定位目标 Android安装包 APK中可执行文件操作指令 中的操作数, 将所述操作数与病毒数据库中的操作数特征码进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征 码; 和 /或,
子步骤 S44、 定位目标 Android安装包 APK中可执行文件操作指令 中的操作码, 将所述操作码与病毒数据库中的指令特征码进行匹配, 若 匹配,则判定目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或,
子步骤 S45、 定位目标 Android安装包 APK中可执行文件操作指令 中的操作码, 将所述操作码与病毒数据库中的指令特征码序列进行匹配 , 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征 码; 和 /或,
子步骤 S46、 定位目标 Android安装包 APK中可执行文件常量池中 的常量以及操作指令中的操作数所调用的类名和 /或函数名, 将所述类名 和 /或函数名与病毒数据库中的类名函数名特征码进行匹配, 若匹配, 则 判定目标 Android安装包 APK中的指定文件中包含病毒特征码。
在具体实现中, 可以按如下方式进行匹配:
方式一: 直接逐字节按序扫描。
方式二: 病毒特征码序列按序扫描, 只需病毒特征码指令按序出现 即可, 无需连续出现。
方式三: 只需存在所有或部分特征码指令即可。
当然, 上述检测及匹配的方式仅仅用作示例, 本领域技术人员根据 实际情况釆用任一种检测及匹配病毒特征码的方式均是可行的, 本申请 对此无需加以限制。
步骤 103、 若是, 则确定所述目标 Android安装包 APK为病毒 APK。 为使本领域技术人员更好地理解本申请, 以下通过几个具体示例进 行说明。
例一:
1 ) 定位至 APK中的 classes. dex或者 JAR的操作指令 instruction开 始的地方 (以下简称之为代码段) ;
2 )从病毒数据库中的病毒特征码序列中根据分隔符提取第一个 instruction;
3 )从代码段中提取第一个 instruction;
4 ) 两者进行比较, 若相同则从特征码序列中根据分隔符提取下一个 instruction, 若不同则从代码段中提取下一个 instruction;
5 ) 以此类推逐指令进行匹配, 直至抵达代码段的末尾, 若匹配过程 中完全匹配则报告发现病毒。
例二:
1 )从病毒数据库的病毒特征码中提取相应的特征字符串 (可能为一 个或多个) 。
2 ) 查找字符串常量池中是否存在相应的特征字符串;
3 ) 若存在, 则报告发现病毒 APK。
例三:
1 )从病毒特征码中提取相应的特征字符串 (可能为一个或多个) , 特征函数名 (可能为一个或多个) ; 2 ) 查找字符串常量池以及函数常量池中是否存在相应的特征字符 串、 特征函数名。 其他 string, type , field和 meth pool的组合扫描依此类 推;
3 ) 若存在, 则报告发现病毒 APK。
本领域技术人员易于理解的是, 上述操作指令、 常量池和头部信息 的扫描并无先后顺序的限制, 本领域技术人员根据实际情况任意设定上 述三者的扫描顺序都是可行的, 本申请对此无需加以限制。
本申请实施例还适用于 APK中嵌套 APK的情形, 即当 APK中还包 含其它 APK时, 同样可应用本申请实施例, 对 APK及其嵌套 APK中的 可执行文件、 文本文件等进行解析和病毒提取, 例如, 在某个 1.APK中 嵌入了一个 root.apk用以获取 root权限,应用本申请实施例, 除从 1.APK 提取病毒特征码, 还会从 root.apk中提取病毒特征码。 本领域技术人员易 于想到的是, 对于多重嵌套 APK的情形, 本申请实施例亦同样适用, 本 申请在此不作限制。
参考图 2 , 示出了本申请的一种病毒 APK的识别方法实施例 2的步 骤流程图, 具体可以包括如下步骤:
步骤 201、 预置病毒数据库, 所述病毒数据库中包括病毒特征码; 在本申请的一种优选实施例中, 所述步骤 201可以包括如下子步骤: 子步骤 S51、 扫描源 Android安装包 APK中的指定文件, 所述指定 文件包括可执行文件和 /或文本文件;
子步骤 S52、提取所述可执行文件中的特定数据, 判断所述特定数据 是否包含病毒信息, 其中, 所述特定数据包括可执行文件的头部信息、 可执行文件常量池中的常量, 和 /或, 可执行文件中的操作指令;
子步骤 S53、 若是, 则根据所述特定数据生成病毒特征码;
子步骤 S54、提取所述文本文件中的 linux命令,判断所述 linux命令 是否包含病毒信息;
子步骤 S55、 若是, 则根据所述 linux命令生成病毒特征码。
子步骤 S56、 将所述病毒特征码保存至病毒数据库中。
在具体实现中, 可以通过判断所述 linux命令是否符合预置的恶意 linux命令确定所述 linux命令是否包含病毒信息,还可以将所述包含病毒 信息的 linux命令直接作为病毒特征码。 在本实施例中, 所述病毒特征码 还包括 linux命令特征码。 例如, 从 ΑΡΚ中的文本文件中提取相应的 linux命令如下: cat /system/bin/sh > I data/ data/$ 1 /files/ sh.new
chown 0.0 /data/data/$l/files/sh.new
chmod 4755 / data/ data/$ 1 /files/sh . new
rm -f /data/data/$l /files/sh mount -o remount system /system mkdir /system/xbin/$l
myuid=$2
if [ "$myuid" == "" ]; then
myuid="0"
fi
chown ${myuid} /system/xbin/$l
chmod 700 /system/xbin/$l cat /system/bin/sh > /system/xbin/$l/sh
chown 0.0 /system/xbin/$l/sh
chmod 4755 / system/ xbin/ $ 1 /sh sync
mount -o remount,ro system /system
#/system/bin/stop void
#/system/bin/start void
echo "+++ending+++"
在判定上述 linux命令符合预置的恶意 linux命令时, 将上述命令作 为病毒特征码写入病毒数据库中。
步骤 202、 检测目标 Android安装包 APK中的指定文件中是否包含 所述病毒特征码, 所述指定文件包括可执行文件和文本文件;
在本申请的一种优选实施例中, 所述步骤 202可以包括如下子步骤: 定位目标 Android安装包 APK中的文本文件, 将所述文本文件中的 linux命令与病毒数据库中的 linux命令特征码进行匹配, 若匹配, 则判定 目标 Android安装包 APK中的指定文件中包含病毒特征码。
步骤 203、 若是, 则确定所述目标 Android安装包 APK为病毒 APK。 本申请实施例适用于客户端软件及云查杀的过程中, 即上述病毒
APK识别的过程可以在客户端完成, 也可以在服务器端或云端完成, 本 申请对此不作限制。
以下提供本申请实施例的应用场景:
场景一: 依据用户的病毒扫描启动操作, 首先检查 APK是否变更以 及是否緩存过扫描结果, 若 APK未变更并且緩存过扫描结果则直接输出 扫描结果, 反之则进行黑名单扫描, 若在其中发现 APK存在, 则输出扫 描结果发现病毒 APK并增加至緩存, 若未发现则进行白名单扫描, 若在 其中发现 APK存在, 则输出扫描结果安全并增加至緩存, 若未发现则釆 用病毒数据库进行病毒特征码扫描, 并输出扫描结果以及增加至緩存。
场景二: 用户新装 APK, 杀毒程序收到新装 APK消息, 开始对用户 新装的 APK进行扫描, 首先进行黑名单扫描, 若在其中发现 APK存在, 则输出扫描结果发现病毒并增加至緩存, 若未发现则进行白名单扫描, 若在其中发现 APK存在, 则输出扫描结果安全并增加至緩存, 若未发现 则釆用病毒数据库进行病毒特征码扫描, 并输出扫描结果以及增加至緩 存。
本领域技术人员易于理解的是, 应用本申请实施例, 也可以通过直 接检测文本文件中是否包含病毒特征码来判定当前 APK是否为病毒
APK, 为节约篇幅, 本申请对此方案不作赘述。
本申请通过扫描分析源 APK文件中的指定文件, 如可执行文件、 文 本文件等, 针对包含病毒信息的指令、 常量或头部信息按预置规则生成 相应的病毒特征码,并汇编成病毒数据库;之后病毒 APK识别的过程中 , 检测目标 APK文件中的指定文件, 判断该指定文件中是否包含所述病毒 数据库中的病毒特征码, 从而确定目标 APK是否为病毒 APK。 应用本申 请实施例, 无论病毒制造者如何通过修改混淆方式、 增加资源、 修改代 码 (改变类名、 函数名等) 、 更换签名、 包名等方式来制作病毒变种其 病毒 APK的特征码都不会变, 从而本申请可以快速、 准确、 有效地识别 出病毒 APK及其变种,而且有针对性的更改程序逻辑以及特定字符串(恶 意号码、 恶意网址)来制作病毒变种相对病毒制造者而言是比较麻烦、 耗 时的, 从而这种方式也能有效的提高病毒制作者制作病毒变种的难度, 提高 APK应用的安全性。
需要说明的是, 本申请实施例不仅适用于各种 Android终端, 即使用 Android平台 (操作系统)的终端, 包括计算机、 PC、 笔记本电脑、 手机、 平板电脑等等; 还适用于在其他计算机系统 (例如 Windows, Linux )之 上使用的病毒特征码提取方案。
对于方法实施例, 为了简单描述, 故将其都表述为一系列的动作组 合, 但是本领域技术人员应该知悉, 本申请并不受所描述的动作顺序的 限制, 因为依据本申请, 某些步骤可以釆用其他顺序或者同时进行。 其 次, 本领域技术人员也应该知悉, 说明书中所描述的实施例均属于优选 实施例, 所涉及的动作和模块并不一定是本申请所必须的。
参考图 3 , 其示出了本申请的一种病毒 APK的识别装置实施例的结 构框图, 具体可以包括以下模块:
病毒数据库生成模块 301 , 用于预置病毒数据库, 所述病毒数据库中 包括病毒特征码;
病毒检测模块 302 , 用于检测目标 Android安装包 APK中的指定文 件中是否包含所述病毒特征码;
病毒识别模块 303 , 用于在所述目标 Android安装包 APK中的指定 文件中包含病毒特征码时, 确定所述目标 Android安装包 APK为病毒 APK。
在本申请的一种优选实施例中, 所述指定文件包括可执行文件, 所 述病毒数据库生成模块 301可以包括如下子模块:
源文件扫描子模块,用于扫描源 Android安装包 APK中的指定文件, 所述指定文件包括可执行文件;
特定数据提取子模块, 用于提取所述可执行文件中的特定数据, 判 断所述特定数据是否包含病毒信息, 其中, 所述特定数据包括可执行文 件的头部信息、 可执行文件常量池中的常量, 和 /或, 可执行文件中的操 作指令;
第一特征码生成子模块, 用于在所述特定数据包含病毒信息时, 根 据所述特定数据生成病毒特征码;
特征码保存子模块, 用于将所述病毒特征码保存至病毒数据库中。 作为本申请实施例具体应用的一种示例, 所述特征码保存子模块可 以进一步包括以下单元: 分区保存单元, 用于将所述头部信息特征码、 常量特征码、 操作数 特征码、 指令特征码、 指令特征码序列、 类名函数名特征码分别保存在 数据库中不同的存储区域; 或者,
标签保存单元, 用于将所述头部信息特征码、 常量特征码、 操作数 特征码、 指令特征码、 指令特征码序列、 类名函数名特征码保存在数据 库中, 并分别标记分类标签。
在具体应用中, 所述可执行文件可以包括 Dex文件, 所述 Dex文件 可以包括 classes. dex文件, 扩展名为. jar的文件, 以及, Dex格式的文件。
在本申请的一种优选实施例中, 所述病毒特征码可以包括: 头部信 息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码; 所述可执行文件中的操作指令包括操作码和操作数 两部分;
在这种情况下, 所述病毒检测模块 302可以包括如下子模块: 第一检测子模块, 用于定位目标 Android安装包 APK中可执行文件 的头部信息, 将所述头部信息与病毒数据库中的头部信息特征码进行匹 配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒 特征码; 和 /或,
第二检测子模块, 用于定位目标 Android安装包 APK中可执行文件 常量池中的常量, 将所述常量与病毒数据库中的常量特征码进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征 码; 和 /或,
第三检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作数, 将所述操作数与病毒数据库中的操作数特征码进 行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含 病毒特征码; 和 /或,
第四检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码进行 匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病 毒特征码; 和 /或,
第五检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码序列 进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包 含病毒特征码; 和 /或,
第六检测子模块, 用于定位目标 Android安装包 APK中可执行文件 常量池中的常量以及操作指令中的操作数所调用的类名和 /或函数名, 将 所述类名和 /或函数名与病毒数据库中的类名函数名特征码进行匹配, 若 匹配,则判定目标 Android安装包 APK中的指定文件中包含病毒特征码。
在具体实现中, 所述头部信息特征码、 常量特征码、 操作数特征码、 类名函数名特征码可以根据包含病毒信息的头部信息、 常量、 操作数和 类名函数名直接生成;
所述指令特征码、 指令特征码序列可以根据包含病毒信息的操作指 令直接生成, 或者, 可以根据包含病毒信息的操作码和操作数的字符串 或通配符生成。
在本申请的一种优选实施例中, 所述指定文件还可以包括文本文件, 在这种情况下, 所述病毒数据库生成模块 301还可以包括如下子模块: linux命令提取子模块, 用于提取所述文本文件中的 linux命令, 判断 所述 linux命令是否包含病毒信息;
第二特征码生成子模块, 用于在所述 linux命令包含病毒信息时, 根 据所述 linux命令生成病毒特征码。
相应的, 所述病毒特征码还可以包括 linux命令特征码, 所述病毒检 测模块 302还可以包括如下子模块:
第七检测子模块,用于定位目标 Android安装包 APK中的文本文件, 将所述文本文件中的 linux命令与病毒数据库中的 linux命令特征码进行 匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病 毒特征码。
在具体应用中, 所述可执行文件中常量池中的常量可以包括字符串 strings , 类型 types、 域 fields和方法 methods中的常量; 所述可执行文件 的头部信息中可以包括摘要信息 checksum和 /或签名信息 Signature。
由于所述装置实施例基本相应于前述图 1和图 2所示的方法实施例, 故本实施例的描述中未详尽之处, 可以参见前述实施例中的相关说明, 在此就不赘述了。
本发明的各个部件实施例可以以硬件实现, 或者以在一个或者多个 处理器上运行的软件模块实现, 或者以它们的组合实现。 本领域的技术 人员应当理解, 可以在实践中使用微处理器或者数字信号处理器 (DSP ) 来实现根据本发明实施例的病毒 AP K的识别装置中的一些或者全部部件 的一些或者全部功能。 本发明还可以实现为用于执行这里所描述的方法 的一部分或者全部的设备或者装置程序 (例如, 计算机程序和计算机程 序产品) 。 这样的实现本发明的程序可以存储在计算机可读介质上, 或 者可以具有一个或者多个信号的形式。 这样的信号可以从因特网网站上 下载得到, 或者在载体信号上提供, 或者以任何其他形式提供。
例如, 图 4示出了可以实现根据本发明的病毒 ΑΡΚ的识别方法的服 务器, 例如应用服务器。 该服务器传统上包括处理器 410和以存储器 420 形式的计算机程序产品或者计算机可读介质。 存储器 420 可以是诸如闪 存、 EEPROM (电可擦除可编程只读存储器) 、 EPROM、 硬盘或者 ROM 之类的电子存储器。 存储器 420 具有用于执行上述方法中的任何方法步 骤的程序代码 431的存储空间 430。 例如, 用于程序代码的存储空间 430 可以包括分别用于实现上面的方法中的各种步骤的各个程序代码 431。这 些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一 个或者多个计算机程序产品中。 这些计算机程序产品包括诸如硬盘, 紧 致盘 (CD ) 、 存储卡或者软盘之类的程序代码载体。 这样的计算机程序 产品通常为如参考图 5 所述的便携式或者固定存储单元。 该存储单元可 以具有与图 4的服务器中的存储器 420类似布置的存储段、 存储空间等。 程序代码可以例如以适当形式进行压缩。 通常, 存储单元包括计算机可 读代码 43 Γ , 即可以由例如诸如 410之类的处理器读取的代码, 这些代 码当由服务器运行时, 导致该服务器执行上面所描述的方法中的各个步 骤。
本文中所称的 "一个实施例"、 "实施例"或者"一个或者多个实施例" 意味着, 结合实施例描述的特定特征、 结构或者特性包括在本发明的至 少一个实施例中。 此外, 请注意, 这里"在一个实施例中"的词语例子不一 定全指同一个实施例。
在此处所提供的说明书中, 说明了大量具体细节。 然而, 能够理解, 本发明的实施例可以在没有这些具体细节的情况下被实践。 在一些实例 中, 并未详细示出公知的方法、 结构和技术, 以便不模糊对本说明书的 理解。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限 制, 并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计 出替换实施例。 在权利要求中, 不应将位于括号之间的任何参考符号构 造成对权利要求的限制。单词"包含"不排除存在未列在权利要求中的元件 或步骤。 位于元件之前的单词 "一"或"一个"不排除存在多个这样的元件。 本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计 算机来实现。 在列举了若干装置的单元权利要求中, 这些装置中的若干 个可以是通过同一个硬件项来具体体现。 单词第一、 第二、 以及第三等 的使用不表示任何顺序。 可将这些单词解释为名称。
此外, 还应当注意, 本说明书中使用的语言主要是为了可读性和教 导的目的而选择的, 而不是为了解释或者限定本发明的主题而选择的。 因此, 在不偏离所附权利要求书的范围和精神的情况下, 对于本技术领 域的普通技术人员来说许多修改和变更都是显而易见的。 对于本发明的 范围, 对本发明所做的公开是说明性的, 而非限制性的, 本发明的范围 由所附权利要求书限定。

Claims

权 利 要 求
1、 一种病毒 APK的识别方法, 其包括:
预置病毒数据库, 所述病毒数据库中包括病毒特征码;
检测目标 Android安装包 APK中的指定文件中是否包含所述病毒特 征码;
若是, 则确定所述目标 Android安装包 APK为病毒 APK。
2、 如权利要求 1所述的方法, 其中, 所述指定文件包括可执行文件, 所述预置病毒数据库的步骤包括:
扫描源 Android安装包 APK中的可执行文件;
提取所述可执行文件中的特定数据,判断所述特定数据是否包含病毒 信息, 其中, 所述特定数据包括可执行文件的头部信息、 可执行文件常 量池中的常量, 和 /或, 可执行文件中的操作指令;
若是, 则根据所述特定数据生成病毒特征码;
将所述病毒特征码保存至病毒数据库中。
3、 如权利要求 1或 2所述的方法, 其中, 所述可执行文件包括 Dex 文件, 所述 Dex文件包括 classes. dex文件, 扩展名为. jar的文件, 以及, Dex格式的文件。
4、 如权利要求 3所述的方法, 其中, 所述病毒特征码包括: 头部信 息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码; 所述可执行文件中的操作指令包括操作码和操作数 两部分;
所述头部信息特征码、 常量特征码、 操作数特征码、 类名函数名特征 码根据包含病毒信息的头部信息、 常量、 操作数和类名函数名直接生成; 所述指令特征码、指令特征码序列根据包含病毒信息的操作指令直接 生成, 或者, 根据包含病毒信息的操作码和操作数的字符串或通配符生 成;
所述将病毒特征码保存至病毒数据库中的步骤包括:
将所述头部信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码分别保存在数据库中不同的存储区 域; 或者,
将所述头部信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序列、 类名函数名特征码保存在数据库中, 并分别标记分类 标签。
5、 如权利要求 4所述的方法, 其中, 所述检测目标 Android安装包 APK中的指定文件中是否包含所述病毒特征码的步骤包括:
定位目标 Android安装包 APK中可执行文件的头部信息, 将所述头 部信息与病毒数据库中的头部信息特征码进行匹配, 若匹配, 则判定目 标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或,
定位目标 Android安装包 APK中可执行文件常量池中的常量, 将所 述常量与病毒数据库中的常量特征码进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或,
定位目标 Android安装包 APK中可执行文件操作指令中的操作数, 将所述操作数与病毒数据库中的操作数特征码进行匹配, 若匹配, 则判 定目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或, 定位目标 Android安装包 APK中可执行文件操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码进行匹配, 若匹配, 则判定 目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或,
定位目标 Android安装包 APK中可执行文件操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码序列进行匹配, 若匹配, 则 判定目标 Android安装包 APK中的指定文件中包含病毒特征码; 和 /或, 定位目标 Android安装包 APK中可执行文件常量池中的常量以及操 作指令中的操作数所调用的类名和 /或函数名, 将所述类名和 /或函数名与 病毒数据库中的类名函数名特征码进行匹配, 若匹配, 则判定目标
Android安装包 APK中的指定文件中包含病毒特征码。
6、 如权利要求 2或 5所述的方法, 其中, 所述指定文件还包括文本 文件, 所述预置病毒数据库的步骤还包括:
提取所述文本文件中的 linux命令, 判断所述 linux命令是否包含病 毒信息;
若是, 则根据所述 linux命令生成病毒特征码。
7、 如权利要求 6所述的方法, 其中, 所述病毒特征码还包括 linux 命令特征码, 所述检测目标 Android安装包 APK中的指定文件中是否包 含病毒特征码的步骤还包括:
定位目标 Android安装包 APK中的文本文件, 将所述文本文件中的 linux命令与病毒数据库中的 linux命令特征码进行匹配, 若匹配, 则判定 目标 Android安装包 APK中的指定文件中包含病毒特征码。
8、 如权利要求 5所述的方法, 其中, 所述可执行文件中常量池中的 常量包括字符串 strings , 类型 types、 域 fields和方法 methods中的常量; 所述可执行文件的头部信息中包括摘要信息 checksum和 /或签名信息 Signature。
9、 一种病毒 APK的识别装置, 其包括:
病毒数据库生成模块,用于预置病毒数据库, 所述病毒数据库中包括 病毒特征码;
病毒检测模块, 用于检测目标 Android安装包 APK中的指定文件中 是否包含所述病毒特征码;
病毒识别模块, 用于在所述目标 Android安装包 APK中的指定文件 中包含病毒特征码时 , 确定所述目标 Android安装包 APK为病毒 APK。
10、如权利要求 9所述的装置,其中,所述指定文件包括可执行文件, 所述病毒数据库生成模块包括:
源文件扫描子模块, 用于扫描源 Android安装包 APK中的可执行文 件;
特定数据提取子模块,用于提取所述可执行文件中的特定数据,判断 所述特定数据是否包含病毒信息, 其中, 所述特定数据包括可执行文件 的头部信息、 可执行文件常量池中的常量, 和 /或, 可执行文件中的操作 指令;
第一特征码生成子模块,用于在所述特定数据包含病毒信息时,根据 所述特定数据生成病毒特征码;
特征码保存子模块, 用于将所述病毒特征码保存至病毒数据库中。
11、如权利要求 9或 10所述的装置,其中,所述可执行文件包括 Dex 文件, 所述 Dex文件包括 classes. dex文件, 扩展名为. jar的文件, 以及, Dex格式的文件。
12、 如权利要求 11所述的装置, 其中, 所述病毒特征码包括: 头部 信息特征码、 常量特征码、 操作数特征码、 指令特征码、 指令特征码序 歹^ 类名函数名特征码; 所述可执行文件中的操作指令包括操作码和操 作数两部分;
所述头部信息特征码、 常量特征码、 操作数特征码、 类名函数名特征 码根据包含病毒信息的头部信息、 常量、 操作数和类名函数名直接生成; 所述指令特征码、指令特征码序列根据包含病毒信息的操作指令直接 生成, 或者, 根据包含病毒信息的操作码和操作数的字符串或通配符生 成;
所述特征码保存子模块进一步包括:
分区保存单元, 用于将所述头部信息特征码、 常量特征码、操作数特 征码、 指令特征码、 指令特征码序列、 类名函数名特征码分别保存在数 据库中不同的存储区域; 或者,
标签保存单元, 用于将所述头部信息特征码、 常量特征码、操作数特 征码、 指令特征码、 指令特征码序列、 类名函数名特征码保存在数据库 中, 并分别标记分类标签。
13、 如权利要求 12所述的装置, 其中, 所述病毒检测模块包括: 第一检测子模块, 用于定位目标 Android安装包 APK中可执行文件 的头部信息, 将所述头部信息与病毒数据库中的头部信息特征码进行匹 配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒 特征码; 和 /或,
第二检测子模块, 用于定位目标 Android安装包 APK中可执行文件 常量池中的常量, 将所述常量与病毒数据库中的常量特征码进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病毒特征 码; 和 /或,
第三检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作数, 将所述操作数与病毒数据库中的操作数特征码进 行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含 病毒特征码; 和 /或,
第四检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码进行 匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病 毒特征码; 和 /或,
第五检测子模块, 用于定位目标 Android安装包 APK中可执行文件 操作指令中的操作码, 将所述操作码与病毒数据库中的指令特征码序列 进行匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包 含病毒特征码; 和 /或, 第六检测子模块, 用于定位目标 Android安装包 APK中可执行文件 常量池中的常量以及操作指令中的操作数所调用的类名和 /或函数名, 将 所述类名和 /或函数名与病毒数据库中的类名函数名特征码进行匹配, 若 匹配,则判定目标 Android安装包 APK中的指定文件中包含病毒特征码。
14、 如权利要求 10或 13所述的装置, 其中, 所述指定文件还包括文 本文件, 所述病毒数据库生成模块还包括:
linux命令提取子模块, 用于提取所述文本文件中的 linux命令, 判断 所述 linux命令是否包含病毒信息;
第二特征码生成子模块, 用于在所述 linux命令包含病毒信息时, 根 据所述 linux命令生成病毒特征码。
15、 如权利要求 14所述的装置, 其中, 所述病毒特征码还包括 linux 命令特征码, 所述病毒检测模块还包括:
第七检测子模块,用于定位目标 Android安装包 APK中的文本文件, 将所述文本文件中的 linux命令与病毒数据库中的 linux命令特征码进行 匹配, 若匹配, 则判定目标 Android安装包 APK中的指定文件中包含病 毒特征码。
16、 如权利要求 12所述的装置, 其中, 所述可执行文件中常量池中 的常量包括字符串 strings , 类型 types、 域 fields和方法 methods中的常 量;所述可执行文件的头部信息中包括摘要信息 checksum和 /或签名信息 Signature。
17、 一种计算机程序, 包括计算机可读代码, 当所述计算机可读代 码在服务器上运行时,导致所述服务器执行根据权利要求 1-8中的任一个 所述的病毒 APK的识别方法。
18、 一种计算机可读介质, 其中存储了如权利要求 17所述的计算机 程序。
PCT/CN2013/072474 2012-03-21 2013-03-12 病毒apk的识别方法及装置 WO2013139215A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US14/386,681 US9619650B2 (en) 2012-03-21 2013-03-12 Method and device for identifying virus APK
US15/440,901 US10152594B2 (en) 2012-03-21 2017-02-23 Method and device for identifying virus APK

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210076889.2 2012-03-21
CN201210076889.2A CN102663286B (zh) 2012-03-21 2012-03-21 一种病毒apk的识别方法及装置

Related Child Applications (2)

Application Number Title Priority Date Filing Date
US14/386,681 A-371-Of-International US9619650B2 (en) 2012-03-21 2013-03-12 Method and device for identifying virus APK
US15/440,901 Continuation US10152594B2 (en) 2012-03-21 2017-02-23 Method and device for identifying virus APK

Publications (1)

Publication Number Publication Date
WO2013139215A1 true WO2013139215A1 (zh) 2013-09-26

Family

ID=46772774

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/072474 WO2013139215A1 (zh) 2012-03-21 2013-03-12 病毒apk的识别方法及装置

Country Status (3)

Country Link
US (2) US9619650B2 (zh)
CN (1) CN102663286B (zh)
WO (1) WO2013139215A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309785A (zh) * 2022-08-08 2022-11-08 北京百度网讯科技有限公司 文件规则引擎库的生成、文件信息检测方法、装置及设备

Families Citing this family (35)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663286B (zh) * 2012-03-21 2015-05-06 北京奇虎科技有限公司 一种病毒apk的识别方法及装置
CN103546448A (zh) * 2012-12-21 2014-01-29 哈尔滨安天科技股份有限公司 一种基于格式解析的网络病毒检测方法及系统
CN103093148A (zh) * 2012-12-28 2013-05-08 广东欧珀移动通信有限公司 一种恶意广告的检测方法、系统及设备
CN103268444B (zh) * 2012-12-28 2016-06-01 武汉安天信息技术有限责任公司 一种基于插件加载的android恶意代码检测系统及方法
CN103077349B (zh) * 2013-01-05 2016-04-13 北京奇虎科技有限公司 一种浏览器侧提示访问安全信息的方法及装置
CN103902900A (zh) * 2013-05-03 2014-07-02 哈尔滨安天科技股份有限公司 外部提取式移动终端恶意代码检测装置及方法
CN103400076B (zh) 2013-07-30 2016-01-06 腾讯科技(深圳)有限公司 一种移动终端上的恶意软件检测方法、装置和系统
CN104899009A (zh) * 2014-03-03 2015-09-09 可牛网络技术(北京)有限公司 一种安卓应用的识别方法及装置
CN103886258A (zh) * 2014-03-10 2014-06-25 珠海市君天电子科技有限公司 一种病毒检测方法及装置
CN104915596B (zh) * 2014-03-10 2018-01-26 可牛网络技术(北京)有限公司 apk病毒特征库构建方法、装置及apk病毒检测系统
CN103955449B (zh) * 2014-04-21 2018-03-06 安一恒通(北京)科技有限公司 定位目标样本的方法和装置
CN104216946B (zh) * 2014-07-31 2019-03-26 百度在线网络技术(北京)有限公司 一种用于确定重打包应用程序的方法和装置
CN104318161A (zh) * 2014-11-18 2015-01-28 北京奇虎科技有限公司 一种安卓样本的病毒检测方法及装置
US9519780B1 (en) * 2014-12-15 2016-12-13 Symantec Corporation Systems and methods for identifying malware
KR101574652B1 (ko) * 2015-01-14 2015-12-11 한국인터넷진흥원 모바일 침해사고 분석시스템 및 방법
CN104657661B (zh) * 2015-01-26 2018-05-22 武汉安天信息技术有限责任公司 移动终端中恶意代码的检测方法和装置
CN105389510A (zh) * 2015-12-14 2016-03-09 江山市同舟数码科技有限公司 一种安卓移动设备恶意软件检测方法和系统
CN106934288B (zh) * 2015-12-31 2021-04-16 北京金山安全软件有限公司 一种root病毒清理方法、装置及电子设备
CN106934287B (zh) 2015-12-31 2020-02-11 北京金山安全软件有限公司 一种root病毒清理方法、装置及电子设备
CN106940771A (zh) * 2016-01-04 2017-07-11 阿里巴巴集团控股有限公司 基于文件的漏洞检测方法和装置
CN108256324A (zh) * 2016-12-29 2018-07-06 武汉安天信息技术有限责任公司 一种针对加固apk样本的检测方法及系统
CN108334776B (zh) * 2017-01-19 2020-09-04 中国移动通信有限公司研究院 一种变形恶意代码的检测方法及装置
CN109214179B (zh) * 2017-06-30 2021-04-27 武汉斗鱼网络科技有限公司 一种程序模块安全检测方法及装置
CN109558731B (zh) * 2017-09-26 2022-04-08 腾讯科技(深圳)有限公司 特征码处理方法、装置及存储介质
CN107885505B (zh) * 2017-09-30 2021-05-14 浙江福山电子科技有限责任公司 一种代码定位方法
CN111104671B (zh) * 2018-10-25 2023-05-30 阿里巴巴集团控股有限公司 应用的标识确定方法和应用的检测方法
CN109635565A (zh) * 2018-11-28 2019-04-16 江苏通付盾信息安全技术有限公司 恶意程序的检测方法、装置、计算设备及计算机存储介质
CN112580036B (zh) * 2019-09-30 2024-01-30 奇安信安全技术(珠海)有限公司 病毒防御的优化方法及装置、存储介质、计算机设备
CN110826068B (zh) * 2019-11-01 2022-03-18 海南车智易通信息技术有限公司 安全检测方法和安全检测系统
CN110941833A (zh) * 2019-12-04 2020-03-31 厦门安胜网络科技有限公司 一种检测apk文件中漏洞的方法、装置及存储介质
CN113259768B (zh) * 2020-02-10 2022-12-20 中国电信股份有限公司 管理机顶盒中apk的方法、系统与介质
CN111581331B (zh) * 2020-04-27 2023-08-25 抖音视界有限公司 文案处理的方法、装置、电子设备及计算机可读介质
CN113312624B (zh) * 2021-06-21 2023-06-30 厦门服云信息科技有限公司 一种Java Web应用内存木马检测方法、终端设备及存储介质
CN113805892B (zh) * 2021-09-17 2024-04-05 杭州云深科技有限公司 一种异常apk的识别方法、电子设备及可读存储介质
CN113805893B (zh) * 2021-09-17 2023-04-28 杭州云深科技有限公司 一种异常apk的识别方法、电子设备及可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441351A (zh) * 2002-02-28 2003-09-10 株式会社Ntt都科摩 信息处理系统及信息处理方法
CN101162485A (zh) * 2006-10-11 2008-04-16 飞塔信息科技(北京)有限公司 一种计算机恶意代码处理方法和系统
US20110145920A1 (en) * 2008-10-21 2011-06-16 Lookout, Inc System and method for adverse mobile application identification
CN102663286A (zh) * 2012-03-21 2012-09-12 奇智软件(北京)有限公司 一种病毒apk的识别方法及装置
CN102663285A (zh) * 2012-03-21 2012-09-12 奇智软件(北京)有限公司 一种apk病毒特征码的提取方法及装置

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1235108C (zh) * 2004-03-29 2006-01-04 四川大学 一种计算机病毒检测和识别方法
CN100444075C (zh) * 2005-11-08 2008-12-17 北京网秦天下科技有限公司 用于移动/智能终端的病毒特征提取和检测系统及方法
CN100437614C (zh) * 2005-11-16 2008-11-26 白杰 未知病毒程序的识别及清除方法
US9104871B2 (en) * 2006-04-06 2015-08-11 Juniper Networks, Inc. Malware detection system and method for mobile platforms
US8590039B1 (en) * 2007-11-28 2013-11-19 Mcafee, Inc. System, method and computer program product for sending information extracted from a potentially unwanted data sample to generate a signature
US9235704B2 (en) * 2008-10-21 2016-01-12 Lookout, Inc. System and method for a scanning API
US9367680B2 (en) * 2008-10-21 2016-06-14 Lookout, Inc. System and method for mobile communication device application advisement
US8826439B1 (en) * 2011-01-26 2014-09-02 Symantec Corporation Encoding machine code instructions for static feature based malware clustering
CN102254113A (zh) * 2011-06-27 2011-11-23 深圳市安之天信息技术有限公司 一种检测和拦截移动终端恶意代码的方法及系统
US8874579B2 (en) * 2011-08-18 2014-10-28 Verisign, Inc. Systems and methods for identifying associations between malware samples
KR101299099B1 (ko) * 2011-09-07 2013-09-16 주식회사 팬택 임베디드 시스템에서 최적화된 가상화 모듈을 관리하는 장치 및 방법
US20130067577A1 (en) * 2011-09-14 2013-03-14 F-Secure Corporation Malware scanning
CN102346829B (zh) * 2011-09-22 2013-09-18 重庆大学 基于集成分类的病毒检测方法
US9781151B1 (en) * 2011-10-11 2017-10-03 Symantec Corporation Techniques for identifying malicious downloadable applications
US8806641B1 (en) * 2011-11-15 2014-08-12 Symantec Corporation Systems and methods for detecting malware variants

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441351A (zh) * 2002-02-28 2003-09-10 株式会社Ntt都科摩 信息处理系统及信息处理方法
CN101162485A (zh) * 2006-10-11 2008-04-16 飞塔信息科技(北京)有限公司 一种计算机恶意代码处理方法和系统
US20110145920A1 (en) * 2008-10-21 2011-06-16 Lookout, Inc System and method for adverse mobile application identification
CN102663286A (zh) * 2012-03-21 2012-09-12 奇智软件(北京)有限公司 一种病毒apk的识别方法及装置
CN102663285A (zh) * 2012-03-21 2012-09-12 奇智软件(北京)有限公司 一种apk病毒特征码的提取方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309785A (zh) * 2022-08-08 2022-11-08 北京百度网讯科技有限公司 文件规则引擎库的生成、文件信息检测方法、装置及设备
CN115309785B (zh) * 2022-08-08 2023-07-07 北京百度网讯科技有限公司 文件规则引擎库的生成、文件信息检测方法、装置及设备

Also Published As

Publication number Publication date
CN102663286B (zh) 2015-05-06
CN102663286A (zh) 2012-09-12
US20150052612A1 (en) 2015-02-19
US20170161496A1 (en) 2017-06-08
US9619650B2 (en) 2017-04-11
US10152594B2 (en) 2018-12-11

Similar Documents

Publication Publication Date Title
WO2013139215A1 (zh) 病毒apk的识别方法及装置
WO2013139216A1 (zh) 一种apk病毒特征码的提取方法及装置
US10114946B2 (en) Method and device for detecting malicious code in an intelligent terminal
US10891378B2 (en) Automated malware signature generation
CN102708320B (zh) 一种病毒apk的识别方法及装置
US8087086B1 (en) Method for mitigating false positive generation in antivirus software
JP5572763B2 (ja) ウェブサイトスキャン装置及びその方法
US8352484B1 (en) Systems and methods for hashing executable files
WO2015101042A1 (zh) 检测智能终端中恶意代码的方法及装置
US10027704B2 (en) Malicious program finding and killing device, method and server based on cloud security
WO2015101043A1 (zh) 检测智能终端中恶意代码的方法及装置
US20120210431A1 (en) Detecting a trojan horse
WO2015101097A1 (zh) 特征提取的方法及装置
WO2014166312A1 (zh) 一种广告插件识别的方法和系统
WO2012113272A1 (zh) 一种提高终端上网安全性的方法、系统和装置
WO2013044744A1 (zh) 一种下载资源提供方法及装置
WO2014082599A1 (zh) 用于恶意程序查杀的扫描设备、云端管理设备及方法和系统
CN104715199A (zh) 一种病毒apk的识别方法及装置
CN115562992A (zh) 一种文件检测方法、装置、电子设备及存储介质
US20210342447A1 (en) Methods and apparatus for unknown sample classification using agglomerative clustering
CN110135153A (zh) 软件的可信检测方法及装置
WO2014000696A1 (zh) 一种Android应用程序的安全检测方法及系统
KR101270497B1 (ko) 모바일 악성코드 자동 수집 및 분석 시스템
CN107566349B (zh) 一种检测网络服务器中敏感文件泄露的方法及计算设备
Cho et al. NCD based DEX similarity inspection for detection of fake mobile apps on android platform

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: 13763672

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14386681

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13763672

Country of ref document: EP

Kind code of ref document: A1