An Android privacy leakage detection method and system based on machine learning

By using a machine learning-based method, combining static and dynamic analysis, screening key features and using the stacking model to optimize detection, the problem of low Android privacy leak detection efficiency and difficult deployment is solved, and efficient privacy leak detection for a large number of application software is achieved.

CN114996701BActive Publication Date: 2024-08-23BEIJING TIANXIA XINAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210482782.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-05
Publication Date
2024-08-23
Estimated Expiration
2042-05-05

AI Technical Summary

Technical Problem

Existing Android privacy leakage detection methods have problems such as low detection rate, difficulty in deployment, and lack of large-scale detection capabilities, especially when facing a large number of application software.

Method used

Using a method based on machine learning, combined with static analysis and dynamic execution, we use crawlers to obtain samples, screen key features, use AAPT and Xposed frameworks to obtain permissions and API information, One-Hot coding, Stacking model training, and optimize the detection model to improve detection efficiency. .

Benefits of technology

It improves the efficiency and accuracy of Android privacy leakage detection, overcomes the difficulty of static detection in obtaining source code after packing and the low efficiency of dynamic detection, and achieves efficient detection of a large number of application software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114996701B
    Figure CN114996701B
Patent Text Reader

Abstract

An Android privacy leakage detection method based on machine learning performs static and dynamic analysis on Android application software, extracts sensitive permission features and sensitive API features that are highly correlated with privacy leakage, vectorizes the extracted features and inputs them into a Stacking model for training, and finally optimizes the two-layer architecture of the Stacking model to obtain better parameters, which can effectively detect Android application software with privacy leakage risks. The system of this method consists of a data set acquisition module, a key feature selection module, an Android application software feature extraction and preprocessing module, and a Stacking integrated learning and training module. Compared with traditional manual detection methods, the detection efficiency is improved, the problem that static detection cannot obtain the source code after the Android application software is packed is solved, and the deficiency of low dynamic detection efficiency is made up.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to the field of network security technology, and specifically describes an Android privacy leakage detection method and system based on machine learning. [Background technology]

[0002] Android is the most widely used operating system in mobile devices. The popularity of Android phones has promoted the development of Android applications to a certain extent. However, due to the huge number of software and the lack of strict management system in the application market, a large number of applications have not been fully tested for security before being put on the shelves, resulting in a lot of malware flooding the market. At present, users will store a lot of sensitive information in the application software of their mobile phones. The existence of malware makes it very easy for users' sensitive information to be leaked, posing a certain threat to users' privacy and security.

[0003] Android privacy leak detection methods are mainly divided into static analysis detection and dynamic analysis detection. Static analysis analyzes the source code and bytes of application software, but at this stage, developers will pack and confuse malware, resulting in a lower detection rate of static analysis detection methods. Dynamic analysis generally adopts dynamic taint analysis methods. It is no longer necessary to obtain the software source code. It only needs to run the software dynamically to monitor in real time whether the software generates dangerous behaviors. This method can effectively detect the leakage of sensitive information. The disadvantages of dynamic taint analysis are also obvious. This technology requires modifying the Android underlying system source code and needs to be adjusted according to different Android versions, which is not easy to deploy. Traditional Android privacy leak detection is mostly small sample detection, lacking detection methods for large quantities of software for the application market. Therefore, Android privacy leak detection requires more accurate feature extraction methods and better detection models. [Summary of the invention]

[0004] The purpose of the present invention is to provide an Android privacy leakage detection method and system based on machine learning. The method is simple and easy to implement. It can overcome the shortcomings of the existing technology and combine static analysis, dynamic execution and machine learning methods to detect whether application software has the risk of privacy leakage, thereby better protecting the privacy of Android users; the system structure is simple and easy to implement.

[0005] The technical solution of the present invention is a method for detecting Android privacy leakage based on machine learning, characterized in that it comprises the following steps:

[0006] (1) Collect Android application samples and screen for key features related to privacy leakage;

[0007] The Android application software samples in step (1) are composed of two parts; one part is the Android application software obtained from the application store using the crawler method, and the other part is the samples with privacy leakage risks in the list of illegal Android application software released by the Ministry of Industry and Information Technology; and 70% of the sample set is randomly divided as a training data set, and 30% is used as a test set.

