Patent Publication Number: US-2017366562-A1

Title: On-Device Maliciousness Categorization of Application Programs for Mobile Devices

Description:
BACKGROUND 
     1. Technical Field 
     The present invention relates generally to the field of application and data security and, more particularly, to the detection and classification of malware on mobile devices. 
     2. Background Information 
     The ubiquity of electronic devices, particularly mobile devices, is an ever-growing opportunity for cybercriminals and hackers who use malicious software (malware) to invade users&#39; personal lives, to develop potentially unwanted applications (PUA) such as riskware, pornware, risky payment apps, hacktool and adware, and to bring unpleasant experience in smart phone usage. Cybercriminals can use malware and PUA to disrupt the operation of mobile devices, display unwanted advertising, intercept messages and documents, monitor calls, steal personal and other valuable information, or even eavesdrop on personal communications. Examples of different types of malware include computer viruses, Trojans, rootkits, ransomware, bots, worms, spyware, scareware, exploit, shell, and packer. As the number of electronic devices and software applications for those devices grows, so do the number and types of vulnerability and the amount and variety of software that is hostile or intrusive. Malware can take the form of executable code, scripts, active content and other software. It can also be disguised as, or embedded in, non-executable files such as PNG files. In addition, as technology progresses at an ever faster pace, malware can increasingly create hundreds of thousands of infections in a period of time (e.g., as short as a few days). 
     Mobile devices often rely on signature based malware detection approaches to protect against malware. In that approach, signatures of malwares are known and the mobile device compares the signatures of its software to the known malware signatures. The signatures are typically determined outside the mobile device, for example by a more powerful cluster of backend servers, and then loaded to the mobile device. However, this approach usually compromises between efficiency and coverage and cannot offer comprehensive and efficient protection against malware. As the number of malwares grows, the number of malware signatures also grows and it can be computationally expensive for a mobile device to compare against all known malware signatures. It is also important to detect new types of malware as they are introduced into the technology ecosystem. However, given technology trends, this task is becoming ever more difficult due to the increasing number and variety of devices, vulnerabilities and malware. Furthermore, it must be accomplished in ever shorter time periods due to the increasing speed with which malware can proliferate and cause damage. 
     SUMMARY 
     An on-device security vulnerability detection method performs dynamic analysis of application programs on a mobile device. In one aspect, an operating system of a mobile device is configured to include instrumentations and an analysis application program package is configured for installation on the mobile device to interact with the instrumentations. When an application program executes on the mobile device, the instrumentations enables recording of information related to execution of the application program. The analysis application interfaces with the instrumented operating system to analyze the behaviors of the application program using the recorded information. The application program is categorized (e.g., as benign or malicious) based on its behaviors, for example by using machine learning models. 
     This approach can be used at different layers of the hardware/software stack of the mobile device, including the application layer, operating system layer (framework layer and kernel layer), and/or hardware layer. The information collected will differ by layer, as will the behaviors and machine learning models. 
     Other aspects include components, devices, systems, improvements, methods, processes, applications, computer readable mediums, and other technologies related to any of the above. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The invention has other advantages and features which will be more readily apparent from the following detailed description of the invention and the appended claims, when taken in conjunction with the accompanying drawings, in which: 
         FIG. 1  is a high-level block diagram illustrating a technology environment that includes an analysis system that protects the environment against malware, according to one embodiment. 
         FIG. 2A  (prior art) is a block diagram illustrating architecture layers of a conventional mobile device. 
         FIG. 2B  is a block diagram illustrating architecture layers of a client device, according to one embodiment. 
         FIGS. 3A-B  are high-level block diagrams illustrating detecting security vulnerability as implemented on client devices, according to different embodiments. 
         FIG. 4  is a high-level block diagram illustrating a client device for detecting security vulnerabilities, according to one embodiment. 
         FIG. 5  is a high-level block diagram illustrating an analysis system for detecting security vulnerabilities, according to one embodiment. 
         FIG. 6  is a high-level block diagram illustrating a behavior observation module for generating behavior tokens, according to one embodiment. 
         FIG. 7  is a high-level block diagram illustrating an example of a computer for use as one or more of the entities illustrated in  FIG. 1 , according to one embodiment. 
     
    
    
     DETAILED DESCRIPTION 
     The Figures (FIGS.) and the following description describe certain embodiments by way of illustration only. One skilled in the art will readily recognize from the following description that alternative embodiments of the structures and methods illustrated herein may be employed without departing from the principles described herein. Reference will now be made to several embodiments, examples of which are illustrated in the accompanying figures. It is noted that wherever practicable similar or like reference numbers may be used in the figures and may indicate similar or like functionality. 
       FIG. 1  is a high-level block diagram illustrating a technology environment  100  that includes an analysis system  140 , which protects the environment against malware, according to one embodiment. The environment  100  also includes users  110 , enterprises  120 , application marketplaces  130 , and a network  160 . The network  160  connects the users  110 , enterprises  120 , app markets  130 , and the analysis system  140 . In this example, only one analysis system  140  is shown, but there may be multiple analysis systems or multiple instances of analysis systems. The analysis system  140  provides security vulnerabilities (e.g., malware, viruses, spyware, Trojans, etc.) detection services to the users  110 . The users  110 , via various electronic devices (not shown), receive security vulnerability such as malware detection results from the analysis system  140 . The users  110  may interact with the analysis system  140  by visiting a website hosted by the analysis system  140 . As an alternative, the users  110  may download and install a dedicated application to interact with the analysis system  140 . The users  110  may download and install a dedicated application to interact with the analysis system  140 . A user  110  may sign up to receive security vulnerability detection services such as receiving a comprehensive overall security score indicating whether a device or application or any file is safe or not, malware or virus scanning service, security monitoring service, and the like. 
     User devices include computing devices such as mobile devices (e.g., smartphones or tablets with operating systems such as Android or Apple IOS), laptop computers, wearable devices, desktop computers, smart automobiles or other vehicles, or any other type of network-enabled device that downloads, installs, and/or executes applications. A user device may query a detection Application program interface (“API”) and other security scanning APIs hosted by the analysis system  140 . A user device may detect malware based on the local dynamic analysis engine embedded in an application installed in its read only memory (ROM). A user device typically includes hardware and software to connect to the network  160  (e.g., via Wi-Fi and/or Long Term Evolution (LTE) or other wireless telecommunication standards), and to receive input from the users  110 . In addition to enabling a user to receive security vulnerability detection services from the analysis system  140 , user devices may also provide the analysis system  140  with data about the status and use of user devices, such as their network identifiers and geographic locations. 
     The enterprises  120  also receive security vulnerabilities (e.g., malware, viruses, spyware, Trojans, etc.) detection services provided by the analysis system  140 . Examples of enterprises  120  include corporations, universities, and government agencies. The enterprises  120  and their users may interact with the analysis system  140  in at least the same ways as the users  110 , for example through a website hosted by the analysis system  140  or via dedicated applications installed on enterprise devices. Enterprises  120  may also interact in different ways. For example, a dedicated enterprise-wide application of the analysis system  140  may be installed to facilitate interaction between enterprise users  120  and the analysis system  140 . Alternately, some or all of the analysis system  140  may be hosted by the enterprise  120 . In addition to individual user devices described above, the enterprise  120  may also use enterprise-wide devices. 
     Application marketplaces  130  distribute application programs to users  110  and enterprises  120 . An application marketplace  130  may be a digital distribution platform for mobile application software or other types of computer software. An application program publisher (e.g., developers, vendors, corporations, etc.) may release an application program package to the application marketplace  130 . The application program package may be available for the public (i.e., all users  110  and enterprises  120 ) or specific users  110  and/or enterprises  120  selected by the software publisher for download and use. In one embodiment, the application being distributed by the application marketplace  130  is a software package in the format of Android application package (APK). Although the examples below refer to APKs, that is not a limitation. In other embodiments, the application being distributed may alternatively and/or additionally be software packages in other forms or file formats. 
     The analysis system  140  provides security vulnerabilities detection services, such as malware detection services, to users  110  and enterprises  120 . The analysis system  140  detects security threats on the user devices of the users  100  as well as on the enterprise devices of the enterprises  120 . The user devices and the enterprise devices are hereinafter referred together as the “client devices” and the users  110  and enterprises  120  as “clients”. In various embodiments, the analysis system  140  analyzes APKs of the application programs to detect malicious application programs. APKs of the application programs are identified by unique APK IDs, such as a hash of the APK. The analysis system  140  may notify a client of the malicious application programs installed on the client device. The analysis system  140  may notify a client when determining that the client is attempting to install or has installed a malicious application program on the client device. The analysis system  140  analyzes new and existing APKs. New APKs are APKs that are not known to the analysis system  140  and for which the analysis system  140  does not yet know whether the APK is malware. Existing APKs are APKs that are already known to the analysis system  140 . For example, they may have been previously analyzed by the analysis system  140  or they may have been previously identified to the analysis system  140  by a third party, for example, using other signature based detection modules. 
     If the APK is new to the analysis system  140 , the analysis system  140  analyzes the new application program to determine whether it is malware or other security vulnerability. The analysis system  140  receives new APKs in a number of ways. As one example, the dedicated application of the analysis system  140  that is installed on a client device (e.g., analysis apps  170  and  180 ) identifies new APKs and provides them to the analysis system  140 . As another example, the analysis system  140  periodically crawls the app marketplace  130  for new APKs. As a further example, the app marketplace  130  periodically provides new APKs to the analysis system  140 , for example, through automatic channels. 
     For existing APKs, the analysis system  140  may apply regression testing to verify analysis of existing APKs. New models may be applied to analyze existing APKs to verify detection of malware and other security vulnerability. For example, the analysis system  140  may over time be enhanced with the ability to detect more malicious behaviors. Thus, the analysis system  140  analyzes the existing APKs that have been analyzed previously to identify whether any of the existing APKs that were detected to be benign are in fact malicious, or vice versa. 
     The analysis system  140  includes one or more classification systems  150  that may apply different techniques to classify an APK. For example, a classification system  150  analyzes system logs of an APK to detect malicious codes thereby to classify the APK. As another example, a classification system  150  traces execution of the application such as control flows and/or data flows to detect anomalous behavior thereby to classify an APK. The analysis system  140  maintains a list of identified malicious APKs. 
     The network  160  is the communication pathway between the users  110 , enterprises  120 , application marketplaces  130 , and the analysis system  140 . In one embodiment, the network  160  uses standard communications technologies and/or protocols and can include the Internet. Thus, the network  160  can include links using technologies such as Ethernet, 802.11, InfiniBand, PCI Express Advanced Switching, etc. Similarly, the networking protocols used on the network  160  can include multiprotocol label switching (MPLS), transmission control protocol/Internet protocol (TCP/IP), User Datagram Protocol (UDP), hypertext transport protocol (HTTP) and secure hypertext transport protocol (HTTPS), simple mail transfer protocol (SMTP), file transfer protocol (FTP), etc. The data exchanged over the network  160  can be represented using technologies and/or formats including image data in binary form (e.g. Portable Network Graphics (PNG)), hypertext markup language (HTML), extensible markup language (XML), etc. In addition, all or some of the links can be encrypted using conventional encryption technologies such as secure sockets layer (SSL), transport layer security (TLS), virtual private networks (VPNs), Internet Protocol security (IPsec), etc. In another embodiment, the entities on the network  160  can use custom and/or dedicated data communications technologies instead of, or in addition to, the ones described above. 
     The analysis applications  170  and  180  are dedicated apps installed on a user device and an enterprise device, respectively. When installing an APK, the analysis application  170  or  180  compares the APK ID to the analysis results from the analysis system  140 . The analysis results include malicious applications that are identified by the APK IDs. If the new APK ID matches the APK ID of a known malicious APK, the analysis application  170  or  180  alerts the user of the security threat and/or takes other appropriate action. For convenience, the description that follows is made with respect to the analysis application  170 , but it should be understood that the description also applies to analysis application  180 . 
     When client devices are offline and there is no communication between the analysis system  140  and the client devices, the client devices can no longer receive protection against security vulnerabilities from the analysis system  140 . The client devices can still detect malware and other security vulnerabilities, for example by analyzing behaviors of applications on-device. In the following examples, the analysis is based on machine learning models. The machine learning models running on the client device are provided by the analysis system  140 . They may be machine learning models that result from training of the analysis system  140 . The analysis app  170 , in conjunction with additional software/hardware on the device, may identify malware and other security vulnerabilities by observing and analyzing the behavior of the application program. The analysis app  170  may further intercept malicious behavior or report malicious application programs thereby to prevent damage. Details of examples of on-device detection of malware and other security vulnerabilities are provided with respect to  FIGS. 2B through 4 . 
       FIG. 2A  (prior art) is a block diagram illustrating architecture layers of a conventional mobile device, such as a mobile phone. The mobile device includes a hardware layer  202 , a firmware layer  204 , an operating system  206  that includes a kernel layer  208  and an application framework layer  210 , and an applications layer  212 . The hardware layer  202  includes a collection of physical components such as one or more processors, memories (e.g., read only memory (ROM), random access memory (RAM)), circuit boards, antennas, cameras, speakers, sensors, Global Positioning Systems (GPSs), Light Emitting Diodes (LEDs), and the like. The physical components are interconnected and execute instructions. The firmware layer  204  includes firmware that provides control, monitoring and data manipulation of the hardware layer  202 . Firmware usually resides in the ROM. 
     The operating system  206  is system software that manages hardware and software resources of the mobile device and provides common services for computer programs such as application programs on the applications layer  212 . The kernel layer  208  includes computer program that constitutes the central core of the operating system  206 . For example, the kernel layer  108  manages input/output requests from software and translates them into data processing instructions for the processor, manages memories, manages and communicates with computing peripheral hardware such as cameras, and the like. On top of the kernel layer  208  is the application framework layer  210  that includes a software framework that provides generic functionality that can be selectively changed by additional code. Software frameworks may include support programs, compliers, code libraries, tool sets, and application programming interfaces (APIs). The applications layer  212  includes application programs that are designed to perform various functions, tasks, or activities. 
       FIG. 2B  is a block diagram illustrating architecture layers of a client device  200  including on-device malware and other security vulnerability detection through behavioral analysis, according to one embodiment. The operating system layer  226  is modified to include additional instrumentation (e.g., an application monitor module  220 ) that allows a wider range of behavior to be observed than on a conventional mobile device. Compared to the conventional mobile device illustrated in  FIG. 2A , the client device additionally includes an application monitor module  220 . Compared to the operating system layer  206  of the conventional mobile device illustrated in  FIG. 2A , the operating system layer  226  includes the application monitor module  220  that augments the application framework layer  210  and the kernel layer  208  such that execution of an application program can be monitored and recorded on the client device  200 . Behavior of a given application program at the hardware layer  202 , at the kernel layer  208 , at the application framework layer  210 , and at the applications layer  212  can be monitored and recorded. The operating system  226  provides an environment in which an application program operates as if the application program is operating on a conventional mobile device as illustrated in  FIG. 2A  that does not include the application monitor module  220 . That is, the modification on the client device is preferably agnostic to the application program and does not affect the behavior of the application program. In various embodiments, source code of the application monitor module  220  is included in the source code of the operating system  226 . In some embodiments, ROMs of the client device  200  are configured to include the instrumented operating system. 
     The application monitor module  220  includes a behavioral data store  222  and an interface module  224 . The behavioral data store  222  stores information related to execution of an application program at one or more layers. In some embodiments, the application program logs execution information in the behavioral data store  222  during its execution on the client device  200 . Example execution information of an application program includes process information, memory information, job status, package name, metadata of the application program, timestamps, behavior such as tokenized behavior description, detailed information of behavior, and the like. In one embodiment, information related to execution of application programs is stored in a SQL database. In some embodiments, the application monitor module  220  accesses the memory, hardware APIs, and/or system logs of the operating system to obtain various information related to execution of the application program and stores the obtained information in the behavioral data store  222 . The stored information may be processed to generate behavior tokens represent behaviors of the application program at one or more layers of the hardware layer  202 , kernel layer  208 , application framework layer  210 , and application layer  212 . 
     The interface module  224  interacts with the hardware layer  202 , the kernel layer  208  the application framework layer  210 , and/or the application layer  212  to provide or to obtain information related to execution of application programs. The interface module  224  may access various layers via their respective APIs, memory of the client device  200 , and/or system logs of the operating system  226 , and the like. The interface module  224  also accesses information related to execution of an application program stored in the behavioral data store  222 . For example, the interface module  224  accesses logs, data objects, processes, system calls, parameters, SQL databases for records such as process IDs, parent process IDs, function calls, or parameters, memories, and the like. The interface module  224  may further interact with the analysis application  170  and provide different information to the analysis application  170 . In some embodiments, the analysis application  170  interfaces with the interface module  224  for execution of an application program that is stored in the behavioral data store  222 . In some embodiments, the interface module  224  accesses the behavioral data store  222  for information related to execution of an application program, generates one or more behavior tokens that represent the application program&#39;s behavior at one or more corresponding layers of the application layer  212 , application framework layer  210 , kernel layer  208 , and the hardware layer  202 , and provides the generated behavior token to the analysis application  170  for analysis. In one embodiment, the interface module  224  is an API included in a software development kit (SDK) that is included in the operating system  226 . When the client device is installed with the analysis application  170 , the analysis application  170  can interact with the API as included in the SDK. The interface module  224  may include sub-interfaces that interact with the application layer  212 , application framework layer  210 , kernel layer  208 , and hardware layer  202 , respectively. 
       FIGS. 3A-B  are high-level block diagrams illustrating detecting security vulnerability as implemented on a client device  200 , according to different embodiments. The illustrated client devices  200  can analyze an application program&#39;s behavior on the application framework layer thereby to classify an application program. The client device  200  receives an application program package and installs the application program. 
     That application program package may have been previously analyzed by the analysis system  140  that stores and maintains prior analysis results of application program packages. Each application program package is identified by an application program package ID and associated with a category (e.g., malicious or benign) classified by the analysis system  140 . An application program package may be further associated with metadata (e.g., version, release time, etc.). If the application program package ID of the received application program package cannot be located in the list, then it is a new application program package and is further analyzed. In some embodiments, the analysis system  140  distributes the analysis results which are a list of application program package IDs and categories associated with the IDs to client devices  200 . The client device  200  queries the application program package ID of the received application program package in the list. If the application program package ID of the received application program package is not included in the list but the client device  200  is online (i.e., communicating with the analysis system  140 ), the client device  200  provides the application program package to the analysis system  140  for vulnerability analysis. 
     When the client device  200  is offline (i.e., not communicating with the analysis system  140 ), the client device  200  categorizes the application programs on-device. The application program executes on the client device  200 , and the client device  200  classifies an application program into benign or malicious based on behavioral analysis. The client device  200  analyzes behavior of the application program demonstrated during its execution on the client device  200 . Application programs that perform known classes of malicious behavior can be detected and classified as malware. In addition, application programs that perform new types of malicious behavior can also be classified as malware. For example, the new malicious behavior may be similar enough to known malicious behavior that the application program can be classified as malware. 
     As illustrated in  FIG. 3A , the client device  200  includes an application monitor module  220  and an application  170 . The application monitor module  220  collects the behavior of the application program at the application framework level and generates a behavior token representing the collected behavior. The application monitor module  220  includes an action collection module  330 , a token generation module  332 , and an interception module  352 . The action collection module  330  collects actions (e.g., function calls) and associated information. Various actions that the application program uses to communicate with the application framework layer  210  are obtained. When an application program executes a command, the application program logs this action in the behavioral data store  224 . A particular action is identified by a unique action ID. Parameters and/or payloads that are associated with actions can also be recorded. The action collection module  330  can obtain actions and associated information from the behavioral data store  222  that stores raw behavior data of the application program during its execution. 
     The token generation module generates behavior tokens. The token generation module  332  processes the collected actions and associated information to generate behavior tokens that can be used by the machine learning model  334  to classify an application program. The behavior tokens include behaviors performed by the application program that may be expected or unexpected. Behaviors that are unexpected may be considered as anomalous behaviors. For example, calling a cipher function followed by calling a transmitting function may be considered anomalous. The token generation module  332  includes the interface module  224  that accesses and processes the actions stored in the behavioral data store  224 . A behavior token represents behavior of an application program and includes one or more behavior features that are individual measurable properties of the behavior. A behavior feature includes a sequence of system events performed by an application program. Example behavior features at the application framework layer  210  include actions identified by the unique action IDs, parameters associated with the actions, and payloads associated with the actions. The interface module  224  provides the generated behavior token to the machine learning model  334 , which in this example is implemented as part of the analysis application  170 . 
     In this example, the analysis application  170  includes a machine learning model  334  and a user interface module  350 . The machine learning model  334  is implemented as part of the analysis application  170 . The machine learning model  334  receives the behavior token and classifies the application software into a category (e.g., malicious or benign) based on the behavior features included in the behavior token. The machine learning model  334  analyzes behavior features included in the behavior token (e.g., normalized behavior) to distinguish benign and malicious action, for example, by identifying which behavioral features or combinations thereof are associated with malicious actions. Details of examples of the machine learning model  334  and its creation and training are further described with respect to  FIGS. 4-6 . 
     When an application program is identified to be malicious, the user interface module  350  generates and presents a user interface to a user. The user may be prompted with a warning message that a particular application program is malicious and should be uninstalled. In addition, when an application program is identified to be malicious, the interception module  352  intercepts the malicious behavior thereby to protect the client device  200  from the attack. For example, the interception module  352  prevents an application program that is identified to be malicious from performing an action. As further explained below, a malicious application program can be identified based on its behavior on different layers. Implementing the interception module  352  on the operating system layer  226  can protect the device  200  from the malicious application&#39;s attack as actions (e.g., functions) are performed on the operating system layer  226 . 
       FIG. 3B  illustrates a different implementation. As illustrated in the example of  FIG. 3B , the client device  200  includes an application monitor module  220  and an analysis application  170 . The application monitor module  220  includes an interface module  224 , a behavioral data store  222 , and an interception module  352 . An action collection module  330 , a token generation module  332 , a machine learning model  334 , and a user interface module  350  are implemented in the analysis application  170 . Compared to the client device  200  illustrated in  FIG. 3A  where the action collection module  330  and the token generation module  332  reside in the application monitor module  220 , the action collection module  330  and the token generation module in  FIG. 3B  reside in the analysis application  170 . In this embodiment, the action collection module  330  interacts with the interface module  224  to obtain various actions (e.g., function calls) during execution of an application program. The token generation module  332  processes the collected actions to generate behavior tokens that can be used by the machine learning model  334  to classify an application program. 
     The operating systems of the examples illustrated in  FIGS. 3A-B  have different instrumentations (i.e., application monitor modules  220 ). In addition, the analysis application  170  of the examples illustrated in  FIGS. 3A-B  can also be different. In the example illustrated in  FIG. 3A , an application program&#39;s behavior at the application framework layer is obtained and processed in the operating system layer  226 . The operating system layer  226  includes instrumentation for collecting an application program&#39;s behavior and for generating behavior tokens for use by the machine learning model implemented in the application  170  installed on the device  200 . In the example illustrated in  FIG. 3B , an application program&#39;s behavior at the application framework layer is obtained and processed in the application layer  212 . The operating system layer  226  includes instrumentation for collecting an application program&#39;s behavior, but it does not generate behavior tokens. The operating system layer  226  instead interacts with the analysis application  170  installed on the device  200 . The analysis application  170  obtains and processes an application program&#39;s behavior, generates behavior tokens, and categorizes the application program. The examples illustrated in  FIGS. 3A-B  detect security vulnerabilities based on application programs&#39; behaviors at the application framework level. The client device  200  can detect security vulnerabilities based on application programs&#39; behaviors on one or more other layers such as the application layers  212 , kernel layer  208 , and hardware layer  202 , as further discussed with respect to  FIG. 4 . 
       FIG. 4  is a high-level block diagram illustrating a client device  200  for detecting security vulnerabilities, according to one embodiment. The example client device  200  detects security vulnerabilities based on an application program&#39;s behavior on the application, application frame work, kernel, and hardware (including firmware) layers. As such, the client device can detect malicious application programs substantially comprehensively because some anomalous behaviors can be detected typically at some but not at all levels. For example, stealing information typically can be detected at the application framework layer  210  and/or at the hardware layer  202  but not at the kernel layer  208  or at the application layer  212 . The example client device  200  includes a hardware layer classification module  402 , a kernel layer classification module  404 , a framework layer classification module  406 , and an application layer classification module  408  that each classify the application program based on the application program&#39;s behavior at the hardware, kernel, application framework, and application layer, respectively. Behaviors are operations or actions that are performed by the application program as it executes on a client device. Example behaviors include usage of specific objects such as semaphores and mutexes, Application Program Interface calls, memory usages, modification of particular system files, and the like. For example, stack trace dump at the application layer, call particular functions at the application framework layer, open file or write file at the kernel layer, or send SMSs at the hardware layer are examples of behaviors at different layers. The hardware layer classification module  402 , kernel layer classification module  404 , framework layer classification module  406 , and application layer classification module  408  each use one or more artificial intelligence models, classifiers, or other machine learning models to classify an application using the observed behavior of the application. These models may have been trained and provided by the analysis system  140  as further described with reference to  FIGS. 5-6 . 
     The hardware layer classification module  402 , kernel layer classification module  404 , framework layer classification module  406 , and application layer classification module  408  each observe and monitor behavior of the application program at different layers and categorize the application program based on the observed behavior during the application program&#39;s execution on the client device  200 . That is, each of these layers collects different information related to the behavior of the application program at the corresponding layer and determines whether the observed behavior is benign or malicious. Each layer includes a data collection module (e.g., a signal collection module  410 , a system call collection module  420 , an action collection module  330 , or a log collection module  440 ) that accesses and collects data related to executing behavior such as API calls, system logs, data objects access logs, etc. For example, when an application program that transmits private information without the user&#39;s authorization executes on the client device  200 , the signal collection module  410  collects signals including a stream of information transmitted at the hardware layer, the system call collection module  420  collects network socket operations at the kernel layer, the action collection module  330  collects the transmitting function call at the application framework layer, the log collection module  440  collects the logs of the application program showing that the private data is transmitted at the application layer. 
     The signal collection module  410  collects hardware and sensor data such as API calls, wireless signals, inputs and outputs of a chip such as logical values or memory states, side channel signals, etc. The signal collection module  410  may interact with the hardware API (e.g., a chip API made available in the chip SDK) to obtain hardware and sensor signals. The signal collection module  410  identifies the package of the running signal by process information and registers the received signals into memory of the client device  200 . The received signals are stored in the behavioral data store  222 . In various embodiments, the signal collection module  410  resides in the application monitor module  220 . 
     The system call monitor and collection module  420  obtains a series of system calls (e.g., Android Kernel system calls) that the application program uses to communicate with the kernel layer  208 . The system call monitor and collection module  420  may access the memory of the client device  200  to obtain system logs and thereby to collect system calls. Example system calls include special functions or command such as process control, information (e.g., system time, attributes of files and devices) maintenance, communication (e.g., networking, data transfer, attachment/detachment of remote devices), file management, memory management, and device management. A particular system call is identified by a unique system call ID. The system call collection module  420  may be implemented similar to the action collection module  330  as illustrated in  FIG. 3A or 3B . The system call collection module  420  may reside in the application monitor module  220  or in the analysis application  170 . 
     The log collection module  440  obtains various application or system logs and messages. The log monitor and collection module  440  may collect log metadata, package names, permissions, activities and services, processes actions (e.g., start, kill), intent and content, debug information levels, URL/file targets, exceptions, and the like. Some of the information may be obtained by processing the application or system logs and messages collected by the log monitor and collection module  440 . The collected information is stored in the behavioral data store  222 . In various embodiments, the log collection module  440  resides in the analysis application  170 . 
     Each of the hardware layer classification module  402 , kernel layer classification module  404 , application framework layer classification module  406 , and application layer classification module  408  additionally includes a token generation module (e.g., a token generation module  412 ,  422 ,  332 , or  442 ) that processes the collected data or information to generate behavior tokens that can be used by the corresponding machine learning model to classify an application program. The behavior tokens include behaviors performed by the application programs that are expected or unexpected. Unexpected behaviors may be considered as anomalous behaviors. Examples of anomalous behaviors may include unusual network transmissions, accessing memories or APIs to obtain data, impressible access of APIs, unusual changes in performance, circumventing denied location accesses, and the like. The behavior token includes behavior features that are individual measurable properties of behavior of an application. A behavior feature includes at least one behavioral trace that is a sequence of system events performed by an application program. The behavior feature may include the data related to the system events. For example, the behavior feature of uninstalling and installing an application includes events of application scanning, uninstalling, downloading, unzipping, decrypting, and installing, each of which is associated with detailed information such as a source, a file system location, a decryption algorithm, and the like. 
     In this example, behavior of an application program at each layer is represented by a corresponding behavior token at the layer. A behavior token represents a sequence of behaviors and the associated data and objects. A behavior token may include a data object and a unique behavior ID. A behavior token at the hardware layer includes a number of signal names and parameters associated with the signals. A behavior token at the kernel layer includes system calls and associated parameters and timestamps. The behavior token at the kernel layer may be a large amount of objects. A behavior token at the application framework layer includes actions, parameters associated with the actions, and time stamps associated with the actions. A behavior token at the application layer includes logs with time stamps. As one example, the behavior token may include a sequence for tracing users&#39; private data. If one type of private data is affected, then the sequence is updated accordingly (e.g., a corresponding bit is set to 1). The unique behavior ID identifies a particular behavior. In addition, the attached data comprises information related to objects and/or data (e.g., URL, link, etc.) associated with the particular behavior. The behavior token may be translated into texts describing the application&#39;s behavior. A behavior token may further include metadata and parameters associated with actions such as strings, input arguments, local variables, return addresses, system calls, in addition to a binary enumerator denoting a combination of actions. The token generation module  412  or  442  may reside in the analysis application  170  or application monitor module  220 . The token generation module  422  may be implemented similar to the action generation module  332  as illustrated in  FIG. 3A or 3B . The token generation module  422  may reside in the application monitor module  220  or in the analysis application  170 . 
     Each of the hardware layer classification module  402 , kernel layer classification module  404 , application framework layer classification module  406 , and application layer classification module  408  further includes a machine learning model (e.g., a machine learning model  414 ,  424 ,  334 , or  444 ) that classifies the application program into a category (e.g., malicious or benign) based on the behavior tokens. The machine learning models may include, but are not limited to, regression, support vector machine (SVM), decision trees, and neural network classifiers. In one embodiment, the machine learning model  414  is a rule based or expert system based library. In one embodiment, the machine learning model  424  is a linear model. In one embodiment, the machine learning model  444  is a linear model such as a linear SVM or linear regression model. 
     The machine learning models are trained and provided by the analysis system  140 . The machine learning models  414 ,  424 ,  334 , and  444  each analyze behavior features to identify which behavioral features or combinations thereof can be used to distinguish benign and malicious behaviors. Because different types of information related to the behavior of an application program at the hardware, kernel, application framework, and application layers is collected, the generated behavior tokens that represent an application program&#39;s behavior at the hardware, kernel, application framework, and application layers include different features. As a result, the machine learning models  414 ,  424 ,  334 , and  444  that use behavior tokens including different behavior features that includes different parameters to analyze an application program are different. In addition, the amount of information included in the behavior tokens varies. For example, a behavior token that represents an application program&#39;s behavior at the kernel layer and is generated by the token generation module  422  includes more information than a behavior token that represents the application program&#39;s behavior at the application (application framework or hardware) layer and is generated by the token generation module  442  ( 332  or  412 ). As a result, the speed and/or coverage of machine learning models  414 ,  424 ,  334 , and  444  in classifying application programs are different. In some embodiments, the machine learning models  414 ,  444 ,  424  and  334  are in a descending order of speed in classifying application programs. In some embodiments, the machine learning model  334 ,  414 ,  424 , and  444  are in a descending order of coverage in classifying application programs. 
     The analysis system  140  creates machine learning models (e.g., determines the model parameters) by using training data and deploys the trained machine learning models to client devices. The training data includes behavior tokens and the corresponding categories for previously analyzed applications. This can be arranged as a table, where each row includes the behavior token and category for a different application. Using this training data, the analysis system  140  determines the model parameters for a machine learning model that can be used to predict the category of an application. When a client device  200  is online and communicates with the analysis system  140 , one or more machine learning models (e.g., model parameters) of the machine learning models  414 ,  424 ,  334 , and  444  may be updated using the input from the analysis system  140 . 
     The determination of the machine learning models  414 ,  424 ,  334 , and  444  may be a sliding scale, such as a confidence level that the behavior is either regular or malicious, rather than a binary decision of either benign or malicious. The categorizations from the different classification systems are combined to produce an overall category for the application. For example, in one approach, if a layer classifies the application as malware, then the overall classification is malware. As another example, rules that are based on domain knowledge of mobile security researches are used to resolve conflicting detection results by different layers. Conflicting detection results may be provided to an expert for further analysis where ground truth of the sample can be determined and corrections are made based on the determined ground truth. Details of the user interface module  350  and the interception module  352  are provided with respect to  FIGS. 3A-3B . 
       FIG. 5  is a high-level block diagram illustrating an analysis system  140  for detecting security vulnerabilities, according to one embodiment. The analysis system  140  stores and maintains prior analysis results of the APKs in the app category data store  514 . Each application is identified by the APK ID and associated with a category (e.g., malicious or benign) classified by the analysis system  140 . An application may be further associated with metadata (e.g., version, release time, etc.) If the APK ID of the received software package cannot be located in the list, then it is a new APK to be analyzed. The software application package is classified by one or more classification systems  550 ,  560 ,  570  included in the analysis system  140 . Each classification system classifies the software application package into a category (e.g., benign or malicious). In this example, the classification systems include static classification systems  550  and dynamic classification systems  560 . One of ordinary skill in the art would appreciate that the analysis system  140  can include classification systems  570  that use other techniques to classify an application. The categorizations from the different classification systems are combined to produce an overall category for the application. 
     The static classification system  550  classifies a software application package as benign or malicious by using a static analysis of the software application package. The static classification system  550  includes one or more static analysis engines  552  that analyze the object code of the software application package. A static analysis engine  552  analyzes the functionality and structure of the APK based on the static object code. For example, the binary code is decompiled. The entire decompiled binary code or a portion thereof is compared to codes that are identified to be malicious or benign to determine if the binary code is malicious or benign. One or more trained machine learning models may be used to compare the binary codes to known malicious or benign binary codes. A static analysis engine  552  may check for developer certificate signatures, malicious keywords in strings of binary codes, URLs, malicious domain names, known functions calls used in malware, sections of mobile application machine codes or other features of known malicious codes. A static analysis engine  552  may parse the binary code to identify different software components, and then analyze the software components and their functionality and structure for maliciousness or vulnerability. 
     The dynamic classification system  560  classifies a software application package as benign or malicious based on behavioral analysis. That is, the dynamic classification system  560  analyzes behavior of the application on a client device to classify a software application package. The dynamic classification system  560  includes a behavior observation module  562  and a behavior analysis module  564 , which is implemented using machine learning. The dynamic classification system  560  categorizes an application based on the behavior of the application when it is executed. The behavior observation module  562  observes the behavior of the executing application, and the behavior analysis module  564  determines whether this behavior is benign or malicious. The determination may be a sliding scale, such as a confidence level that the behavior is either benign or malicious, rather than a binary decision of either benign or malicious. 
     The behavior observation module  562  provides a sandbox environment in which an application program is executed and monitored. The behavior observation module  562  observes the behavior and generates a representation of the behavior. In this example, the behavior is represented by a behavior token. The behavior observation module  562  exercises the application to determine whether the application exhibits the behaviors in the behavior token. 
     The behavior analysis module  564  classifies the application based on the behavior token. The behavior analysis module  564  uses one or more artificial intelligence models, classifiers, or other machine learning models to classify an application using the behavior token of the application. These models are stored in the model data store  516 . 
     An artificial intelligence model, classifier, or machine learning model is created, for example, by the behavior analysis module  564  to determine correlations between behavior features and categories of applications. In one embodiment, the machine learning models describes correlations between categories of applications and behavior features. Using the behavior token generated for an application, the behavior analysis module  564  identifies the category that is more correlated to the behavior features presented by the software application package. 
     The machine learning models created and used by the behavior analysis module  564  may include, but are not limited to, regression, support vector machine (SVM), decision trees, and neural network classifiers. The machine learning models created by the behavior analysis module  564  includes model parameters that determine mappings from behavior features of an application to a category of the application (e.g., malicious or benign). For example, model parameters of a logistic classifier include the coefficients of the logistic function that correspond to different behavior features. As another example, the machine learning models created by the behavior analysis module  564  include a SVM model, which is a hyperplane or set of hyperplanes that is maximally far away from any data point of different categories. Kernels are selected such that initial test results can be obtained within a predetermined time frame and tuned to improve detection rates. Initial sets of parameters can be selected based on most comprehensive description of known malware. 
     The machine learning models used by the behavior analysis module  564  analyze behavior features to identify which behavioral features or combinations thereof can be used to distinguish benign and malicious behavior. The behavior analysis module  564  creates machine learning models (e.g., determines the model parameters) by using training data. The training data includes behavior tokens and the corresponding categories for previously analyzed applications. This can be arranged as a table, where each row includes the behavior token and category for a different application. Based on this training data, the behavior analysis module  564  determines the model parameters for a machine learning model that can be used to predict the category of an application. 
     After classifying a new software application package, the behavior analysis module  564  includes the behavior token and determined category in the training data. The behavior analysis module  564  may also update machine learning models (e.g., model parameters) using input received from a system administrator or other sources. The system administrator can classify a software application package or overwrite a category of a software application package classified by the analysis system, for example if more reliable information is received from another source. The system administrator may further provide one or more behavior features that are associated with the category of the software application package. The behavior analysis module  264  includes this information in the training data to create new machine learning models or update existing machine learning models. 
       FIG. 6  is a high-level block diagram illustrating a behavior observation module  562  for generating behavior tokens of software application packages, according to one embodiment. The behavior observation module  562  includes instrumented simulation engines for the client devices, which allow the instrumented simulation of client devices. In this example, there are one or more virtual machine (“VM”) engines  602  for computer-like devices, such as laptops and tablets, and one or more mobile engines  608  for lighter weight mobile devices, such as smart phones. A VM engine  602  is a computing system that simulates a client device. For example, the VM engine  602  simulates the architecture and functions of a client device, but it includes additional code (instrumentation) so that the desired behaviors can be observed. The VM engine  602  thereby provides the sandbox or safe run environment in which a software application package operates as if the software application package is operating in the client device that the VM engine  602  emulates. In some embodiments, ROMs of computing systems are configured to include operating systems and user or data images. As such, VM engines  602  can capture and monitor all behavior of an application. A particular software application package may behave differently in different client devices because the different client devices have different hardware architectures and are installed with different operating systems or various versions of an operating system. Accordingly, the behavior observation module  562  includes multiple VM engines  602  to emulate different client devices such that behavior of a software application package on the different client devices can be captured. 
     In this example, the VM engine  602  includes a control flow module  604  and a data flow module  606 . These are two types of dynamic analysis. The control flow module  604  generates a control flow graph of a software application package that includes paths traversed by the corresponding application during its execution. This control flow graph can be analyzed to determine whether certain behaviors have occurred. In a control flow graph, each node represents a basic block. A basic block is a straight-line piece of or a small section of code from the source code building the operating system binary image. The basic block may reveal the actions an application calls in its activity or service and can be used to trace the control flow inside a complied application binary package. The control flow graph therefore can be analyzed to reveal dependencies among basic blocks. As such, a software application package in which malicious code is hidden and cannot be detected by the static analysis engine  506  can be detected because the malicious behavior can be detected by analyzing the control flow graph. For example, any application that uses packer services to encrypt their code can be detected. As one example, an event of sending SMSs to all contacts stored in a device that is automatically triggered by an event of accessing all contacts stored in the device can be uncovered by analyzing a control flow graph of a software application package. As another example, uninstalling and installing an application without a user&#39;s permission in the background can be uncovered by analyzing a control flow graph of a software application package. 
     The data flow module  606  generates flows of data, such as sensitive data, from a data source from which the application obtains the data to a data sink to which the application writes the data. The data source and the data sink are external to the application and the data flows may include intermediate components that are internal to the application. For example, the data source is a memory of a device and the data sink is a network API. Examples of other data sources include input devices such as microphones, cameras, fingerprint sensors, chips, and the like. Examples of other data sinks include speakers, Bluetooth transceivers, vibration actuators, and the like. Different types of information flows between sources and sinks. 
     The data flow module  606  generates data flows that include behavior features at sufficiently precisions for various types of data sources and data sinks. For example, the generated data flow for a file data source includes information such as file name and user name, and the generated data flow for a network data sink includes information such as IP addresses, SSL certificates, and URLs. Any data of interest can be tagged and the data flow can be tracked across the operating system. As one example, telephone numbers and SMSs can be tagged as sensitive data to detect applications that subscribe paid services on users&#39; expenses. SMSs can be intercepted after paid services are subscribed and the paid service is detected from the service number. The data flows can be analyzed for data that are tracked in the behavior token. Data flows as a result of execution of an application can be used to detect several types of behavior that leaks privacy. For example, an application accessing sensitive information that should not be accessed by the application can be detected. As another example, an application that sends sensitive information to a data sink that is not authorized to receive it can be detected. As a further example, an application that receives data from an untrusted website and writes it to a file meant to hold trustworthy information can be detected. 
     While the control flow module  604  and the data flow module  606  are described independently above, the control flow module  604  and the data flow module  606  can collaborate to generate the behavior token. For example, the data flow module  606  may generate data flows while the control flow graph is being generated by the control flow module  604  such that the control flow graph includes the data flows. The data flow module  606  can detect a basic block that behaves suspiciously, and the control flow module  604  can confirm that this basic block is regularly exercised. 
     A mobile engine  608  is a computing system that executes applications on mobile devices. In one embodiment, the mobile engine  608  is run on a mobile phone. The mobile engine  608  includes a control flow module  610  and a data flow module  612 . Similar to the control flow module  604 , the control flow module  610  generates control flow graphs of a software application package. Similar to the data flow module  606 , the data flow module  612  generates data flows of a software application package. 
     The VM engines  602  and mobile engines  608  facilitate high throughput, flexible, unpolluted user scenario execution by automatically provisioning different ROMs, and initializing applications and data to a defined initial state with preset data and cache of ordinary users. The VM engines  602  and mobile engines  608  ensure that the control flow modules  604  and  610  as well as data flow modules  606  and  612  observe the execution paths of interest by supplying appropriate user input, and collect the output from the control flow modules  604  and  610  and also data flow modules  606  and  612  across managed physical mobile devices. 
     Compared to mobile engines  608 , VM engines  602  can be more cost-efficient than mobile devices because the server hosting VM engines can be used to emulate different client devices, reducing the capital expenditure needed to emulate a given variety of client devices. In addition, VM engines  602  can be more easily configured and managed. A control flow module or data flow module can be more easily implemented on a VM engine  602  because the emulation can be developed by targeting a specific phone type of which an emulator can be easily accessed, whereas a specific mobile device is limited to the production lifetime and existence of hardware. 
       FIG. 7  is a high-level block diagram illustrating an example computer  700  for implementing the entities shown in  FIG. 1 . The computer  700  includes at least one processor  702  coupled to a chipset  704 . The chipset  704  includes a memory controller hub  720  and an input/output (I/O) controller hub  722 . A memory  706  and a graphics adapter  712  are coupled to the memory controller hub  720 , and a display  718  is coupled to the graphics adapter  712 . A storage device  708 , an input device  714 , and network adapter  716  are coupled to the I/O controller hub  722 . Other embodiments of the computer  700  have different architectures. 
     The storage device  708  is a non-transitory computer-readable storage medium such as a hard drive, compact disk read-only memory (CD-ROM), DVD, or a solid-state memory device. The memory  706  holds instructions and data used by the processor  702 . The input interface  714  is a touch-screen interface, a mouse, track ball, or other type of pointing device, a keyboard, or some combination thereof, and is used to input data into the computer  700 . In some embodiments, the computer  700  may be configured to receive input (e.g., commands) from the input interface  714  via gestures from the user. The graphics adapter  712  displays images and other information on the display  718 . The network adapter  716  couples the computer  700  to one or more computer networks. 
     The computer  700  is adapted to execute computer program modules for providing functionality described herein. As used herein, the term “module” refers to computer program logic used to provide the specified functionality. Thus, a module can be implemented in hardware, firmware, and/or software. In one embodiment, program modules are stored on the storage device  708 , loaded into the memory  706 , and executed by the processor  702 . 
     The types of computers  700  used by the entities of  FIG. 1  can vary depending upon the embodiment and the processing power required by the entity. For example, the media service server  130  can run in a single computer  700  or multiple computers  700  communicating with each other through a network such as in a server farm. The computers  700  can lack some of the components described above, such as graphics adapters  712 , and displays  718 . 
     Some portions of the above description describe the embodiments in terms of algorithmic processes or operations. These algorithmic descriptions and representations are commonly used by those skilled in the data processing arts to convey the substance of their work effectively to others skilled in the art. These operations, while described functionally, computationally, or logically, are understood to be implemented by computer programs comprising instructions for execution by a processor or equivalent electrical circuits, microcode, or the like. Furthermore, it has also proven convenient at times, to refer to these arrangements of functional operations as modules, without loss of generality. The described operations and their associated modules may be embodied in software, firmware, hardware, or any combinations thereof. 
     As used herein any reference to “one embodiment” or “an embodiment” means that a particular element, feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearances of the phrase “in one embodiment” in various places in the specification are not necessarily all referring to the same embodiment. 
     As used herein, the terms “comprises,” “comprising,” “includes,” “including,” “has,” “having” or any other variation thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, article, or apparatus that comprises a list of elements is not necessarily limited to only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Further, unless expressly stated to the contrary, “or” refers to an inclusive or and not to an exclusive or. For example, a condition A or B is satisfied by any one of the following: A is true (or present) and B is false (or not present), A is false (or not present) and B is true (or present), and both A and B are true (or present). 
     In addition, use of the “a” or “an” are employed to describe elements and components of the embodiments herein. This is done merely for convenience and to give a general sense of the disclosure. This description should be read to include one or at least one and the singular also includes the plural unless it is obvious that it is meant otherwise. 
     The above description is included to illustrate the operation of certain embodiments and is not meant to limit the scope of the invention. The scope of the invention is to be limited only by the following claims. From the above discussion, many variations will be apparent to one skilled in the relevant art that would yet be encompassed by the spirit and scope of the invention.