Advertisement protection method under privacy protection of Android mobile phone mobile terminal
Through static analysis and dynamic monitoring, the source of privileged calls to the advertising library is identified, and the anonymous protection module is used to process the access results. This solves the problem of the mobile advertising library accessing user privacy through permission inheritance, and achieves user privacy protection and the stability and stability of the advertising ecosystem. Business model compatibility.
Patent Information
- Application Number
- CN202410727403.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-06
AI Technical Summary
Existing technologies cannot effectively prevent mobile advertising libraries from accessing user private information through permission inheritance, leading to user privacy leaks and advertising fraud, and existing protection methods affect the stability and business model of the advertising ecosystem.
An anonymous mobile phone advertising protection method based on data perturbation is used to identify the source of privileged calls to the advertising library through static analysis and dynamic monitoring, and the anonymous protection module is used to fuzzify the access results to prevent the advertising library from abusing host application permissions to access sensitive information.
Effectively protect against permission inheritance access threats, protect user privacy, maintain the stability and business model of the advertising ecosystem, and ensure that ads are delivered normally without affecting application functions.
Smart Images

Figure CN118674502A
Abstract
Description
Technical Field
[0001] The present application relates to an advertisement protection method under mobile phone privacy protection, and more particularly to an advertisement protection method under mobile phone privacy protection on an Android mobile phone, belonging to the technical field of mobile terminal advertisement protection methods. Background Art
[0002] The development model of embedding ad libraries in mobile applications will be a major trend in the future development of the mobile ecosystem. While it brings a win-win effect to developers and advertisers, it also raises some new security issues. In addition, the uneven quality and scale of mobile advertising platforms, and the lack of unified platform standards are also part of the reason for the security issues. In the Android environment, applications need to declare permissions to access relevant sensitive information or perform specific operations. Due to the special symbiotic relationship between applications and ad libraries, and the Android permission control system assigns permissions at the application level, there are two consequences: first, the ad library can use all permissions applied for by the host application; second, the application that embeds the ad library must apply for all permissions declared in the ad library developer configuration document.
[0003] When a user installs an application containing an ad library on their device, the ad library exists on the user's device as part of the application. The Android operating system assigns the same UID to the application and the ad library as a whole, even if the ad library and the application have different package names. In addition, the ad library runs in the same process space as the host application, and the Android operating system cannot distinguish whether the current privileged call comes from the ad library or the main application code. While implementing the advertising function in the application, the ad library may actively collect user privacy information to implement its so-called "ad personalization" service. The collection of user information by the ad library damages user privacy.
[0004] The situation where the ad library uses the host application permissions to call privileged methods to access user privacy information is called the ad library permission inheritance access threat. This threat is different from common threats, such as threats from malicious developers and threats from malicious ads. Because there is no malicious third party in the permission inheritance access threat itself, all of its calls are accessed using "legal" declared permissions, but these permission-protected information is often highly sensitive, especially dangerous permissions. As a third-party library, the ad library's access to sensitive data poses a privacy threat. In principle, it only needs INTERNET permissions to implement its advertising delivery function (because it requires a network connection to the ad server).
[0005] The prior art proposes several related solutions, many of which revolve around the permission system. Check the permission manifest profile of the application being installed against the permission allocation policy, blocking any potentially unsafe request combination. By allowing application developers to limit permission allocation at installation time and use permissions at runtime. Other systems attempt to add further expressiveness to the permission system, rewriting privacy-sensitive API calls to simulate situations where they fail. This approach is further refined by adding taint tracking, allowing for more nuanced policies. However, these systems typically treat the application as a whole, without further distinguishing between ad libraries and host applications for parsing and defense.
[0006] In terms of advertising, the existing technology selects advertisements to be delivered to the client according to rules, but strives to achieve the least damage to the existing advertising network industry model. However, it is only for web online advertising and does not work for mobile advertising protection. The biggest problem with providing a mobile advertising framework is that it requires the reconstruction of all advertising materials in all advertising platforms in the existing advertising market, which is obviously an impossible task.
[0007] The problems that need to be solved in the existing mobile phone privacy protection advertising protection and the key technical difficulties of this application include:
[0008] (1) The free release of most Android applications in numerous application markets has led to the prevalence of mobile advertising. Application developers only need to integrate the advertising SDK provided by the advertising network into their applications to use advertising services. In the Android system, existing applications need to declare permissions to access relevant sensitive information or perform specific operations. Due to the special symbiotic relationship between applications and advertising libraries, and the Android permission control system assigns permissions at the application level, there are two consequences: first, the advertising library can use all permissions applied for by the host application; second, applications embedded in the advertising library must apply for all permissions declared in the advertising library developer configuration document. In addition, the advertising library can also perform permission detection. After the advertising library detects the permission, they can use this permission to collect sensitive information and send it to a remote server. Fine-grained sensitive information is easily accessed by the advertising library by inheriting the permissions of the host application. There are underreporting and the static parsing file is not updated in time, resulting in a high false alarm rate, which affects the operation of the application and blocks the display of advertisements. It cannot maintain the stability of the mobile advertising ecosystem and cannot prevent advertisements from stealing user privacy information.
[0009] (2) Regarding the security issues that may exist after embedding the mobile advertising library in the mobile application, most of the existing technologies are aimed at malicious network environments or malicious attackers. Therefore, they all protect the application as a whole, which has considerable limitations and can only ensure that the application as a whole is not attacked or interfered with. However, the advertising SDK also contains privileged access APIs for user sensitive information. Developers import the advertising SDK as a jar package into the application and finally publish it as a whole to the application market. When the application is running, the advertising SDK runs in the same process space as the application, and the Android system cannot identify the source of the privileged method call, allowing the advertising SDK to access any resources it wants to obtain within the scope of the permission. The existing protection methods do not provide a good solution to this problem.
[0010] (3) Companies that submit advertising materials to mobile advertising platforms often want to promote their products or services to the greatest extent possible. In order to obtain a higher return on investment, mobile advertising platforms may use certain means to associate potential users with certain advertising materials, so as to maximize the interaction between users and advertisements. This association is often based on the user's privacy-sensitive information. Collecting certain information about users can uniquely identify the user among many pieces of information, such as collecting the device number. This number is assigned when the mobile phone leaves the factory and is theoretically unchangeable. After the advertising network collects this information, it can personalize a certain type of advertisement to the user. Many sensitive information is actually protected by Android system permissions. Only applications with such permissions can access the corresponding sensitive information or perform specific operations. The symbiotic relationship between the mobile advertising library and the host application makes it difficult for the Android operating system to prevent the mobile advertising library from accessing private information. The problem of permission inheritance access threats in the mobile advertising ecosystem is serious. The existing technology affects the normal operation of the host application, cannot guarantee the normal display of advertisements, cannot maintain the stability of the mobile advertising ecosystem, and is not very practical. Summary of the invention
[0011] The anonymous advertising protection method for mobile phones proposed in this application, from the perspective of identifying the source of privileged method calls, not only does not need to modify the original application, but also does not need to provide a new advertising framework for developers or advertising platforms to use. It can also ensure that advertisements can be placed normally in the application without affecting the original application function, and can effectively solve the problem of borrowing permissions to access protected sensitive information in addition to advertising fraud. In addition, this method effectively maintains the compatibility and effectiveness of the business model and operation mode of the current mobile advertising ecosystem. Through static analysis, the privileged access in the advertising library can be effectively identified, and through dynamic monitoring, the current privileged call source in the Android system can be identified. If it is identified that the call to the privileged method comes from the advertising library, the anonymous protection module is used to fuzzify the access result. The anonymous advertising protection method for mobile phones can effectively protect against the threat of permission inheritance access, thereby ensuring the privacy characteristics of users in the mobile advertising ecosystem, while also maintaining the stability of the mobile advertising ecosystem, protecting user privacy, and accurate and efficient advertising protection, and reasonable overhead.
[0012] In order to achieve the above technical effects, the technical solutions adopted in this application are as follows:
[0013] Advertisement protection method under privacy protection on Android mobile phones. Combined with the access threat of permission inheritance in the mobile advertising ecosystem, a mobile phone anonymous ad protection method based on data perturbation is established. Regarding how to identify the ad library in the application, what privileges the ad library code has, and how to identify the current call source during the application running process, a method combining static program parsing and dynamic operation monitoring is proposed. The ad library feature code is used to identify the privileged call source in the function call stack, and then a data perturbation-based method is used to perform fuzzy calculations on the privileged calls of the ad library. Different anonymous rules are used for different data types to anonymize the access results, solving the violation of user privacy by the ad library.
[0014] Mobile phone anonymous advertising protection consists of a static parsing module, a dynamic monitoring module and an anonymous protection module. These three parts span the application layer and the application framework layer of the Android system. The static parsing module is divided into three parts: reverse calculation, permission mapping and matching identification. The static parsing module is responsible for parsing the APK source file and building the advertising library-permission table. The dynamic monitoring module adds an Android system service anonymous advertising protection Service, which is started when the Android system starts. The service encapsulates methods for parsing the advertising library-permission table, dynamically capturing function call stacks and identifying the current call source. The anonymous protection module performs data protection on sensitive information accessed by the advertising library. It uses the methods in the anonymous advertising protection Service system service to identify the call source as the advertising library, and then uses different anonymous rules according to different data types to perturb the data and return it to the advertising library to protect user sensitive information. The three modules work together to prevent the advertising SDK from inheriting the host application permissions to access sensitive information.
[0015] Preferably, the mobile phone anonymous advertising protection architecture: re-architects the use of permissions to access local resources, and regards the situation where the advertising SDK uses the host application permissions to access local sensitive resources as a permission inheritance access threat. This application constructs a mobile phone anonymous advertising protection method based on data perturbation from the perspective of dynamically identifying the source of privileged method callers, and adopts a combination of Android static parsing processing and dynamic monitoring. For local application files, static parsing and Android reverse technology are used to parse the mobile application advertising library; for dynamic permission calls of applications, a new system service is used to capture the call stack and combine the static parsing results to perform fuzzy calculations of data perturbations on the call results, so as to prevent the mobile advertising library from abusing the host application to access fine-grained local resources.
[0016] Preferably, the overall structure is as follows: when a user uses an application function, the application layer code in the upper layer of the Android architecture calls the API provided by the framework layer, the application framework layer provides the application layer with an interface access to implement code reuse, and when the API is called, the call stack is obtained to identify the call source of the current access to sensitive resources. The mobile phone anonymous advertising protection method performs static analysis at the application layer and dynamic monitoring at the framework layer, spanning these two levels in the Android architecture;
[0017] The static parsing module, dynamic monitoring module and anonymous protection module work together to process the access to sensitive resources in the advertising library, specifically including: first, the application is processed by the static parsing module before installation, which parses the access to sensitive resources in the advertising library and builds an advertising library-permission table; second, during the operation of the application, the interface provided by the framework layer is called to achieve resource access or data processing, an anonymous advertising protection system is added to the application framework layer, the current API call stack is obtained for dynamic monitoring, and according to the advertising library-permission table passed by the static parsing module, it is parsed whether the current call comes from the advertising library, and the result is submitted to the anonymous protection module for processing; finally, the anonymous protection module receives the recognition result of the dynamic monitoring module. If the current call comes from the advertising library, the perturbation result is returned to the framework layer API according to the anonymous rule matching, and the framework layer API then feeds back the perturbation result to the program that calls the interface.
[0018] Preferably, the static analysis module statically analyzes the application apk file embedded in the mobile advertising library, identifies the feature code of the advertising library, and constructs the advertising library-permission table. The static analysis module is composed of three parts working together, namely reverse calculation, permission mapping and matching identification. The reverse calculation submodule adopts Android static decompilation to reversely convert the apk file into Java source text for subsequent review and analysis; the permission mapping submodule implements the mapping between Android dangerous permissions and key classes, constructs a permission-class table, and provides it to the matching identification submodule for subsequent operations; the matching identification submodule first identifies the advertising library feature code in the Java source file generated by the reverse module, and then matches the Java source file in the package identified by the advertising library feature code with the permission-class table to find out the sensitive permissions exposed by the advertising library, and then obtains all the privileged accesses that may exist in the advertising library according to the permission API mapping list provided by PSCout, and finally generates an advertising library-permission table.
[0019] Preferably, the dynamic monitoring module structure: the module adds an anonymous advertising protection system in the Android application framework layer, which is used to dynamically capture the function call stack, and extract the top data of the current function call stack, and compare it with the advertising library-permission table. If the top call method is derived from sensitive permission access of the advertising library, it is recorded in the advertising library call result, and the result is submitted to the anonymous protection module for processing. If there is no sensitive permission access to the advertising library, the call result is directly returned to the application layer without any other special processing.
[0020] Preferably, the static parsing module identifies the sensitive high-risk permissions contained in the advertising library embedded in the application, and then knows the privileged method calls that may exist in the advertising library. The source code of the apk is reversed through Android decompilation, and then the advertising library feature code is used to identify the advertising library code in the source code, and then the sensitive permissions contained in the advertising library are matched according to the key classes of accessing sensitive permissions in the advertising library code. It is composed of three parts: reverse calculation, permission mapping and matching identification. The reverse submodule applies the parsing technology of Android's popular static decompilation to obtain the source code of the application, and provides it to the matching identification module for subsequent processing. The permission mapping submodule constructs a permission-class table for Android high-risk permissions to identify key calls of sensitive permissions in the source code, and the matching identification submodule first collects the package name of the popular mobile advertising library as the mobile advertising library feature code; then uses the feature code field to identify the advertising library code in the application source code; finally, the permission-class table is used to find the sensitive permission calls in the advertising library code. The three submodules work together to finally generate an advertising library-permission table.
[0021] Preferably, the reverse module is implemented as follows: the reverse module obtains the Android application source code to provide it to the matching identification module for processing, batch processes the application files using Android decompilation, and reversely converts the apk file into a java source file;
[0022] The reverse route selected in this application is the Java route, which adopts the combined use of the dex2jar tool and the jadx tool. The dex2jar tool converts apk format files into jar format, and the jadx tool converts class format files into java format. Both the dex2jar tool and the jadx tool run in command line mode, and the output of the dex2jar command is the input condition of the jar command, and the output of the jar command is the input condition of the jadx command. When building commands, use "&&" to splice commands, and then put them into the console for execution to improve the automation performance of the reverse module. The decompilation establishes a thread pool so that multiple threads can be executed simultaneously to further improve the efficiency of the reverse module.
[0023] Preferably, the matching and identifying module realizes: the matching and identifying module identifies the advertisement library feature code, and then matches the sensitive permissions possessed by the advertisement library code in the application source code according to the advertisement library feature code and the Android permission-class table, thereby obtaining the privileged function access that may exist in the advertisement library code;
[0024] This application considers popular mobile advertising libraries. After removing the aggregation platforms and proxy platforms in the list, it collects all the remaining advertising developer software toolkits provided by mobile advertising companies, and performs static analysis to manually identify the package name of the advertising library as the advertising library feature code. The advertising library feature code, that is, the advertising library package name, is used to uniquely identify the advertising library introduced in the application;
[0025] After identifying the ad library signature code, find the introduced ad library code in the application source code, and then find the sensitive permissions that the ad library can use. The steps are as follows:
[0026] Step 1: traverse the source file path to find the file set identified by the advertisement library feature code;
[0027] Step 2: Traverse the ad library file collection and match the permission-class table
[0028] Step 3: Output the sensitive permissions of the ad library;
[0029] Mobile anonymous ad protection optimizes folder and file traversal. The rules are as follows:
[0030] Rule 1: Identify whether the permission list document contains INTERNET permission, if yes, terminate the traversal;
[0031] Rule 2: Ignore system library folders during file and folder traversal;
[0032] After the traversal is completed, the ad library-permission table is stored in the form of an XML configuration file.
[0033] Preferably, the dynamic monitoring module dynamically captures the call stack during the running of the application to identify whether the current sensitive call comes from the advertising library. This application adopts system service implementation, adds a Java system service for dynamic monitoring, and the framework layer API calls the service to obtain the identification result, and the service can run in the Android system for a long time;
[0034] Modify the source code of the Android application framework layer, dynamically monitor the system service class of the privileged function call source, add the IAnonymize.aidl file, the AnonymizeService.java file implements the interface defined in IAnonymize.aidl, and the AnonymizeManager.java file for other services or applications to call;
[0035] AnonymizeService parses the ad library-permission table identified by the static parsing module and stores it in the ad library feature code array; uses the Android system's custom CallStackTrace exception class to perform stack tracing on the privileged method belonging class, takes the current top element of the stack and uses the ad library feature code to identify whether the current call comes from the ad library. If so, returns a Boolean value of true to mark the current permission call return result;
[0036] Start the custom system service AnonymizeService when the Android system starts, register the service to the system service startup process, and modify the SystemServer.java file to add the custom service to the process;
[0037] Next, create a new management class AnonymizeManager to call the methods in the service. The member variables in this class are the custom system service anonymous ad protection Service. Get the service instance in the constructor of the management class so that you can use the methods in the service in the member functions of the management class. Finally, register it in the system service, bind AnonymizeManager and Anonymize_SERVICE through the IBinder mechanism, and implement the management class to call the methods in the system service using the aidl interface.
[0038] Preferably, the anonymous protection module implements: for the dangerous permission method calls identified in the static analysis module, the anonymous ad protection Service in the dynamic monitoring module is used to capture the current function call stack. If the call result at the top of the stack comes from the ad library, the custom anonymous rule is applied to process the result and then returned to the ad library;
[0039] Based on the PBKDF2 encryption hash algorithm, it is improved. SecureRandom is used in the algorithm to generate salt and append it to the end of the original information. The appended information is hashed and then returned to the advertising server. The highly randomized value of SecureRandom is appended to the original information, so that the value sent to the advertising server each time is different, reducing the possibility of the advertising server tracking users based on a specific unchanging value. After the salt value is appended and hashed, the string no longer has the characteristics of obviously exposing user privacy, protecting fine-grained user privacy information from being exposed in the advertising network. For the data cursor obtained by calling the query method in the ContentProvider component, the cursor data is cleared in an anonymous protection form. For the composite type in Android, it is anonymized to NULL. The implementation of the anonymous rule is realized by function overloading. When the AnonymizeService system service in the dynamic monitoring module recognizes that the current function caller is the advertising library, the overloaded function is called to anonymize the call result before returning.
[0040] When querying data through the ContentProvider class, the ContentResolver object communicates with the Provider. The request time series process is: call getContentResolver().query(Uri,String,String,String,String). This method calls the query method in ContentResolver. When the request method is called, ContentResolver parses the URI in the parameter and extracts the authorization authority field. This field uniquely identifies the ContentProvider object in Android. ContentResolver guides the request to the ContentProvider object registered with the authority, and then calls the query method in it to obtain data. After calling the request method in ContentProvider, a Cursor object will be returned, which encapsulates the query result set.
[0041] The anonymous protection module registers the anonymous ad protection service system service in the ContentResolver class for processing. First, it obtains the AnonymizeService system service instance in the constructor of the ContentResolver class, and returns the perturbed anonymous data when it is identified as an ad library call in the query operation;
[0042] The MatrixCursor type inherits the AbstractCursor class. The AbstractCursor class finally implements the Cursor interface and uses the MatrixCursor class to return the result. The Cursor object returned by the MatrixCursor class in anonymous protection is the result of the empty table query, which is returned to the upper layer to avoid leakage of user privacy information.
[0043] During the running of the application, the ad library code obtains the device ID and sends it to the ad server when the ad view is initialized. The system service AnonymizeService dynamically monitors the call stack information. The isAdsCaller() method in the AnonymizeService system service reads the top data of the stack and matches it with the ad library feature code, identifying that the current call comes from the ad library. The ad library call result is anonymized by the function overload, and the salt value is added to the original data to calculate the hash value and then returned.
[0044] Compared with the prior art, the innovations and advantages of this application are:
[0045] (1) This application comprehensively analyzes the use of permissions by popular advertising libraries, studies the threat of permission inheritance access, and analyzes that existing defense methods cannot effectively address such threats, thereby proposing a mobile phone anonymous advertising protection method based on data perturbation. In combination with the threat of permission inheritance access in the mobile advertising ecosystem, a mobile phone anonymous advertising protection method based on data perturbation is established. Regarding how to identify the advertising library in the application, what privileges the advertising library code has, and how to identify the current call source during the operation of the application, a method combining static program parsing and dynamic operation monitoring is proposed. The advertising library feature code is used to identify the privileged call source in the function call stack, and then a data perturbation-based method is used to perform fuzzy calculations on the privileged calls of the advertising library. Different anonymity rules are used for different data types to anonymize the access results, thereby solving the infringement of user privacy by the advertising library.
[0046] (2) The anonymous advertising protection module of the mobile phone of the present application consists of a static analysis module, a dynamic monitoring module and an anonymous protection module. These three parts span the application layer and the application framework layer of the Android system. The static analysis module is further divided into three parts: reverse calculation, permission mapping and matching identification. The static analysis module is responsible for parsing the APK source file and constructing the advertising library-permission table. The dynamic monitoring module adds an Android system service anonymous advertising protection Service, which is also started when the Android system is started. The service encapsulates methods for parsing the advertising library-permission table, dynamically capturing function call stacks and identifying the current call source. The anonymous protection module performs data protection on sensitive information accessed by the advertising library. It uses the method in the anonymous advertising protection Service system service to identify the call source as the advertising library, and then uses different anonymous rules according to different data types to perturb the data and return it to the advertising library to protect user sensitive information. The three modules work together to prevent the advertising SDK from inheriting the host application permissions to access sensitive information. It is an effective, universal and reasonably performing mobile privacy protection advertising protection tool with strong practicality.
[0047] (3) The anonymous advertising protection method for mobile phones proposed in this application, from the perspective of identifying the source of privileged method calls, does not require modifying the original application, nor does it require providing a new advertising framework for developers or advertising platforms to use. It can also ensure that advertisements can be delivered normally in the application without affecting the original application functions, and can effectively solve the problem of borrowing permissions to access protected sensitive information in addition to advertising fraud. In addition, this method effectively maintains the compatibility and effectiveness of the business model and operation mode of the current mobile advertising ecosystem. Through static analysis, the privileged access in the advertising library can be effectively identified, and through dynamic monitoring, the current privileged call source in the Android system can be identified. If it is identified that the call to the privileged method comes from the advertising library, the anonymous protection module is used to fuzzy the access result. The anonymous advertising protection method for mobile phones can effectively protect against the threat of permission inheritance access, thereby ensuring the privacy characteristics of users in the mobile advertising ecosystem, while also maintaining the stability of the mobile advertising ecosystem, protecting user privacy, and accurate and efficient advertising protection with reasonable costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 This is the architecture diagram of the mobile phone anonymous advertising protection system.
[0049] Figure 2 It is the reverse module flow chart of the static analysis module.
[0050] Figure 3 This is a schematic diagram of the dangerous permissions extraction results in Android.
[0051] Figure 4 This is a schematic diagram of the advertising library feature code recognition results.
[0052] Figure 5 It is the advertising library-permission table storage logic diagram.
[0053] Figure 6 This is the class diagram and structure diagram of the modified TelephonyManager.
[0054] Figure 7 This is a statistical diagram of the number of popular mobile advertising libraries in the static analysis module. DETAILED DESCRIPTION
[0055] Below, in conjunction with the accompanying drawings, the technical solution of the advertising protection method under privacy protection for Android mobile phones provided by this application is further described so that technical personnel in this field can better understand this application and implement it.
[0056] Embedding a mobile advertising library in a mobile application allows application developers to receive compensation after publishing the application for free in the application market through advertising display or interaction when the application is running. Companies that submit advertising materials to mobile advertising platforms often want to promote their products or services to the greatest extent. In order to obtain a higher return on investment, mobile advertising platforms may use certain means to associate potential users with certain advertising materials, so as to maximize the interaction between users and advertisements. This association is often based on the user's privacy-sensitive information. Collecting certain information about users can uniquely identify the user among many pieces of information, such as collecting the device number, which is assigned when the phone leaves the factory and is theoretically unchangeable. After the advertising network collects this information, it can personalize a certain type of advertisement to the user. Many sensitive information is actually protected by Android system permissions. Only applications with this permission can access the corresponding sensitive information or perform specific operations. The symbiotic relationship between the mobile advertising library and the host application makes it difficult for the Android operating system to prevent the mobile advertising library from accessing private information.
[0057] This application combines the threat of permission inheritance access in the mobile advertising ecosystem to establish a mobile phone anonymous advertising protection method based on data perturbation. It proposes a method that combines static program parsing and dynamic operation monitoring to solve the problems of how to identify the advertising library in the application, what privileges the advertising library code has, and how to identify the current call source during the operation of the application. It uses the advertising library feature code to identify the privileged call source in the function call stack, and uses different anonymity rules for different data types to anonymize the access results, thereby solving the infringement of user privacy by the advertising library.
[0058] Using the penetration testing tool "BurpSuite", this application completed the threat realization and protection test on the Android simulator compiled from the Android source code. The experimental results show that the anonymous advertising protection method for mobile phones can ensure the normal display of advertisements without affecting the normal operation of the host application, thus maintaining the stability of the mobile advertising ecosystem. In addition, this method does not require modifications to existing applications or advertising frameworks, and is very practical.
[0059] 1. Mobile phone anonymous advertising protection architecture
[0060] Regarding the security issues that may exist after embedding mobile advertising libraries in mobile applications, most of the existing technologies are aimed at malicious network environments or malicious attackers. Therefore, they all protect the application as a whole, which has considerable limitations and can only ensure that the application as a whole is not attacked or interfered with. However, the advertising SDK also contains privileged access APIs to user sensitive information. Developers import the advertising SDK as a jar package into the application and finally publish it to the application market as a whole. When the application is running, the advertising SDK runs in the same process space as the application, and the Android system cannot identify the source of the privileged method call, allowing the advertising SDK to access any resources it wants to obtain within the scope of permissions. Existing protection methods do not provide a good solution to this problem.
[0061] This application restructures the use of permissions to access local resources, and regards the situation where the advertising SDK uses the host application permissions to access local sensitive resources as a permission inheritance access threat. The fundamental reason for this threat is that the Android system itself cannot identify who the current privileged caller is. If the application itself has this permission, the Android system will return the call result. Therefore, this application constructs a mobile phone anonymous advertising protection method based on data perturbation from the perspective of dynamically identifying the source of privileged method callers. Because the application is dynamically running, it adopts a combination of Android static parsing processing and dynamic monitoring. For local application files, static parsing and Android reverse technology are used to parse the mobile application advertising library; for dynamic permission calls of applications, the new system service is used to capture the call stack and combine the static parsing results to perform fuzzy calculations of data perturbations on the call results, thereby preventing the mobile advertising library from abusing the host application to access fine-grained local resources.
[0062] (I) Overall structure
[0063] When users use application functions, the application layer code calls the API implementation provided by the framework layer in the upper layer of the Android architecture. The application framework layer provides the application layer with interface access to implement code reuse without providing underlying implementation details. When calling the API, the call stack is obtained to identify the source of the current call to access sensitive resources. Figure 1 As shown, the mobile phone anonymous advertising protection method performs static analysis at the application layer and dynamic monitoring at the framework layer, spanning these two levels in the Android architecture.
[0064] Mobile anonymous advertising protection consists of a static analysis module, a dynamic monitoring module, and an anonymous protection module. The three modules work together to process access to sensitive resources in the advertising library, including:
[0065] First, the application is processed by the static analysis module before installation to analyze the sensitive resource access in the advertising library and build an advertising library-permission table; secondly, during the operation of the application, the interface provided by the framework layer is called to achieve resource access or data processing, and an anonymous advertising protection system is added to the application framework layer (as shown in the AA service in the architecture diagram) to obtain the current API call stack for dynamic monitoring. According to the advertising library-permission table passed by the static analysis module, it is analyzed whether the current call comes from the advertising library, and the result is submitted to the anonymous protection module for processing; finally, the anonymous protection module receives the recognition result of the dynamic monitoring module. If the current call comes from the advertising library, the perturbation result is returned to the framework layer API according to the anonymous rule matching, and the framework layer API then feeds back the perturbation result to the program that calls the interface.
[0066] (II) Static analysis module structure
[0067] The static analysis module statically analyzes the application apk file embedded with the mobile advertising library, identifies the feature code of the advertising library, and constructs the advertising library-permission table. The static analysis module consists of three synergistic parts, namely reverse calculation, permission mapping and matching identification. The reverse calculation submodule uses Android static decompilation to reversely convert the apk file into a Java source file (Java files have good readability) for subsequent review and analysis; the permission mapping submodule implements the mapping between Android dangerous permissions and key classes, constructs a permission-class table, and provides it to the matching identification submodule for subsequent operations; the matching identification submodule first identifies the advertising library feature code in the Java source file generated by the reverse module, and then matches the Java source file in the package identified by the advertising library feature code with the permission-class table to find out the sensitive permissions exposed by the advertising library, and then obtains all the privileged accesses that may exist in the advertising library according to the permission API mapping list provided by PSCout, and finally generates an advertising library-permission table.
[0068] (III) Dynamic monitoring module structure
[0069] The dynamic monitoring module is the core module of the entire mobile phone anonymous advertising protection method. This module adds an anonymous advertising protection system in the Android application framework layer to dynamically capture the function call stack and extract the top data of the current function call stack, and compare it with the advertising library-permission table. If the top call method is derived from sensitive permission access of the advertising library, it will be recorded in the advertising library call result and the result will be submitted to the anonymous protection module for processing. If there is no sensitive permission access to the advertising library, the call result will be directly returned to the application layer without any other special processing.
[0070] (IV) Anonymous protection module structure
[0071] The anonymous protection module plays a role in data protection. Based on the advertising library call results submitted by the dynamic monitoring module, the anonymous protection module uses anonymous rules to perform fuzzy calculations on the data to prevent the advertising library from actively collecting fine-grained privacy information. The anonymous rules determine what kind of disturbance value to return based on the current data type. For ContentProvider, one of the four major components of Android, the advertising library integrated in the application obtains the data cursor by calling the query() query method. These data include contact information, calendar information, short messages, video information, and audio information. After the anonymous protection module identifies the advertising library call results, it clears the data in the cursor and returns.
[0072] 2. Protection methods for anonymous mobile advertising
[0073] The anonymous advertising protection method for mobile phones is to identify the calls of the advertising library to sensitive permissions and return anonymized data to protect user privacy. The advertising company is directly identified based on the "domain name. company name". Static program analysis and processing and dynamic operation monitoring are combined. The static program analysis and processing use the Android decompilation method to obtain the application source code, and then use the permission-class table and the advertising library feature code to identify all sensitive permission calls of the advertising library. Dynamic monitoring uses the newly added Android system service to monitor the call of the privileged method to identify the call source and cooperate with the anonymous protection module to control the advertising library call results.
[0074] (I) Static parsing module implementation
[0075] The static analysis module identifies the sensitive and high-risk permissions contained in the ad library embedded in the application, and then knows the privileged method calls that may exist in the ad library. It reverses the source code of the apk through Android decompilation, and then uses the ad library feature code to identify the ad library code in the source code, and then matches the sensitive permissions contained in the ad library according to the key class of accessing sensitive permissions in the ad library code. It consists of three parts: reverse calculation, permission mapping, and matching identification. The reverse submodule uses the analysis technology of Android's popular static decompilation to obtain the source code of the application, and provides it to the matching identification module for subsequent processing. The permission mapping submodule constructs a permission-class table for Android's high-risk permissions to identify the key calls of sensitive permissions in the source code, and the matching identification submodule first collects the package name of the popular mobile ad library as the mobile ad library feature code; then uses the feature code field to identify the ad library code in the application source code; finally, the permission-class table is used to find the sensitive permission calls in the ad library code. The three submodules work together to finally generate the ad library-permission table.
[0076] 1. Reverse module implementation
[0077] The reverse module obtains the Android application source code to provide it to the matching identification module for processing, uses Android decompilation to batch process application files, and reversely converts the apk file into a java source file.
[0078] Android reverse engineering is a decisive step in static analysis, and the product of reverse engineering is a Smali file or a Java source file. The method of reverse conversion into a Smali file is usually called the disassembly route, and the file conversion process is apk-dex-Smali. The success rate of this conversion method is very high, and the degree of damage to the source file is relatively small, but the readability of the Smali file is too poor, the syntax is obscure, and it is not convenient for subsequent static analysis. The final product of the reverse conversion into a Java file is a Java source file, and the file conversion process is apk-jar-java. This conversion method may damage the source program to a certain extent, but the readability of the Java file is convenient for subsequent static analysis, so the reverse route selected in this application is the Java route.
[0079] The dex2jar tool and the jadx tool are used in combination. The dex2jar tool converts the apk format file into the jar format, and the jadx tool converts the class format file into the java format. The reverse module flow chart is as follows Figure 2 As shown. Both the dex2jar tool and the jadx tool are run in command line mode, and the output of the dex2jar command is the input condition of the jar command, and the output of the jar command is the input condition of the jadx command. When building commands, use "&&" to splice commands, and then put them into the console for execution to improve the automation performance of the reverse module. The decompilation process is time-consuming, so a thread pool is established here to allow multiple threads to run simultaneously to further improve the efficiency of the reverse module.
[0080] 2. Permission mapping module implementation
[0081] This application only focuses on permissions marked as dangerous. Permissions included in the dangerous category allow applications to potentially access sensitive information or perform specific operations, which are more harmful.
[0082] Dangerous permissions include areas where an application requests data or resources involving user privacy information, and also include operations that affect data stored by the user on their device or other applications.
[0083] There are nine groups of dangerous permissions in Android (a total of 24 items), and applications only need to apply for group categories. This application extracts the key classes in each group of dangerous permissions based on the permission-API mapping table provided by PSCout, and determines the access of the ad library to privileges based on the presence or absence of the key classes, thereby improving the efficiency of the matching identification module in the mobile phone anonymous ad protection method. The extraction results are shown in the figure below. Figure 3 shown.
[0084] 3. Implementation of matching identification module
[0085] The matching and identification module identifies the advertising library feature code, and then matches the sensitive permissions of the advertising library code in the application source code based on the advertising library feature code and the Android permission-class table, thereby obtaining the privileged function access that may exist in the advertising library code.
[0086] This application considers popular mobile advertising libraries. After removing the aggregation platforms and proxy platforms in the list, it collects all the remaining advertising developer software toolkits provided by mobile advertising companies, and performs static analysis to manually identify the package name of the advertising library as the advertising library feature code. The advertising library feature code, that is, the advertising library package name, is used to uniquely identify the advertising library introduced in the application. The identification results are as follows: Figure 4 shown.
[0087] After identifying the ad library signature code, find the introduced ad library code in the application source code, and then find the sensitive permissions that the ad library can use. The steps are as follows:
[0088] Step 1: traverse the source file path to find the file set identified by the advertisement library feature code;
[0089] Step 2: Traverse the ad library file collection and match the permission-class table
[0090] Step 3: Output the sensitive permissions of the ad library;
[0091] Mobile anonymous ad protection optimizes folder and file traversal. The rules are as follows:
[0092] Rule 1: Identify whether the permission list document contains INTERNET permission, if yes, terminate the traversal;
[0093] Rule 2: Ignore system library folders during file and folder traversal;
[0094] After the traversal is completed, the ad library-permission table is stored in the form of an XML configuration file. The logical result is as follows Figure 5 shown.
[0095] (II) Implementation of dynamic monitoring module
[0096] The dynamic monitoring module dynamically captures the call stack during the running of the application to identify whether the current sensitive call comes from the advertising library. Considering that this process needs to run for a long time, it is implemented using Service services. However, traditional Service services need to be started manually before they can run, and the Android system cannot control which services developers start during the running of the application, so this application is implemented using system services. A new Java system service is added for dynamic monitoring, and the framework layer API calls the service to obtain the identification result, and the service can run for a long time in the Android system.
[0097] Android system services usually have a manager class and a system service class, and the two implement inter-process communication through the aidl class. In order to dynamically monitor the source of privileged function calls, the system service class
[0098] Therefore, modify the Android application framework layer source code, add the IAnonymize.aidl file, the AnonymizeService.java file to implement the interface defined in IAnonymize.aidl, and the AnonymizeManager.java file for other services or applications to call.
[0099] AnonymizeService parses the ad library-permission table identified by the static parsing module and stores it in the ad library feature code array; uses the Android system's custom CallStackTrace exception class to perform stack tracing on the privileged method belonging class, takes the current top stack element and uses the ad library feature code to identify whether the current call comes from the ad library. If so, returns a Boolean value of true to mark the current permission call return result.
[0100] Since the time consumed by the dynamic monitoring module is the additional time added to the application running, it is necessary to reduce this time overhead as much as possible. Therefore, the more efficient event-based pull parsing method is used when parsing the advertising library-permission table. The traditional DOM parsing method requires reading the XML file into the memory first, and then traversing the file for processing. Obviously, this method will consume memory and affect the operation of the mobile device; in addition, if the advertising library-permission table is relatively large, the efficiency of using the DOM parsing method is low, and the delay caused to the application running will also increase. When capturing the call stack, the Android system custom exception class is used for stack tracing, so exceptions should be actively thrown, but no exception handling is performed. The call chain of the privileged method is recorded in detail in the stack trace, and each record is in the form of "package name. class name. function name". The tail of the call chain is also the top of the privileged method call stack, which identifies the source of the current call request to the privileged method. The package name in the call information record at the top of the stack is matched with the advertising library feature code array. If the package name is included in the feature code array, the current call is initiated by the advertising library code, and the dynamic monitoring process of the privileged method is realized.
[0101] Start the custom system service AnonymizeService when the Android system starts, register the service to the system service startup process, and modify the SystemServer.java file to add the custom service to the process;
[0102] Next, create a new management class AnonymizeManager to call the methods in the service. The member variables in this class are the custom system service anonymous ad protection Service. Get the service instance in the constructor of the management class so that you can use the methods in the service in the member functions of the management class. Finally, register it in the system service, bind AnonymizeManager and Anonymize_SERVICE through the IBinder mechanism, and implement the management class to call the methods in the system service using the aidl interface.
[0103] (III) Implementation of anonymous protection module
[0104] The anonymous protection module plays a role in data protection. Since the mobile advertising library may actively collect user privacy information or device sensitive information, and the mobile advertising library only needs network permissions to implement its advertising delivery function, this application targets dangerous permission method calls identified in the static analysis module, and uses the anonymous advertising protection Service in the dynamic monitoring module to capture the current function call stack. If the call result at the top of the stack comes from the advertising library (identified by the advertising library feature code), the custom anonymous rules are applied to process the result and return it to the advertising library.
[0105] The anonymous rule is processed at the granularity of Java data types. The information fed back to the advertising library must be de-privatized, and it must be difficult for the advertising server to reversely infer the original information from the feedback information. Therefore, for basic data types, this application improves the PBKDF2 encryption hash algorithm to meet the requirements. The algorithm uses SecureRandom to generate salt to attach to the end of the original information, and hashes the attached information before returning it to the advertising server. The highly randomized value of SecureRandom is attached to the original information, so that the value sent to the advertising server each time is different, reducing the possibility of the advertising server tracking users based on a specific unchanging value. After the salt value is attached and hashed, the string no longer has the characteristics of obviously exposing user privacy, protecting fine-grained user privacy information from being exposed in the advertising network. For the data cursor obtained by calling the query method in the ContentProvider component, an anonymous protection form is used to clear the cursor data. In addition, the Object type is the parent class of all data types. For the composite types in Android, they are also anonymized to NULL. The implementation of the anonymous rule is achieved by function overloading. When the AnonymizeService system service in the dynamic monitoring module recognizes that the current function caller is the advertising library, the overloaded function is called to anonymize the call result and then return it.
[0106] When querying data through the ContentProvider class, it does not interact directly with the Provider, but communicates with the Provider through the ContentResolver object. The request time series process is: call getContentResolver().query(Uri,String,String,String,String), which calls the query method in ContentResolver. When the request method is called, ContentResolver parses the URI in the parameter and extracts the authorization authority field, which uniquely identifies the ContentProvider object in Android. ContentResolver guides the request to the ContentProvider object registered with the authority, and then calls the query method in it to obtain data. After calling the request method in ContentProvider, a Cursor object will be returned, which encapsulates the query result set.
[0107] The anonymous protection module registers the anonymous advertising protection Service system service in the ContentResolver class for processing. First, it obtains the AnonymizeService system service instance in the constructor of the ContentResolver class, and returns the disturbed anonymous data when it is identified as an advertising library call in the query operation.
[0108] The MatrixCursor type inherits the AbstractCursor class. The AbstractCursor class finally implements the Cursor interface and uses the MatrixCursor class to return the result. The Cursor object returned by the MatrixCursor class in anonymous protection is the result of querying the empty table, which is returned to the upper layer to avoid leakage of user privacy information.
[0109] This application adds a customized anonymous advertising protection Service system service in the dynamic monitoring module to TelephonyManager, and obtains the service in the constructor of TelephonyManager. The class diagram and construction method of the modified TelephonyManager are as follows: Figure 6 shown.
[0110] During the running of the application, the ad library code obtains the device ID and sends it to the ad server when the ad view is initialized. The system service AnonymizeService dynamically monitors the call stack information. The isAdsCaller() method in the AnonymizeService system service reads the top data of the stack and matches it with the ad library feature code, identifying that the current call comes from the ad library. The ad library call result is anonymized by the function overload, and the salt value is added to the original data to calculate the hash value and then returned.
[0111] 3. Experiment and Analysis
[0112] The anonymous advertising protection method for mobile phones is tested and evaluated in actual applications to verify whether it can effectively protect fine-grained privacy information from being accessed by the advertising SDK using the host application permissions, and whether the consumption of device resources by introducing this method will significantly affect the overall performance of the device.
[0113] (I) Test environment
[0114] The modified source code is used to recompile and start the Android simulator to conduct a system test of the mobile phone anonymous advertising protection. Because the test environment is an emulator encapsulated with Android source code, the BurpSuite penetration testing tool is used, which can intercept the network traffic of the client and server. The test application is the threat instance EaseWeb.
[0115] (II) Test process and result analysis
[0116] Add a listening proxy in the BurpSuite tool to obtain network transmission data packets, set InterceptClientRequests, and set the matching URL to the IP address of the advertising server. Next, set the network proxy for the Android emulator to specify that the emulator data packets are input and output from a specific port. In the "Setting" of the emulator network proxy setting, set the proxy "Proxy" and port "Port" in the emulator. Note that the "Proxy" and "Port" settings must be consistent with the previous "BurpSuite" tool settings. After the Android emulator network proxy is set, enter the adbinstallEaseWeb.apk command in the terminal to install the test application in the emulator. Then select the Interceptison option in the Intercept tab in the BurpSuite tool.
[0117] Select the Forward button and the network request will be fully transmitted to the ad server. Run the test application multiple times and the hashed IMEI device numbers received by the ad server are different, which further verifies the effectiveness of the anonymity protection module.
[0118] From the screenshot of the data received from the ad server, we can see that the ad SDK in the test application EaswWeb obtains the IMEI number of the device when the application is running. Parsing the ad SDK source code shows that the ad library obtains the instance object of TelephonyManager protected by the READ_PHONE_STATE permission in its code, and obtains the Android simulator device number through the getDeviceld method of the object.
[0119] The anonymous ad protection system service learned during the dynamic operation of its application that the current device IMEI is accessed by the ad library package (the package name is recorded in the ad library feature code), so it called the anonymous protection module, so that the current device IMEI is anonymously protected as a hashed string and returned to the ad server. This verifies the effectiveness of the anonymous ad protection method for mobile phones.
[0120] Next, repeat the above process in the simulator that is compiled and run after the native Android source code without the mobile phone anonymous advertising protection method is used in the same way to further verify that the mobile phone anonymous advertising protection method works in actual applications. Similarly, after configuring the BurpSuite proxy and the Android simulator proxy, start intercepting client requests.
[0121] In summary, the mobile phone anonymous advertising protection method can effectively identify the source of visitors to the current sensitive resources, effectively anonymize the sensitive data accessed by the advertising library using the permissions of the host application, and does not affect the operation of the application and the normal delivery of the advertising library, and reasonably maintains the privacy of user information.
[0122] (III) Performance evaluation
[0123] In order to verify that the anonymous advertising protection method for mobile phones can be practical and reasonably effective in actual environments, this application tested the accuracy of the static analysis module and detected the time overhead caused by the addition of system service monitoring.
[0124] 1. Static analysis module accuracy test
[0125] The static analysis module is to match and identify the ad library-permission table according to the ad library feature code and the permission-class table after decompiling the APK file. Since the reverse calculation module will be affected by the selected decompilation tool and the size of the APK file during operation, no time overhead test is performed. This application focuses more on the false positives and false negatives of identifying the number of ad libraries using the ad library feature code in the static analysis module.
[0126] At the beginning of the experiment, 10 applications with the "embedded ads" field were randomly downloaded from 19 application categories in the Android market, totaling 190 applications. The statistical information of the number of popular mobile ad libraries contained in the applications identified after processing by the static analysis module is as follows: Figure 7 shown.
[0127] Next, we used apktool+dex2jar tools to batch decompile the above 190 applications, and used the jd-gui graphical tool to review and identify the ad library feature code. There was no underreporting in the static analysis module.
[0128] 2. New service detection time overhead analysis
[0129] In order to analyze the time overhead introduced by mobile anonymous advertising protection during the actual application running process, the time overhead analysis is performed according to the following steps.
[0130] First, modify the ad library SDK to add a system timing method to calculate the time to get the return result. Call the NanoTime function, and its return result is the current state value of the system timer in nanoseconds, so the elapsed time can be calculated more accurately.
[0131] Next, the modified ad library code is packaged into a jar and re-imported into the EaseWeb test application. Then it is run several times in an Android simulator generated by compiling the native Android source code without adding the mobile anonymous ad protection method and an Android simulator with the mobile anonymous ad protection method, and the 20 relatively stable calculation results are selected in the Log log for recording and analysis.
[0132] In order to determine the impact of the modified system on the application calling the framework layer method, another test application was created, and the application package name was not recorded in the ad library feature code. Then it was run several times in the native Android simulator and the Android simulator with the mobile anonymous ad protection method added. The time overhead caused by the mobile anonymous ad protection method when the application calls is in the millisecond level, and it will not block the application to a large extent. The time overhead is reduced through algorithm optimization.
Claims
1. An advertisement protection method under privacy protection of an Android mobile phone, characterized in that: Combined with the threat of permission inheritance access in the mobile advertising ecosystem, a method for protecting anonymous mobile advertising based on data perturbation is established. In order to identify the advertising library in the application, what privileges the advertising library code has, and how to identify the current call source during the application running process, a method combining static program parsing and dynamic operation monitoring is proposed. The advertising library feature code is used to identify the privileged call source in the function call stack, and then a data perturbation-based method is used to perform fuzzy calculations on the privileged calls of the advertising library. Different anonymous rules are used for different data types to anonymize the access results, so as to solve the infringement of user privacy by the advertising library. Mobile phone anonymous advertising protection consists of a static parsing module, a dynamic monitoring module and an anonymous protection module. These three parts span the application layer and the application framework layer of the Android system. The static parsing module is divided into three parts: reverse calculation, permission mapping and matching identification. The static parsing module is responsible for parsing the APK source file and building the advertising library-permission table. The dynamic monitoring module adds an Android system service anonymous advertising protection Service, which is started when the Android system starts. The service encapsulates methods for parsing the advertising library-permission table, dynamically capturing function call stacks and identifying the current call source. The anonymous protection module performs data protection on sensitive information accessed by the advertising library. It uses the methods in the anonymous advertising protection Service system service to identify the call source as the advertising library, and then uses different anonymous rules according to different data types to perturb the data and return it to the advertising library to protect user sensitive information. The three modules work together to prevent the advertising SDK from inheriting the host application permissions to access sensitive information.
2. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: Mobile anonymous advertising protection architecture: Restructure the use of permissions to access local resources, and regard the situation where the advertising SDK uses the host application permissions to access local sensitive resources as a permission inheritance access threat. This application constructs a mobile anonymous advertising protection method based on data perturbation from the perspective of dynamically identifying the source of privileged method callers. It adopts a combination of Android static parsing processing and dynamic monitoring. For local application files, static parsing and Android reverse technology are used to parse the mobile application advertising library; for dynamic permission calls of applications, the new system service is used to capture the call stack and combine the static parsing results to perform fuzzy calculations on the call results with data perturbations, preventing the mobile advertising library from abusing the host application to access fine-grained local resources.
3. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: Overall structure: When a user uses an application function, the application layer code in the upper layer of the Android architecture calls the API provided by the framework layer. The application framework layer provides the application layer with interface access to implement code reuse. When the API is called, the call stack is obtained to identify the source of the current access to sensitive resources. The mobile phone anonymous advertising protection method performs static analysis at the application layer and dynamic monitoring at the framework layer, spanning these two levels in the Android architecture. The static parsing module, dynamic monitoring module and anonymous protection module work together to process the access to sensitive resources in the advertising library, specifically including: first, the application is processed by the static parsing module before installation, which parses the access to sensitive resources in the advertising library and builds an advertising library-permission table; second, during the operation of the application, the interface provided by the framework layer is called to achieve resource access or data processing, an anonymous advertising protection system is added to the application framework layer, the current API call stack is obtained for dynamic monitoring, and according to the advertising library-permission table passed by the static parsing module, it is parsed whether the current call comes from the advertising library, and the result is submitted to the anonymous protection module for processing; finally, the anonymous protection module receives the recognition result of the dynamic monitoring module. If the current call comes from the advertising library, the perturbation result is returned to the framework layer API according to the anonymous rule matching, and the framework layer API then feeds back the perturbation result to the program that calls the interface.
4. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: The static parsing module statically parses the application apk file embedded with the mobile advertising library, identifies the feature code of the advertising library, and constructs the advertising library-permission table. The static parsing module consists of three synergistic parts, namely reverse calculation, permission mapping and matching identification. The reverse calculation submodule uses Android static decompilation to reversely convert the apk file into Java source text for subsequent review and analysis; the permission mapping submodule implements the mapping between Android dangerous permissions and key classes, constructs a permission-class table, and provides it to the matching identification submodule for subsequent operations; the matching identification submodule first identifies the advertising library feature code in the Java source file generated by the reverse module, and then matches the Java source file in the package identified by the advertising library feature code with the permission-class table to find out the sensitive permissions exposed by the advertising library, and then obtains all the privileged accesses that may exist in the advertising library according to the permission API mapping list provided by PSCout, and finally generates an advertising library-permission table.
5. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: Dynamic monitoring module structure: This module adds an anonymous advertising protection system in the Android application framework layer to dynamically capture the function call stack and extract the top data of the current function call stack, and compare it with the advertising library-permission table. If the top call method is derived from sensitive permission access of the advertising library, it will be recorded in the advertising library call result and the result will be submitted to the anonymous protection module for processing. If there is no sensitive permission access to the advertising library, the call result will be returned directly to the application layer without any other special processing.
6. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: The static parsing module identifies the sensitive and high-risk permissions contained in the advertising library embedded in the application, and then knows the privileged method calls that may exist in the advertising library. It reverses the source code of the apk through Android decompilation, and then uses the advertising library feature code to identify the advertising library code in the source code. Then, the sensitive permissions contained in the advertising library are matched according to the key classes of accessing sensitive permissions in the advertising library code. It is composed of three parts: reverse calculation, permission mapping, and matching identification. The reverse submodule applies the parsing technology of Android's popular static decompilation to obtain the source code of the application, and provides it to the matching identification module for subsequent processing. The permission mapping submodule constructs a permission-class table for Android high-risk permissions to identify key calls of sensitive permissions in the source code, and the matching identification submodule first collects the package name of the popular mobile advertising library as the mobile advertising library feature code; then uses the feature code field to identify the advertising library code in the application source code; finally, uses the permission-class table to find the sensitive permission calls in the advertising library code. The three submodules work together to finally generate the advertising library-permission table.
7. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: Reverse module implementation: The reverse module obtains the Android application source code to provide it to the matching identification module for processing, uses Android decompilation to batch process application files, and reversely converts the apk file into a java source file; The reverse route selected in this application is the Java route, which adopts the combined use of the dex2jar tool and the jadx tool. The dex2jar tool converts apk format files into jar format, and the jadx tool converts class format files into java format. Both the dex2jar tool and the jadx tool run in command line mode, and the output of the dex2jar command is the input condition of the jar command, and the output of the jar command is the input condition of the jadx command. When building commands, "&&" is used to splice commands, and then they are put into the console for execution to improve the automation performance of the reverse module. The decompilation establishes a thread pool so that multiple threads can be executed simultaneously to further improve the efficiency of the reverse module.
8. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: Implementation of the matching identification module: The matching identification module identifies the ad library feature code, and then matches the sensitive permissions of the ad library code in the application source code according to the ad library feature code and the Android permission-class table, thereby obtaining the privileged function access that may exist in the ad library code; This application considers popular mobile advertising libraries. After removing the aggregation platforms and proxy platforms in the list, it collects all the remaining advertising developer software toolkits provided by mobile advertising companies, and performs static analysis to manually identify the package name of the advertising library as the advertising library feature code. The advertising library feature code, that is, the advertising library package name, is used to uniquely identify the advertising library introduced in the application; After identifying the ad library signature code, find the introduced ad library code in the application source code, and then find the sensitive permissions that the ad library can use. The steps are as follows: Step 1: traverse the source file path to find the file set identified by the advertisement library feature code; Step 2: Traverse the ad library file collection and match the permission-class table Step 3: Output the sensitive permissions of the ad library; Mobile anonymous ad protection optimizes folder and file traversal. The rules are as follows: Rule 1: Identify whether the permission list document contains INTERNET permission, if yes, terminate the traversal; Rule 2: Ignore system library folders during file and folder traversal; After the traversal is completed, the ad library-permission table is stored in the form of an XML configuration file.
9. According to claim 1, the method for protecting advertisements under privacy protection on an Android mobile phone is characterized in that: The dynamic monitoring module dynamically captures the call stack during the running of the application to identify whether the current sensitive call comes from the advertising library. This application is implemented using system services, and a new Java system service is added for dynamic monitoring. The framework layer API calls the service to obtain the identification result, and the service can run in the Android system for a long time; Modify the source code of the Android application framework layer, dynamically monitor the system service class of the privileged function call source, add the IAnonymize.aidl file, the AnonymizeService.java file implements the interface defined in IAnonymize.aidl, and the AnonymizeManager.java file for other services or applications to call; AnonymizeService parses the ad library-permission table identified by the static parsing module and stores it in the ad library feature code array; uses the Android system's custom CallStackTrace exception class to perform stack tracing on the privileged method belonging class, takes the current top element of the stack and uses the ad library feature code to identify whether the current call comes from the ad library. If so, returns a Boolean value of true to mark the current permission call return result; Start the custom system service AnonymizeService when the Android system starts, register the service to the system service startup process, and modify the SystemServer.java file to add the custom service to the process; Next, create a new management class AnonymizeManager to call the methods in the service. The member variables in this class are the custom system service anonymous ad protection Service. Get the service instance in the constructor of the management class so that you can use the methods in the service in the member functions of the management class. Finally, register it in the system service, bind AnonymizeManager and Anonymize_SERVICE through the IBinder mechanism, and implement the management class to call the methods in the system service using the aidl interface.
10. The method for protecting advertisements under privacy protection of an Android mobile phone according to claim 1, characterized in that: Anonymous protection module implementation: For dangerous permission method calls identified in the static analysis module, the anonymous ad protection service in the dynamic monitoring module is used to capture the current function call stack. If the call result at the top of the stack comes from the ad library, the custom anonymous rule is applied to process the result and then returned to the ad library; Based on the PBKDF2 encryption hash algorithm, it is improved. SecureRandom is used in the algorithm to generate salt and append it to the end of the original information. The appended information is hashed and then returned to the advertising server. The highly randomized value of SecureRandom is appended to the original information, so that the value sent to the advertising server each time is different, reducing the possibility of the advertising server tracking users based on a specific unchanging value. After the salt value is appended and hashed, the string no longer has the characteristics of obviously exposing user privacy, protecting fine-grained user privacy information from being exposed in the advertising network. For the data cursor obtained by calling the query method in the ContentProvider component, the cursor data is cleared in an anonymous protection form. For the composite type in Android, it is anonymized to NULL. The implementation of the anonymous rule is realized by function overloading. When the AnonymizeService system service in the dynamic monitoring module recognizes that the current function caller is the advertising library, the overloaded function is called to anonymize the call result before returning. When querying data through the ContentProvider class, the ContentResolver object communicates with the Provider. The request time series process is: call getContentResolver().query(Uri,String,String,String,String). This method calls the query method in ContentResolver. When the request method is called, ContentResolver parses the URI in the parameter and extracts the authorization authority field. This field uniquely identifies the ContentProvider object in Android. ContentResolver guides the request to the ContentProvider object registered with the authority, and then calls the query method in it to obtain data. After calling the request method in ContentProvider, a Cursor object will be returned, which encapsulates the query result set. The anonymous protection module registers the anonymous ad protection service system service in the ContentResolver class for processing. First, it obtains the AnonymizeService system service instance in the constructor of the ContentResolver class, and returns the perturbed anonymous data when it is identified as an ad library call in the query operation; The MatrixCursor type inherits the AbstractCursor class. The AbstractCursor class finally implements the Cursor interface and uses the MatrixCursor class to return the result. The Cursor object returned by the MatrixCursor class in anonymous protection is the result of the empty table query, which is returned to the upper layer to avoid leakage of user privacy information. During the running of the application, the ad library code obtains the device ID and sends it to the ad server when the ad view is initialized. The system service AnonymizeService dynamically monitors the call stack information. The isAdsCaller() method in the AnonymizeService system service reads the top data of the stack and matches it with the ad library feature code, identifying that the current call comes from the ad library. The ad library call result is anonymized by the function overload, and the salt value is added to the original data to calculate the hash value and then returned.
Citation Information
Patent Citations
Access control method for communication between third-party applications supportive to permission mechanism during Android running
CN107133513A
Fine-grained permission management method and system for Android advertisement bank
CN107194277A
Refined enhanced permission control and analysis system of Android platform
CN111709017A
Android application classification authorization method for quantitative judgment of suspicious behaviors
CN113326502A
Dynamic and static combined mobile application privacy security analysis method, system and equipment
CN117610021A
Cited By
Cross-platform advertisement user privacy protection method
CN122655132A