[0008] The screening in step (1) specifically refers to: randomly selecting 30% of the sample sets from the collected Android application software samples, collecting Android application software permission information, sorting the Android application software permissions from high to low according to the call frequency, and comparing them with the 24 dangerous level permissions declared by the Android official, determining sensitive permission feature information, selecting APIs (Application Programming Interfaces) related to privacy data and APIs related to sensitive permission feature information, determining sensitive API feature information, and using the screened sensitive permission feature information and sensitive API feature information as the key features of this detection method.

[0009] (2) extracting and processing the features filtered in step (1) and performing vector representation;

[0010] The step (2) specifically refers to: extracting key features of Android application software, using AAPT (Android AssetPackaging Tool) tool to obtain permission information applied for by Android application software, dynamically installing and running Android application software, using Xposed framework for real-time monitoring, intercepting and recording sensitive API feature information of Android application software, and then using One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information.

[0011] The step (2) of using the AAPT tool to obtain permission information specifically refers to: using the "aapt dpermissions" statement in AAPT to obtain the permission list of the Android application software.

[0012] The step (2) uses the Xposed framework to perform real-time monitoring, intercepting and recording the sensitive API feature information of the Android application software, specifically refers to: using Android Studio software to write a Hook module, adding a Log statement to the module, and after the Android application software calls the sensitive API feature information, the module outputs the Log statement for final recording.

[0013] The step (2) of using the One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information specifically refers to: performing a One-Hot vectorization conversion on the extracted sensitive permission feature information of the Android application software and the sensitive API feature information of the Android application software, that is, if the permission information applied for by the Android application software is a sensitive permission, then the vectorization representation is 1 at this time; if no sensitive permission is applied for, then the vectorization representation is 0, and the feature information after the One-Hot vectorization conversion is arranged in the order of the sensitive permission feature information first and the sensitive API feature information later, to form a matrix sequence of size n*1.

[0014] The sensitive permission feature information includes permission features that are frequently requested in benign Android applications and privacy leakage risk applications, dangerous permission features officially declared by Android, and overlapping permission features between the former two.

[0015] The sensitive API feature information includes APIs corresponding to sensitive permissions, APIs that can perform sensitive operations, and APIs related to privacy leakage.

[0016] The Android application software with privacy leakage risk is an Android application software with dangerous level permission characteristics or an Android application software with ordinary level permission that may cause privacy leakage problems; the Android application software with dangerous level permission characteristics is an Android application software that can cause the leakage of user's personal privacy data by obtaining mobile phone device information, and the Android application software with privacy leakage risk will apply for dangerous level permission, use various concealment strategies to trick users into agreeing to authorize permissions beyond the requirements of the software functions, obtain mobile phone device information permissions and SMS-related permissions. Since the mobile phone device information involves the user's personal privacy data, they are all dangerous level permissions and may cause privacy leakage problems; the Android application software with ordinary level permission that may cause privacy leakage problems refers to Android application software that uses malicious software to apply for ordinary level permissions but has privacy leakage risks, such as BLUETOOTH (Bluetooth) permission. Although it is an ordinary level permission, there is still malicious software applying for this permission, resulting in the privacy leakage risk software being able to use Bluetooth to transmit sensitive information, thereby causing the risk of privacy leakage to users.

[0017] (3) Input the feature information vectorized according to step (2) into the Stacking model for training, use the five-fold cross-validation method to reduce the probability of overfitting, optimize the Android privacy leakage detection model, and output the optimized model;

[0018] The Stacking model in step (3) is composed of a two-layer structure. The first layer is a base learner, which is composed of three primary classifiers: logistic regression (LR), naive Bayes (NB) and K-nearest neighbor algorithm (KNN). The second layer is a combined learner, which is composed of a support vector machine algorithm (SVM).

[0019] The 50% verification method in step (3) specifically refers to:

[0020] (3-1) Use three primary classifiers to train the initial training set train and divide the initial training set train into five sets of similar size (t 1 ,t 2 ,t 3 ,t 4 ,t 5 ), four of which are used as training sets i (0<i≤5), the last part is used as the test set test y (0<y≤5);

