Method and system for detecting privacy leakage between Android components based on high-order function
By constructing inter-component communication links and high-order functional component summaries through a method based on high-order functions, the private data leakage flow is directly detected at the component call point, which solves the problem of low efficiency of privacy leakage detection between components in the existing technology and achieves More efficient private data detection.
Patent Information
- Application Number
- CN202410595647.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-23
AI Technical Summary
Existing methods for detecting privacy leaks between components in Android devices have the problem of constructing complex activity transfer graphs and component call graphs, which leads to inefficiency and may even lead to analysis crashes.
Using a method based on high-order functions, it receives Android application files, builds communication links between components, generates high-order functional component summaries, and uses functions as parameter characteristics at component call points to obtain private data leakage flows, thereby achieving privacy Data breach detection.
It avoids building additional activity transfer graphs and component call graphs, improves privacy leak detection efficiency, and reduces detection time overhead.
Smart Images

Figure CN118536155A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mobile application security technology, and in particular to a method and system for detecting privacy leakage between Android components based on high-order functions. Background Art
[0002] Although Android phone vendors provide specific security mechanisms such as permission control and component encapsulation to ensure the security of the phone system, privacy leakage is still a common problem. Android privacy leakage detection revolves around components. According to the different modules that may be propagated through, it can be divided into privacy leakage propagation within components and privacy leakage propagation between components. Due to the complex operation life cycle of Android applications and a large number of callback functions, the main problem of privacy leakage propagation within components is to build a complete program analysis model. Even if the analysis model within the component is fully constructed and the privacy leakage flow within the component is correctly analyzed, private data may still be propagated through inter-component communication, resulting in the leakage of private data.
[0003] In addition to the need for traditional control flow graphs and function call graphs, classic static inter-component communication analysis tools such as A3E, Gator, and StoryDistiller perform inter-component communication analysis by constructing an activity transition graph (ATG). Based on these tools, ICCBot proposes a component transition graph (CTG) for more accurate inter-component communication analysis. This method based on the transition graph requires every statement of the application and additional layout code. Most of the graphs constructed in this way are unnecessary. At the same time, the increase in the complexity of the application leads to huge time and space overhead in the construction of the transition graph, and even the problem of analysis crashes. For this reason, the present invention proposes an Android component privacy leakage detection method and system based on high-order functions. Summary of the invention
[0004] According to the first aspect of the present invention, the purpose of the present invention is to provide a privacy leakage detection method and system between Android components based on high-order functions. Compared with traditional methods, it can avoid constructing additional activity transfer graphs and component call graphs to perform privacy leakage detection, thereby improving the efficiency of privacy leakage detection.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for detecting privacy leakage between Android components based on a high-order function, comprising the following steps:
[0006] Receive an Android application file and pre-process the application to obtain a control flow graph and a call graph;
[0007] Build inter-component communication links;
[0008] Build a summary of each method, path, and object instance in the component to describe the component behavior. Use the function as the return value in the higher-order function to collect information about the Intent source and target components and generate a higher-order functional component summary.
[0009] According to the communication links between components, the parameter information corresponds to the formal and actual parameter relationship, and the characteristic that functions in high-order functions can be used as parameters is utilized at the component calling point. The generated high-order functional component summary is substituted into the component calling point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result.
[0010] Furthermore, the application is preprocessed to obtain the control flow graph and call graph. The specific steps are as follows:
[0011] (1) Receive the Android application APK file, parse the specific file, convert the application source code into Jimple's intermediate representation, and search for the life cycle method LM = {lm1, lm2, ..., lm n} and callback function CM = {cm1, cm2, ..., cm n};
[0012] (2) Construct a virtual main method based on LM and CM, and use the virtual main method to generate a control flow graph cfg and a call graph cg.
[0013] Furthermore, the communication links between components are constructed. The specific steps are as follows:
[0014] (1) Initialize inter-component communication links Add all class objects in the program to the collection class;
[0015] (2) In the class, traverse the LM and CM obtained in step (1). For each lm∈LM, cm∈CM, add the component name and program point information to the caller component object caller_cpt. Then determine whether there is inter-component communication. If so, add the target component name and program point information to the callee component object callee_cpt. Finally, add (caller_cpt, callee_cpt) to CCL and continue to determine the next method. If not, end the current determination in advance and continue to determine the next method.
[0016] (3) When the LM and CM in all classes are judged, the traversal is terminated and the construction of the inter-component communication link CCL is completed.
[0017] Furthermore, we construct a high-order functional component summary. The specific steps are as follows:
[0018] (1) Obtain all components cpt from the obtained CCL. For each component c in cpt, obtain all methods M in c. For each method m in M, construct a high-order functional component summary of component c in order according to steps (2) to (6).
[0019] (2) If m contains an Intent statement, the creation, update, and sending of the Intent statement object are summarized, and the object summary is represented as OS=<obj,mtd,stmt,ctx> , where obj is the instance of the Intent object that needs to be modeled, mtd is the signature of the method where obj is located, stmt is the statement related to obj, and ctx is the context information;
[0020] (3) Construct the summary of method m: The method summary contains a set of object summaries and a set of called method summaries. For the called methods whose object summaries are related to the calling context, the object summaries are obtained through step (2) according to the method summary of the callee and its relationship, and the new object summary is constructed into S. os For other called methods whose object digests are not related to the context of method m, their method digests will be directly added to S ms To avoid reanalysis, the method summary is presented as MS= <mtd,S os , S ms >, where mtd is the method signature, S os is a collection of object summaries, S ms is a collection of called method summaries;
[0021] (4) Repeat steps (2) to (3) until all methods of M are analyzed. At this time, the summary CS of component c is obtained. c =OS m1 ∪MS m2 ∪...∪OS mn ∪MS mn ;
[0022] (5) Repeat steps (2) to (4) until each component in the CPT is analyzed and the process stops. At this point, a summary of each component in the CPT is obtained.
[0023] (6) Construct the component summary obtained in step (5) into a high-order functional component summary, where C src is the summary of the calling component, C des is a summary of the called component. The high-order functional component summary is expressed as:
[0024] λC src C des .F(C src , C des ).
[0025] Furthermore, the generated high-order functional component summary is substituted into the component call point to obtain the privacy data leakage flow. The specific steps are as follows:
[0026] (1) Initialize the privacy leakage flow Select the sub-communication link of the acquired CCL;
[0027] (2) Obtain the formal parameter callee_paras and the actual parameter callee_paras at the call point in the sub-communication link, obtain the summary of the caller component caller_cpt and the called component callee_cpt, and instantiate the high-order functional summary of the caller component caller_cpt;
[0028] (3) Search for the corresponding formal parameter callee_para in the parameter list of the called method. If callee_para is not empty, it means that the corresponding formal parameter is found. According to the correspondence between the formal and actual parameters, further analyze whether the parameter contains sensitive data. If so, record the detected privacy leakage flow and add caller_cpt, caller_method, callee_cpt, and callee_method information to LF;
[0029] (4) Based on the called component obtained in (2), find out in the CCL whether it has called other components as a calling component. If so, repeat the analysis from steps (2) to (3) until the called component has not called other components. If not, select a new sub-communication link in the CCL and repeat the analysis from steps (1) to (4);
[0030] (5) After all sub-communication links in CCL are analyzed, the detected privacy leakage flow LF is reported.
[0031] Furthermore, the control flow graph cfg is generated by the tool Soot, and the call graph cg is generated by the tool Heros.
[0032] Furthermore, the intermediate file jimple file is generated by decompiling through the soot tool.
[0033] According to a second aspect of the present invention, the present invention provides an Android component privacy leakage detection system based on a high-order function, characterized in that it includes:
[0034] A preprocessing module, used for receiving an Android application file and preprocessing the application to obtain a control flow graph and a call graph;
[0035] A first building block, for building inter-component communication links;
[0036] The second building module is used to build a summary of each method, path, and object instance in the component to describe the component behavior. It uses the function as the return value in the high-order function to collect information about the Intent source and target components and generate a high-order functional component summary.
[0037] The output acquisition module is used to obtain the parameter information according to the communication link between components and the relationship between formal and actual parameters. At the component call point, the function in the high-order function can be used as a parameter. The generated high-order functional component summary is substituted into the component call point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result.
[0038] Furthermore, the preprocessing module also includes a receiving module for receiving Android application files.
[0039] According to a third aspect of the present invention, the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the memory stores a computer program capable of running on the processor, and when the processor loads and executes the computer program, the method for detecting privacy leakage between Android components based on high-order functions is adopted.
[0040] The present invention has at least the following beneficial effects:
[0041] The present invention is an Android component privacy leakage detection method based on high-order functions. It uses the high-order function characteristic that functions can be used as return values to save the component internal analysis process in the form of a summary, and uses the high-order function characteristic that functions can be passed as parameters at the component calling point to pass the analysis result within the component to the calling point to obtain the privacy data leakage flow. This avoids the need for traditional methods to construct additional activity transfer graphs and component call graphs to perform privacy leakage detection, thereby improving the efficiency of privacy leakage detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a schematic diagram of the process of the method of the present invention;
[0043] Figure 2 It is the program code fragment described in the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0045] Embodiment 1:
[0046] See also Figure 1-2 The present invention provides a technical solution: a method for detecting privacy leakage between Android components based on a high-order function, comprising the following steps:
[0047] Step 1: Receive the Android application file and pre-process the application to obtain the control flow graph and call graph as follows:
[0048] Step 1.1: Input the application APK file, parse the layout file, index file, manifest file and other specific files, convert the application source code into Jimple's intermediate representation, and search for the life cycle method LM = {lm1, lm2, ..., lm n} (such as onCreate(), onStart(), onResume(), onPause(), onStop(), onDestory(), etc.) and callback function CM = {cm1, cm2, ..., cm n};
[0049] In this embodiment, the lifecycle methods include the onCreate method in the component Activity1 and the onStart method in the component Activity2, and the callback function includes the onClick method in the component Activity1, so LM = {onCreate, onStart}, CM = {onClick};
[0050] Furthermore, the intermediate file jimple is generated by decompiling with the Soot tool. Jimple is an intermediate representation language, a 3-address code format, which is not stack-based and has data types. It only contains 15 types of instruction statements. It is part of the Soot compiler framework and is used to convert and process Java programs during static analysis and optimization.
[0051] Step 1.2: Construct a virtual main method based on LM and CM, and use the virtual main method to generate a control flow graph cfg and a call graph cg;
[0052] It should be noted that the control flow graph is generated by the tool Soot, and the call graph is generated by the tool Heros. Soot needs to parse the main function generated by the file as the entry point to create the control flow graph of the Android application by using the corresponding call graph construction algorithm. Therefore, this embodiment uses Soot to construct the control flow graph. After obtaining the control flow graph of the application, it is necessary to further analyze and generate the relevant program call graph. The tool Heros is developed on the basis of the tool Soot, and has good compatibility and high execution efficiency. Therefore, this embodiment uses Heros to reprocess the control flow to generate the corresponding call flow graph;
[0053] Step 2: Build the communication links between components, as follows:
[0054] Step 2.1: Initialize inter-component communication links Add all class objects in the program to the collection class;
[0055] In this embodiment, class = {Activity1, to2, v, id, i, Avtivity2, i, s, sms};
[0056] Step 2.2: In the class, traverse the LM and CM obtained in step 1.1. For each lm∈LM, cm∈CM, add the component name, program point and other information to the caller component object caller_cpt. Then determine whether there is inter-component communication. If so, add the target component name, program point and other information to the callee component object callee_cpt. Finally, add (caller_cpt, callee_cpt) to CCL and continue to determine the next method. If not, end the current determination in advance and continue to determine the next method.
[0057] In this embodiment, since component Activity1 starts component Activity2 through component Intent object, that is, there is inter-component communication between Activity1 and Activity2, (Activity1, Activity2) is added to CCL;
[0058] Step 2.3: When the LM and CM in all classes are judged, the traversal is terminated and the inter-component communication link CCL is constructed;
[0059] In this embodiment, there is only one inter-component communication link CCL, namely (Activity1, Activity2);
[0060] Step 3: Build a summary of each method, path, and object instance in the component to describe the component behavior. Use the function as the return value feature of the higher-order function to collect information about the Intent source and target components and save it as a component summary. The specific content is as follows:
[0061] Step 3.1: Get all components cpt from the CCL obtained in step 2.3. For each component c in cpt, get all methods M in c. For each method m in M, construct a high-order functional component summary of component c in order according to steps 3.2 to 3.6.
[0062] In this embodiment, cpt = {Activity1, Activity2}, component Activity1 includes onCreate() life cycle method, wherein onCreate() method includes findviewByID(), setOnClickListener() and onClick() callback methods, wherein onClick() method includes getDeviceId(), putExtra(), startActivity() methods; component Activity2 method includes onStart() life cycle method, wherein onStart() method includes getIntent(), getStringExtra(), sendTextMessage() methods, and onCreate() method is selected for analysis of steps 3.2 to 3.6.
[0063] Step 3.2: If m contains an Intent statement, create, update, and send the Intent statement object, and the object summary is represented as:
[0064] OS=<obj,mtd,stmt,ctx>
[0065] Where obj is the instance of the Intent object that needs to be modeled, mtd is the signature of the method where obj is located, stmt is the statement related to obj, and ctx is the context information;
[0066] In this embodiment, Figure 2 , in the program code lines 7 to 9, it is detected that there is an Intent statement in the callback function onClick method in the life cycle onCreate method, so the summary of object i is:
[0067] OS i =<i,{Activity1.onCreate.onClick},{L7,L8,L9},{L8,putExtra(″″,″″)}>
[0068] Step 3.3: Construct the summary of method m: The method summary contains a set of object summaries and a set of called method summaries. For the called methods whose object summaries are related to the calling context, according to the method summary of the callee and its relationship, the object summary is obtained through step 3.2, and the new object summary is constructed into S. os For other called methods whose object digests are not related to the context of method m, their method digests will be directly added to S ms To avoid reanalysis, the method summary is expressed as:
[0069] MS= <mtd,Sos , S ms >
[0070] Where mtd is the method signature, S os is a collection of object summaries, S ms is a collection of called method summaries;
[0071] In this embodiment, the life cycle method onCreate() in Activity1 includes the callback method onClick(), and it can be seen from the analysis that the 3rd to 4th lines of the program are instantiation operations for the button, such as Figure 2 As shown, the summary of OnCreate() is essentially the summary of onClick(). In the onClick() method, the first step is to obtain the device unique identifier id, then instantiate an Intent object i, add additional parameters to i, and finally start the corresponding component using i as a parameter. In fact, these operations are the object summary of object i:
[0072] Therefore, the method summary of the callback function onClick() in Activity1 is:
[0073] MS onClick =
[0074] <Activity1.onCreate.onClick,OS i , M.S. getDeviceId ∪MS putExtra ∪MS startActivity >
[0075] The method summary of the lifecycle method onCreate() is:
[0076] MS onCreate = <Activity1.onCreate,OS i , M.S. onClick >
[0077] Step 3.4: Repeat steps 3.2 to 3.3 until all methods of M are analyzed. At this time, the summary CS of component c is obtained. c =OS m1 ∪MS m2 ∪...∪OS mn ∪MS mn ;
[0078] In this embodiment, the component summary of component Activity1 is:
[0079] CS Activity1 = <OS i >∪ <MS onCreate , MSonClick >
[0080] Step 3.5: Repeat steps 3.1 to 3.3 until each component in the cpt is analyzed and stops, at which point a summary of each component in the cpt is obtained;
[0081] In this embodiment, the component summary of component Activity2 is:
[0082]
[0083] in,
[0084]
[0085] Step 3.6: Construct the component summary obtained in step 3.5 into a higher-order functional component summary, where C src is the summary of the calling component, C des is a summary of the called component, and the summary of the high-order functional component is:
[0086] λC src C des .F(C Src , C des )
[0087] Where F is a processing function used to subsequently determine and obtain the privacy data leakage flow. The meaning of F(Csrc, Cdes) is to input Csrc and Cdes as two parameters of F, and return the leakage flow after F processing, that is, "the high-order function feature of function as parameter";
[0088] In this embodiment, the high-order functional summary of component Activity1 obtained from step 3.5 is:
[0089] λC src C des .F(C Activity1 , C des )=λC des .F( <OS i >∪ <MS onCreate , M.S. onClick >, C des )
[0090] The high-order functional summary of the component Activity2 is:
[0091]
[0092] Step 4: According to the communication link between components, the parameter information is mapped according to the formal and actual parameter relationship. At the component call point, the function in the high-order function can be used as a parameter. The high-order functional component summary generated in step 3 is substituted into the component call point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result, as follows:
[0093] Step 4.1: Initialize the privacy leakage flow Select the sub-communication link of the CCL obtained in step 2.3 and perform the analysis from steps 4.2 to 4.3;
[0094] In this embodiment, there is only one inter-component communication link CCL, namely (Activity1, Activity2), so this one is selected for analysis;
[0095] Step 4.2: Get the formal parameter callee_paras and actual parameter callee_paras at the call point in the sub-communication link, get the summary of the caller component caller_cpt and the called component callee_cpt, instantiate the high-order functional summary of the caller component caller_cpt, and perform the analysis of step 4.3;
[0096] In this embodiment, component Activity1 starts component Activity2 by setting parameter i through the startActivity() method. The formal parameter list callee_paras={a} and the actual parameter list callee_paras={i} at the call point. At the same time, the summary of the high-order functional component of Activity1 is instantiated as follows:
[0097]
[0098] Step 4.3: Find the corresponding parameter callee_para in the parameter list of the called method. If callee_para is not empty, it means that the corresponding parameter is found. According to the correspondence between the formal and actual parameters, further analyze whether the parameter contains sensitive data. If so, record the detected privacy leakage flow and add caller_cpt, caller_method, callee_cpt, callee_method information to LF;
[0099] In this embodiment, additional string information is added to the Intent object i of Activity1, and the string information is marked as sensitive and sent out through the sendTextMessage() method of Activity2. Therefore, there is a privacy leakage flow from Activity1 to Activity2. The leakage flow LF=<Activity1,startActivity(),Activity2,sendTextMessage()> ;
[0100] Step 4.4: According to the called component obtained in step 4.2, find out in CCL whether it has called other components as the calling component. If yes, repeat the analysis from steps 4.2 to 4.3 until the called component has not called other components. If no, select a new sub-communication link in CCL and repeat the analysis from steps 4.1 to 4.4.
[0101] In this embodiment, component Activity2 does not call other components, and there are no other sub-communication links, so the analysis ends here;
[0102] Step 4.5: After all sub-communication links in CCL are analyzed, the detected privacy leakage flow LF is reported.
[0103] In this embodiment, Figure 2 As shown, the code snippet represents two activities: Activity1 and Activity2. Activity1 registers an anonymous button listener for the to2 button (lines 3-9). This anonymous listener uses an inter-component communication method startActivity(). When the button to2 is clicked, the onClick() method is executed and the user interface is changed to Activity2. The Intent containing the device ID (line 13) is considered sensitive data and is then exchanged between the two components by first attaching the data to the Intent using the putExtra() method (line 8) and then by calling the inter-component communication method startActivity() (line 9). The Intent is created by explicitly specifying the target class (Activity2). In this application, onStart() is in the execution lifecycle of an Activity1. When Activity2 is loaded, sendTextMessage() is executed by the system. The data retrieved from the Intent is sent as an SMS message to the specified phone number: there is an ICC leak triggered by the button to2. When the button to2 is clicked, the device ID is transferred from Activity1 to Activity2 and finally to the outside of the application. The privacy leakage flow detected in the final report is:
[0104] LF=<Activity1,startActivity(),Activity2,sendTextMessage()> .
[0105] To summarize, the Android component privacy leakage detection method based on high-order functions in this embodiment utilizes the high-order function characteristic that functions can be used as return values to save the component internal analysis process in the form of a summary, and utilizes the high-order function characteristic that functions can be passed as parameters at the component call point to pass the analysis results within the component to the call point to obtain the privacy data leakage flow, thereby avoiding the need for traditional methods to construct additional activity transfer graphs and component call graphs for privacy leakage detection, and thus can improve the efficiency of privacy leakage detection.
[0106] Embodiment 2:
[0107] The present invention provides an Android component privacy leakage detection system based on a high-order function, which is characterized by comprising:
[0108] A preprocessing module, used for receiving an Android application file and preprocessing the application to obtain a control flow graph and a call graph;
[0109] A first building block, for building inter-component communication links;
[0110] The second building module is used to build a summary of each method, path, and object instance in the component to describe the component behavior. It uses the function as the return value in the high-order function to collect information about the Intent source and target components and generate a high-order functional component summary.
[0111] The output acquisition module is used to obtain the parameter information according to the communication link between components and the relationship between formal and actual parameters. At the component call point, the function in the high-order function can be used as a parameter. The generated high-order functional component summary is substituted into the component call point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result.
[0112] Furthermore, the preprocessing module also includes a receiving module for receiving Android application files.
[0113] Specifically, the above-mentioned preprocessing module, the first building module, the second building module and the acquisition output module can be embedded in a computer processing system, and the computer calls the above-mentioned modules to complete the task of equivalent modeling according to the above-mentioned privacy leakage detection method between Android components based on high-order functions; the above-mentioned preprocessing module, the first building module, the second building module and the acquisition output module can perform operations according to the specific steps given in the above-mentioned privacy leakage detection method between Android components based on high-order functions.
[0114] It should be noted that it should be understood that the division of the various modules of the above system is only a division of logical functions. In actual implementation, they can be fully or partially integrated into a physical entity, or they can be physically separated, and these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the preprocessing module can be a separately established processing element, or it can be integrated in a chip of the above-mentioned device. In addition, it can also be stored in the memory of the above-mentioned device in the form of program code, and a processing element of the above-mentioned device calls and executes the functions of the above signal processing module. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or the instructions in the form of software.
[0115] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0116] Embodiment three:
[0117] The present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores a computer program capable of running on the processor, and when the processor loads and executes the computer program, the method for detecting privacy leakage between Android components based on high-order functions is adopted.
[0118] It should be noted that the terminal device can be a computer device such as a desktop computer, a laptop computer or a cloud server, and the terminal device includes but is not limited to a processor and a memory. For example, the terminal device can also include input and output devices, network access devices and buses.
[0119] Furthermore, the processor may adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. may also be adopted. The general-purpose processor may adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.
[0120] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0121] For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. When an element is referred to as being "assembled on", "installed on", "fixed on" or "set on" another element, it can be directly on the other element or there can also be a centered element. When an element is considered to be "connected" to another element, it can be directly connected to the other element or there may be a centered element at the same time. The terms "vertical", "horizontal", "up", "down", "left", "right" and similar expressions used herein are only for illustrative purposes and are not intended to be the only implementation method.
[0122] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
[0123] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
Claims
1. A privacy leakage detection method between Android components based on high-order functions, characterized in that: The following steps are involved: Receive an Android application file and pre-process the application to obtain a control flow graph and a call graph; Build inter-component communication links; Build a summary of each method, path, and object instance in the component to describe the component behavior. Use the function as the return value in the higher-order function to collect information about the Intent source and target components and generate a higher-order functional component summary. According to the communication links between components, the parameter information corresponds to the formal and actual parameter relationship, and the characteristic that functions in high-order functions can be used as parameters is utilized at the component calling point. The generated high-order functional component summary is substituted into the component calling point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result.
2. According to claim 1, the privacy leakage detection method between Android components based on high-order functions is characterized in that: Preprocess the application to obtain the control flow graph and call graph. The specific steps are as follows: (1) Receive the Android application APK file, parse the specific file, convert the application source code into Jimple's intermediate representation, and search for the life cycle method LM = {lm1, lm2, ..., lm n } and callback function CM={cm1,cm2,…,cm n }; (2) Construct a virtual main method based on LM and CM, and use the virtual main method to generate a control flow graph cfg and a call graph cg.
3. According to claim 2, the privacy leakage detection method between Android components based on high-order functions is characterized in that: To build a communication link between components, the specific steps are as follows: (1) Initialize inter-component communication links Add all class objects in the program to the collection class; (2) In the class, the obtained LM and CM are traversed. For each lm∈LM, cm∈CM, the component name and program point information are added to the caller component object caller_cpt. Then, it is determined whether there is inter-component communication. If so, the target component name and program point information are added to the callee component object callee_cpt. Finally, (caller_cpt, callee_cpt) is added to CCL, and the next method is judged. If not, the current judgment is terminated in advance and the next method is judged. (3) When the LM and CM in all classes are judged, the traversal is terminated and the construction of the inter-component communication link CCL is completed.
4. The method for detecting privacy leakage between Android components based on high-order functions according to claim 3 is characterized in that: Construct a high-order functional component summary. The specific steps are as follows: (1) Obtain all components cpt from the obtained CCL. For each component c in cpt, obtain all methods M in c. For each method m in M, construct a high-order functional component summary of component c in order according to steps (2) to (6). (2) If m contains an Intent statement, the creation, update, and sending of the Intent statement object are summarized, and the object summary is represented as OS=<obj,mtd,stmt,ctx> , where obj is the instance of the Intent object that needs to be modeled, mtd is the signature of the method where obj is located, stmt is the statement related to obj, and ctx is the context information; (3) Construct the summary of method m: The method summary contains a set of object summaries and a set of called method summaries. For the called methods whose object summaries are related to the calling context, the object summaries are obtained through step (2) according to the method summary of the callee and its relationship, and the new object summary is constructed into S. os For other called methods whose object digests are not related to the context of method m, their method digests will be directly added to S ms To avoid reanalysis, the method summary is presented as MS= <mtd,S os ,S ms >, where mtd is the method signature, S os is a collection of object summaries, S ms is a collection of called method summaries; (4) Repeat steps (2) to (3) until all methods of M are analyzed. At this time, the summary CS of component c is obtained. c =OS m1 ∪MS m2 ∪…∪OS mn ∪MS mn ; (5) Repeat steps (2) to (4) until each component in the CPT is analyzed and the process stops. At this point, a summary of each component in the CPT is obtained. (6) Construct the component summary obtained in step (5) into a high-order functional component summary, where C src is the summary of the calling component, C des is a summary of the called component. The high-order functional component summary is expressed as: λC src C des .F(C src ,C des )。 5. According to claim 4, the method for detecting privacy leakage between Android components based on high-order functions is characterized in that: Substitute the generated high-order functional component summary into the component call point to obtain the privacy data leakage flow. The specific steps are as follows: (1) Initialize the privacy leakage flow Select the sub-communication link of the acquired CCL; (2) Obtain the formal parameter callee_paras and the actual parameter callee_paras at the call point in the sub-communication link, obtain the summary of the caller component caller_cpt and the called component callee_cpt, and instantiate the high-order functional summary of the caller component caller_cpt; (3) Search for the corresponding formal parameter callee_para in the parameter list of the called method. If callee_para is not empty, it means that the corresponding formal parameter is found. According to the correspondence between the formal and actual parameters, further analyze whether the parameter contains sensitive data. If so, record the detected privacy leakage flow and add caller_cpt, caller_method, callee_cpt, and callee_method information to LF; (4) Based on the called component obtained in (2), find out in the CCL whether it has called other components as a calling component. If so, repeat the analysis from steps (2) to (3) until the called component has not called other components. If not, select a new sub-communication link in the CCL and repeat the analysis from steps (1) to (4); (5) After all sub-communication links in CCL are analyzed, the detected privacy leakage flow LF is reported.
6. The method for detecting privacy leakage between Android components based on high-order functions according to claim 2, characterized in that: The control flow graph cfg is generated by the tool Soot, and the call graph cg is generated by the tool Heros.
7. The method for detecting privacy leakage between Android components based on high-order functions according to claim 2, characterized in that: The intermediate file jimple file is generated by decompiling through the soot tool.
8. A privacy leakage detection system between Android components based on high-order functions, characterized in that: include: A preprocessing module, used for receiving an Android application file and preprocessing the application to obtain a control flow graph and a call graph; A first building block, for building inter-component communication links; The second building module is used to build a summary of each method, path, and object instance in the component to describe the component behavior. It uses the function as the return value in the high-order function to collect information about the Intent source and target components and generate a high-order functional component summary. The output acquisition module is used to obtain the parameter information according to the communication link between components and the relationship between formal and actual parameters. At the component call point, the function in the high-order function can be used as a parameter. The generated high-order functional component summary is substituted into the component call point to obtain the privacy data leakage flow, thereby obtaining the privacy data leakage detection result.
9. The method for detecting privacy leakage between Android components based on high-order functions according to claim 8, characterized in that: The preprocessing module also includes a receiving module for receiving Android application files.
10. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: The memory stores a computer program that can be run on a processor. When the processor loads and executes the computer program, the Android component privacy leakage detection method based on high-order functions described in any one of claims 1 to 7 is adopted.