[0021] (3-2) Use the three primary classifiers in the first layer of the Stacking model to train the training set i (0<i≤5) for training and obtain the final prediction result (p 1 ,p 2 ,p 3 ,p 4 ,p 5 ), which is also used as the training set train for the secondary classifier m (0<m≤5); Similarly, three primary classifiers are used to classify the test set test n (0<n≤3) to predict and get T 1 , T 2 , T 3 Results: Combine each result after predicting the training set and the test set to get a new training set train 3 and test set test 2 , whose combination is shown in formula (1);

[0022]

[0023] (3-3) performing step (3-2) five times, using the five sets divided in step (3-1) as test sets one by one, and finally generating five training sets and five test sets;

[0024] (3-4) The training set and test set generated in step (3-2) are combined as the training set and test set of the second layer combined learner of the Stacking model respectively;

[0025] (3-5) The second layer combined learner is a support vector machine model. The training set generated by the first layer is used to optimize the model, and the test set generated by the first layer is used for training. The combination is shown in formula (2).

[0026]

[0027] (4) According to step (2), the sensitive permission feature information and sensitive API feature information applied for by the Android application software are extracted, and combined with the optimized model obtained in step (3), Android privacy leakage detection is performed to determine whether the application software has the risk of privacy leakage. If the model detection result is "1", it means that the Android application software has the risk of privacy leakage; if the model detection result is "0", it means that the Android application software does not have the risk of privacy leakage.

[0028] An Android privacy leakage detection system for implementing the above method is characterized in that it includes a data set acquisition module, a key feature selection module, an Android application software feature extraction and preprocessing module and a Stacking integrated learning and training module; wherein the data set acquisition module is used to obtain the required Android application software samples; the key feature selection module is used to screen permissions and API features; the Android application software feature extraction and preprocessing module is used to extract and process information from Android application software; the Stacking integrated learning and training module inputs the feature information processed by the Android application software feature extraction and preprocessing module into the model for training, and optimizes the Android privacy leakage detection model, outputs the optimized model, and uses the optimized model to perform Android privacy leakage detection to determine whether the application software has the risk of privacy leakage, so as to verify the final effect.

[0029] The working principle of the present invention is as follows: the Android privacy leakage detection method based on machine learning first decompiles the Android application software and statically extracts sensitive permission feature information. Then, when the Android application software is running, the sensitive API feature information is dynamically detected, the acquired data is processed, vectorized, trained using the Stacking ensemble learning algorithm model, and optimized to obtain a better model structure, which can effectively detect Android application software with privacy leakage risks.

[0030] Advantages of the present invention: Compared with the traditional manual detection method, the Android privacy leakage detection method based on machine learning improves the detection efficiency, solves the problem that static detection cannot obtain the source code after the Android application software is shelled, and makes up for the deficiency of low efficiency of dynamic detection.

Brief Description of the Drawings

[0031] Figure 1 This is a flow chart of an Android privacy leakage detection method based on machine learning involved in the present invention.

[0032] Figure 2 This is a flow chart of feature extraction in an Android privacy leakage detection method based on machine learning involved in the present invention.

[0033] Figure 3 This is a schematic diagram of a Stacking algorithm in an Android privacy leakage detection method based on machine learning involved in the present invention. [Specific implementation method]

[0034] Embodiment: A method for detecting Android privacy leakage based on machine learning, characterized in that it comprises the following steps:

[0035] (1) Collect Android application samples and screen for key features related to privacy leakage;

[0036] Among them, the Android application software samples are composed of two parts; one part is the Android application software obtained from the application store using the crawler method, and the other part is the samples with privacy leakage risks in the list of illegal Android application software released by the Ministry of Industry and Information Technology; and 70% of the sample set is randomly divided as the training data set and 30% as the test set.

[0037] A 30% sample set is randomly selected from the collected Android application software samples, and the Android application software permission information is collected. The Android application software permissions are sorted from high to low according to the call frequency, and compared with the 24 danger-level permissions declared by the Android official to determine the sensitive permission feature information, select APIs related to privacy data and APIs related to sensitive permission feature information, determine the sensitive API feature information, and use the screened sensitive permission feature information and sensitive API feature information as the key features of this detection method.

[0038] (2) Extract and process the features filtered in step (1) and perform vector representation: extract the key features of the Android application software, use the AAPT tool to obtain the permission information applied for by the Android application software, that is, use the "aapt d permissions" statement in AAPT to obtain the permission list of the Android application software, dynamically install and run the Android application software, use the Xposed framework for real-time monitoring, intercept and record the sensitive API feature information of the Android application software, and then use the One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information.

[0039] Using the Xposed framework for real-time monitoring, intercepting and recording the sensitive API feature information of Android applications specifically means: using Android Studio software to write a Hook module, adding a Log statement to the module, and after the Android application calls the sensitive API feature information, the module outputs the Log statement for final recording.

[0040] Using the One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information specifically means: performing One-Hot vectorization conversion on the extracted sensitive permission feature information and sensitive API feature information of the Android application software, that is: if the permission information applied for by the Android application software is sensitive permission, then the vectorization representation is 1 at this time; if no sensitive permission is applied for, then the vectorization representation is 0, and the feature information after the One-Hot vectorization conversion is arranged with the sensitive permission feature information in front and the sensitive API feature information in the back, forming an n*1 size matrix sequence.

[0041] The sensitive permission feature information includes permission features that are frequently requested in benign Android applications and privacy leakage risk applications, dangerous permission features officially declared by Android, and overlapping permission features between the former two.

[0042] The sensitive API feature information includes APIs corresponding to sensitive permissions, APIs that can perform sensitive operations, and APIs related to privacy leakage.

[0043] The Android application software with privacy leakage risk is an Android application software with dangerous level permission characteristics or an Android application software with ordinary level permission that may cause privacy leakage problems; the Android application software with dangerous level permission characteristics is an Android application software that can cause the leakage of user's personal privacy data by obtaining mobile phone device information, and the Android application software with privacy leakage risk will apply for dangerous level permission, use various concealment strategies to trick users into agreeing to authorize permissions beyond the requirements of the software functions, obtain mobile phone device information permissions and SMS-related permissions. Since the mobile phone device information involves the user's personal privacy data, they are all dangerous level permissions and may cause privacy leakage problems; the Android application software with ordinary level permission that may cause privacy leakage problems refers to Android application software that uses malicious software to apply for ordinary level permissions but has privacy leakage risks, such as BLUETOOTH (Bluetooth) permission. Although it is an ordinary level permission, there is still malicious software applying for this permission, resulting in the privacy leakage risk software being able to use Bluetooth to transmit sensitive information, thereby causing the risk of privacy leakage to users.

[0044] (3) Input the feature information vectorized according to step (2) into the Stacking model for training, use the five-fold cross-validation method to reduce the probability of overfitting, optimize the Android privacy leakage detection model, and output the optimized model;

[0045] The Stacking model consists of a two-layer structure. The first layer is the base learner, which is composed of three primary classifiers: logistic regression, naive Bayes and K-nearest neighbor algorithm. The second layer is the combined learner, which is composed of the support vector machine algorithm.

[0046] The 50% off verification method specifically refers to:

[0047] (3-1) Use three primary classifiers to train the initial training set train and divide the initial training set train into five sets of similar size (t 1 ,t 2 ,t 3 ,t 4 ,t 5 ), four of which are used as training sets i (0<i≤5), the last part is used as the test set test y (0<y≤5);

[0048] (3-2) Use the three primary classifiers in the first layer of the Stacking model to train the training set i (0<i≤5) for training and obtain the final prediction result (p 1 ,p 2 ,p 3 ,p 4 ,p 5 ), which is also used as the training set train for the secondary classifier m (0<m≤5); Similarly, three primary classifiers are used to classify the test set test n (0<n≤3) to predict and get T 1 , T 2 , T 3 Results: Combine each result after predicting the training set and the test set to get a new training set train 3 and test set test 2 , whose combination is shown in formula (1);

[0049]

[0050] (3-3) performing step (3-2) five times, using the five sets divided in step (3-1) as test sets one by one, and finally generating five training sets and five test sets;

[0051] (3-4) The training set and test set generated in step (3-2) are combined as the training set and test set of the second layer combined learner of the Stacking model respectively;

[0052] (3-5) The second layer combined learner is a support vector machine model. The training set generated by the first layer is used to optimize the model, and the test set generated by the first layer is used for training. The combination is shown in formula (2).

[0053]

[0054] (4) According to step (2), the sensitive permission feature information and sensitive API feature information applied for by the Android application software are extracted, and combined with the optimized model obtained in step (3), Android privacy leakage detection is performed to determine whether the application software has the risk of privacy leakage. If the model detection result is "1", it means that the Android application software has the risk of privacy leakage; if the model detection result is "0", it means that the Android application software does not have the risk of privacy leakage.

[0055] An Android privacy leakage detection system for implementing the above method is characterized in that it includes a data set acquisition module, a key feature selection module, an Android application software feature extraction and preprocessing module and a Stacking integrated learning and training module; wherein the data set acquisition module is used to obtain the required Android application software samples; the key feature selection module is used to screen permissions and API features; the Android application software feature extraction and preprocessing module is used to extract and process information from Android application software; the Stacking integrated learning and training module inputs the feature information processed by the Android application software feature extraction and preprocessing module into the model for training, and optimizes the Android privacy leakage detection model, outputs the optimized model, and uses the optimized model to perform Android privacy leakage detection to determine whether the application software has the risk of privacy leakage, so as to verify the final effect.

[0056] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation method of the present invention is further explained below in conjunction with the drawings and examples.

[0057] The present invention provides an Android privacy leakage detection method based on machine learning, such as Figure 1-Figure 3As shown in the figure. After obtaining the Android application sample, the Android application is statically analyzed to extract sensitive permission feature information. Then the Android application is installed in the improved simulator, and the Android application is dynamically executed and tested to trigger various input events. The Xposed framework monitors the Android application in real time, intercepts and records sensitive API feature information, and vectorizes the feature information. The Stacking integrated algorithm is used to train the model, perform privacy leakage detection on the Android application, and obtain the final result.

[0058] The present invention uses a crawler method to obtain benign samples in the public application market. The samples with privacy leakage risks come from the list of illegal Android application software released by the Ministry of Industry and Information Technology, and randomly divide 70% of the data set as a training data set and 30% as a test set. This example is used to illustrate the working part of the Android privacy leakage detection method based on machine learning.

[0059] The first part is to filter feature information related to privacy leakage. Generally, Android applications apply for many permissions to ensure the normal operation of Android applications. If all permission features are input into the training model, it will cause poor model training effect or overfitting. Therefore, it is necessary to filter key features and input the model to achieve better classification effect.

[0060] Google has designed a series of permission labels for the Android system that involve security operations and privacy information. If an application needs to access user privacy data or perform other security-related operations, the developer needs to declare the corresponding permissions in its configuration file AndroidMainfest.xml.

[0061] Android officially provides a total of 183 permission features, and declares 24 of them as dangerous permissions. Android applications with privacy leakage risks will use various concealment strategies to trick users into agreeing to authorize permissions beyond the program functions. After statistical analysis, it is found that many Android applications with privacy leakage risks will apply for dangerous permissions, such as obtaining mobile device information permissions and SMS-related permissions. Among them, mobile device information involves users' personal privacy data, so dangerous permissions will cause privacy leakage problems. Ordinary permissions can also cause privacy leakage problems. Statistical analysis shows that although BLUETOOTH permissions are ordinary permissions, there are still a large number of malicious software that apply for this permission. Privacy leakage risk software can use Bluetooth to transmit sensitive information, causing privacy leakage risks to users. Therefore, this method selects permissions that are frequently applied for in benign applications and privacy leakage risk applications as part of the key features, compares them with the 24 dangerous permission features declared by Android, and takes the union of the two parts as the sensitive permission feature information of this method.

[0062] Determine sensitive API feature information. The Android system provides tens of thousands of API interfaces. Compared with permissions, APIs can reflect the various behaviors of Android applications in a more fine-grained manner, and at the same time, the accuracy is higher. All behaviors of Android applications are implemented by APIs, so some sensitive API feature information can be used as a basis for judging whether the application is malicious. If all existing Android APIs are monitored, the feature dimension is huge, which will greatly reduce the detection efficiency, so this method screens the APIs. It is mainly divided into three categories:

[0063] (1) APIs related to sensitive permissions. In order to protect users’ sensitive data, the Android system has designed a permission mechanism. If an application wants to obtain certain sensitive information or perform certain sensitive operations, it needs to apply for permissions. Extract APIs related to sensitive permissions.

[0064] (2) APIs related to privacy leakage: Define the scope of privacy data according to the "Personal Information Security Specification" issued by the Ministry of Industry and Information Technology, and select the APIs most relevant to privacy data.

[0065] (3) APIs related to sensitive operations. In addition to the above two operations that may lead to sensitive information leakage, this method also summarizes the following three situations that may lead to sensitive information leakage:

[0066] Intent privacy leakage: Android applications with privacy leakage risks will use Intent components to communicate, intercept sensitive information, and then lead to private data leakage.

[0067] I / O reading system files: When Android applications execute system events, they will generate log files, which store a lot of sensitive data. Malware can access log files through API interfaces, which will eventually lead to privacy leaks.

[0068] Dynamically loaded code: Some Android applications will dynamically load malicious code during operation. Privacy leakage behavior can also be hidden in the dynamically loaded external code, thus creating the risk of privacy leakage.

[0069] The second part is to extract the feature information of Android application software and perform preprocessing.

[0070] Extract the key feature information of Android application software. The overall process is as follows Figure 2 As shown. First, extract sensitive permission feature information and use the AAPT tool to obtain the permission list that the Android application software wants to apply for. Use the "aapt dump bading" statement to obtain the package name of the Android application software, and use the "aapt d permissions" statement to obtain the permission information of the Android application software.

[0071] Use cmd command line to automatically install Android application software. This method uses Monkey tool to automatically test Android application software. This method is based on Xposed framework to hook API functions called by Android application software during dynamic operation. This framework can replace function interface in a non-invasive way, and can also insert code before or after function call, which can be used for dynamic analysis and detection.

[0072] First, use Android Studio software to write a Hook module for the selected sensitive API feature information and add Log statements to the module. Then, detect the Android applications in the sample library. After the Android application calls the sensitive API feature information, the module outputs Log statements to obtain the software behavior generated during the operation of the Android application and finally uninstall the Android application.

[0073] Some malware will detect the running environment of Android applications. If it detects that the running environment is an emulator, it will crash. Currently, Android applications mainly detect the relevant information of the running device, such as whether the running device has an IMEI and whether the architecture is ARM. This method uses the Hook technology of the Xposed framework to complete the relevant information of the device, thereby avoiding the software's detection of the running environment. In view of the problem that some Android applications will detect whether the running environment contains the Xposed framework, this method confuses the libraries related to Xposed and modifies the return values ​​of some interfaces of the PackageManager class to achieve the purpose of hiding Xposed.

[0074] The third part is to establish and implement the Stacking ensemble learning detection model. This method uses the Stacking algorithm, which is a heterogeneous ensemble. The algorithm combines multiple learners to improve the generalization performance of the classifier. Compared with single classifiers and homogeneous ensemble learning, the Stacking classification method has higher accuracy.

[0075] During the Stacking training process, the secondary training set is generated by the primary learner. In order to reduce the probability of overfitting, a five-fold cross-validation method is adopted. The five-fold validation method divides the initial training set into five sets of similar size, selects one set as the test set, and the remaining four are training sets. Use three base learners to train the model on the training set in the five-fold cross-validation to generate a part of the secondary training set; then use three base learners to predict the test set in the five-fold cross-validation to generate a part of the secondary test set. Repeat the above steps to finally generate five training sets and test sets. The training set and test set of each part are merged as the training set and test set of the second-layer combined learner. The second layer builds a support vector machine model, uses the training set generated by the first layer to optimize the model, and uses the test set generated by the first layer for prediction.

[0076] For the Stacking method, the quality of classification depends on the choice of classifier. It is necessary to ensure the accuracy of the primary classifier and the diversity of the classifier. Based on the above considerations, the primary classifier of this method selects the Naive Bayes (NB), Logistic Regression (LR) and K-Nearest Neighbor (KNN) algorithms, and the secondary classifier selects the Support Vector Machine (SVM) algorithm. The overall model is shown in the figure below. Figure 3 shown.

[0077] The specific implementation process of the model is as follows:

[0078] (1) The stacking model predicts the label column of the training set, but this method may cause overfitting. Therefore, this work adopts a five-fold cross-validation method to solve this problem. Three primary classifiers (NB, LR, KNN) are used to train the training set train. The entire training set train is divided into five parts (t 1 ,t 2 ,t 3 ,t 4 ,t 5 ), four of which are used as training sets i (0<i≤5), the last part is used as the test set test y (0<y≤5). Use three primary classifiers (NB, LR, KNN) to train i (0<i≤5) for training and obtain the final prediction result (p 1 ,p 2 ,p 3 ,p 4 ,p 5 ), which is also the training set train of the secondary classifier m (0<m≤5). nt(0<n≤3) is used for prediction, and T is obtained. 1 , T 2 , T 3 As a result, each result is combined to get a new training set train 3 and test set test 2 .

[0079]

[0080] (2) Next, use the secondary classifier support vector machine to train 3 Perform model training and test the test set 2 Make predictions and get the final results.

[0081]

[0082] The fourth part uses the optimized model to detect Android privacy leaks. First, the permission feature information and API feature information of the Android application are extracted, compared with the sensitive permission feature information and sensitive API feature information, vectorized, and input into the optimized model to determine whether the Android application has the risk of privacy leakage. The model detection result is "1", which means that the Android application has the risk of privacy leakage; the model detection result is "0", which means that the Android application does not have the risk of privacy leakage.

[0083] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for detecting Android privacy leakage based on machine learning, characterized in that: The following steps are involved: (1) Collect Android application samples and screen for key features related to privacy leakage; (2) extracting and processing the features filtered in step (1) and performing vector representation; (3) Input the feature information vectorized according to step (2) into the Stacking model for training, use the five-fold cross-validation method to reduce the probability of overfitting, optimize the Android privacy leakage detection model, and output the optimized model; (4) extracting sensitive permission feature information and sensitive API feature information involved in the Android application software according to step (2), and performing Android privacy leakage detection in combination with the optimized model obtained in step (3) to determine whether the application software has the risk of privacy leakage. If the model detection result is "1", it means that the Android application software has the risk of privacy leakage; if the model detection result is "0", it means that the Android application software does not have the risk of privacy leakage; The step (2) specifically includes: extracting key features of the Android application software, using the AAPT tool to obtain the permission information applied for by the Android application software, dynamically installing and running the Android application software, using the Xposed framework for real-time monitoring, intercepting and recording the sensitive API feature information of the Android application software, and then using the One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information; The Stacking model in step (3) is composed of a two-layer structure. The first layer is a base learner, which is composed of three primary classifiers: logistic regression, naive Bayes and K-nearest neighbor algorithm. The second layer is a combined learner, which is composed of a support vector machine algorithm.

2. According to the Android privacy leakage detection method based on machine learning as described in claim 1, it is characterized in that The Android application software samples in step (1) are composed of two parts; one part is the Android application software obtained from the application store using the crawler method, and the other part is the samples with privacy leakage risks in the list of illegal Android application software released by the Ministry of Industry and Information Technology; And randomly divide 70% of the sample set as the training data set and 30% as the test set.

3. According to the Android privacy leakage detection method based on machine learning as described in claim 1, it is characterized in that The screening in step (1) specifically refers to: randomly selecting 30% of the sample sets from the collected Android application software samples, collecting Android application software permission information, sorting the Android application software permissions from high to low according to the call frequency, and comparing them with the 24 dangerous level permissions declared by the Android official, determining sensitive permission feature information, selecting APIs related to privacy data and APIs related to sensitive permission feature information, determining sensitive API feature information, and using the screened sensitive permission feature information and sensitive API feature information as the key features of this detection method.

4. According to the Android privacy leakage detection method based on machine learning as described in claim 1, it is characterized in that The use of the AAPT tool to obtain permission information specifically refers to: using the "aapt dpermissions" statement in AAPT to obtain the permission list of the Android application software; The use of the Xposed framework for real-time monitoring, intercepting and recording the sensitive API feature information of the Android application software specifically refers to: using the Android Studio software to write a Hook module, adding a Log statement to the module, and after the Android application software calls the sensitive API feature information, the module outputs the Log statement for final recording; The use of the One-Hot encoding method to vectorize the intercepted sensitive permission feature information and sensitive API feature information specifically refers to: performing One-Hot vectorization conversion on the extracted sensitive permission feature information of the Android application software and the sensitive API feature information of the Android application software, that is: if the permission information applied for by the Android application software is a sensitive permission, then the vectorization representation is 1 at this time; if no sensitive permission is applied for, then the vectorization representation is 0, and the feature information after the One-Hot vectorization conversion is arranged with the sensitive permission feature information in front and the sensitive API feature information in the back, forming a matrix sequence of size n*1.

5. According to claim 4, a method for detecting Android privacy leaks based on machine learning is characterized in that The sensitive permission feature information includes permission features that are frequently applied for in benign Android applications and privacy leakage risk applications, permission features officially declared dangerous by Android, and overlapping permission features between the former two; The sensitive API feature information includes APIs corresponding to sensitive permissions, APIs that can perform sensitive operations, and APIs related to privacy leakage; The Android application software with privacy leakage risk is an Android application software with dangerous level permission characteristics or an Android application software with ordinary level permissions that may cause privacy leakage problems; the Android application software with dangerous level permission characteristics is an Android application software that can cause the leakage of user personal privacy data by obtaining mobile phone device information, and the Android application software with privacy leakage risk will apply for dangerous level permissions; the Android application software with ordinary level permissions that may cause privacy leakage problems refers to Android application software that uses malicious software to apply for ordinary level permissions but has privacy leakage risks.

6. According to the method for detecting Android privacy leakage based on machine learning in claim 1, it is characterized in that The 50% verification method in step (3) specifically refers to: (3-1) Use three primary classifiers to train the initial training set train, divide the initial training set train into five sets of similar sizes (t1, t2, t3, t4, t5), and use four of them as the training set train i (0 < i ≤ 5), and use the last part as the test set test y (0 < y ≤ 5); (3-2) Use the three primary classifiers in the first layer of the Stacking model to train the training set train i (0 < i ≤ 5), and obtain the final prediction results (p1, p2, p3, p4, p5), which are simultaneously used as the training set train m (0 < m ≤ 5) of the secondary classifier; similarly, use the three primary classifiers to predict the test set test n (0 < n ≤ 3) to obtain the results of T1, T2, and T3; combine each result after predicting the training set and the test set to obtain the new training set train3 and the test set test2, and their combination is shown in formula (1); (3-3) performing step (3-2) five times, using the five sets divided in step (3-1) as test sets one by one, and finally generating five training sets and five test sets; (3-4) The training set and test set generated in step (3-2) are combined as the training set and test set of the second layer combined learner of the Stacking model respectively; (3-5) The second layer combined learner is a support vector machine model. The training set generated by the first layer is used to optimize the model, and the test set generated by the first layer is used for training. The combination is shown in formula (2).

7. An Android privacy leakage detection system for implementing the method described in claim 1, characterized in that: It includes a data set acquisition module, a key feature selection module, an Android application software feature extraction and preprocessing module and a Stacking integrated learning and training module; wherein the data set acquisition module is used to obtain the required Android application software samples; the key feature selection module is used to screen permissions and API features; the Android application software feature extraction and preprocessing module is used to extract and process information from Android application software; the Stacking integrated learning and training module inputs the feature information processed by the Android application software feature extraction and preprocessing module into the model for training, and optimizes the Android privacy leakage detection model, outputs the optimized model, and uses the optimized model to perform Android privacy leakage detection to determine whether the application software has the risk of privacy leakage, so as to verify the final effect.