An encryption system and method applied to Android virtual framework
By designing reinforcement modules and running defense submodules in the Android virtual framework, APK files are reinforced and defended in real time, the security risks caused by the lack of sandbox isolation mechanism of the virtual framework are solved, and effective protection of application code and data is achieved.
Patent Information
- Application Number
- CN202410293031.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-03-14
AI Technical Summary
Android virtual framework lacks an effective sandbox isolation mechanism, which leads to malicious applications that can modify or obtain other applications' codes and files through escalation attacks, which poses security risks.
An encryption system was designed, including a reinforcement module and a running defense submodule, and the APK file is reinforced through the system service simulator, and it is defended in real time at runtime, using code encryption, integrity verification and data encryption and decryption policies to protect the application. Code and data.
It effectively protects the code and data of applications within the virtual framework, prevents malicious applications from obtaining and analyzing, enhances the security of applications, and ensures that important data such as passwords are not cracked.
Smart Images

Figure CN118094597B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mobile security and access control, and more specifically to an encryption system and method applied to an Android virtual framework. Background Art
[0002] Android virtual framework is an application that can simulate and control the runtime environment of Android applications. It can manage the access rights of internal applications to resources such as operating systems, network transmissions and files, so as to customize the permission acquisition of each application. The virtual framework mainly virtualizes the FrameWork layer of the Android system by using Java reflection, proxy, Hook and other technologies to provide a virtual execution environment for applications. In such a virtual space, APK can be installed, started and uninstalled at will. All of this is isolated from the outside, just like a sandbox. APK does not need to be installed externally, so the purpose of dual opening of applications can be achieved. Virtual App is a commonly used Android virtual machine framework on the market. It is a standard sandbox, or "virtual machine", which provides a complete set of internal and external isolation mechanisms, including but not limited to (file isolation / component isolation / process communication isolation). Simply put, the internal is a "completely independent space". Not only can it be "dual opened" inside, but the unique multi-user mode supports users to open the same application unlimitedly inside, which brings great convenience. At the same time, since the internal applications are not really isolated at the level of the Android system, it also brings security risks.
[0003] APK reinforcement technology usually uses an APK decompilation tool to first decompile the APK file of the application to obtain the smali file and the Manifest file, and then uses the shell template to shell the original APK; repackage the shelled APK, decompress the new APK file with a decompression tool, obtain a new DEX file, encrypt the old DEX file, and then obtain a bin file together with the new DEX file, the signature value of the so file and the encryption key, and then put the bin file in the asserts directory, and repackage and sign it together with the shelled smali file and the modified Manifest file to obtain the reinforced APK file. At runtime, the shelled APK is run by secondary loading of the original APK, and the Hook technology is used to restore the hollowed out encrypted content.
[0004] The core design of the virtual framework lies in the App virtualization engine, which uses the Framework layer Hook technology to intercept the Binder and system calls of the system service. When the application in the virtual framework is started or running, it will call system services such as AMS, PMS, etc., but these services are taken over by the container. The container will simulate the functions of the system service, modify the call parameters and perform security checks, and then call the real system service and return the results to the container that called the service.
[0005] There have been many studies on virtual frameworks and their security issues. The concepts of storage isolation and partial permission isolation of applications in virtual frameworks are relatively vague, and there is not even a sandbox isolation mechanism (all applications on Android devices have a file directory placed in a sandbox. Saving files in the sandbox can prevent other applications from accessing it. The full path of the built-in storage sandbox directory is: / data / data / <package name> / , and the sandbox directory of the external storage is: SDCard / Android / data / <package name> / ). A feasible attack method for this security issue is that malicious applications installed in the virtual framework can modify and obtain the code or files of other applications in the framework through privilege escalation attacks, thereby achieving the purpose of attacking other applications in the framework.
[0006] Therefore, it is an urgent problem for those skilled in the art to propose an encryption system and method for Android virtual framework to further enhance the security of code and data applied in the virtual framework. Summary of the invention
[0007] In view of this, the present invention provides an encryption system and method applied to an Android virtual framework to compensate for the security risks brought about by the virtual framework having no sandbox isolation mechanism, so as to further protect the code and data of applications in the framework.
[0008] In order to achieve the above object, the present invention adopts the following technical solution:
[0009] On the one hand, the present invention discloses an encryption system applied to an Android virtual framework, comprising: a reinforcement module connected to a system service simulator in the Android virtual framework, the reinforcement module comprising a mobile terminal reinforcement submodule and a running defense submodule;
[0010] The mobile terminal reinforcement submodule uses the system service simulator to read the APK file path of the target application, extracts the executable file and reinforces the executable file, transmits the reinforced APK path to the system service simulator, and completes the installation of the reinforced APK application;
[0011] The operation defense submodule is used to perform real-time defense when the reinforced APK application is running, and the operation of the reinforced APK application is implemented based on the system service simulator.
[0012] Preferably, the mobile terminal reinforcement submodule includes a file preprocessing unit, a code encryption unit and a reinforcement code integration unit;
[0013] The file preprocessing unit reads the APK file path of the target application from the system service simulator, extracts the executable file from the APK of the target application, and decompiles the executable file to obtain basic information;
[0014] The code encryption unit extracts the address interval of the function to be protected from the encrypted code segment feature library, generates a key, and encrypts the corresponding code segment;
[0015] The reinforcement code integration unit integrates the encrypted code into a new executable file, and reintegrates the new executable file into the original APK to form a reinforced APK, passes the reinforced APK path to the installation function in the system service simulator, and completes the installation of the reinforced APK application.
[0016] Preferably, the operation defense submodule includes a code decryption unit, an integrity verification unit, and a data encryption and decryption strategy implantation unit;
[0017] The code decryption unit is used to reorganize the decryption key and complete the decryption of the protected executable file when the hardened APK application loads the protected executable file;
[0018] The integrity verification unit is used to perform integrity verification on the protected executable file to determine whether the code that calls the target function is legal;
[0019] The data encryption and decryption strategy implantation unit is used to encrypt or decrypt the libc.so function intercepted by the Android virtual framework according to the integrity verification result.
[0020] Preferably, the data encryption and decryption strategy implantation unit is used to encrypt or decrypt the libc.so function intercepted by the Android virtual framework, including:
[0021] When the intercepted libc.so function is a write function, the written content is encrypted using the encryption key;
[0022] When the intercepted libc.so function is a read function, the encrypted content read is decrypted using the decryption key.
[0023] On the other hand, the present invention also discloses an encryption method applied to an Android virtual framework, comprising the following steps:
[0024] S1. Use the system service simulator to read the APK file path of the target application, extract the executable file and reinforce the executable file, pass the reinforced APK path to the system service simulator, and complete the installation of the reinforced APK application;
[0025] S2. Perform real-time defense when the reinforced APK application is running, and the running of the reinforced APK application is implemented based on the system service simulator.
[0026] Preferably, the S1 comprises:
[0027] Reading the APK file path of the target application from the system service simulator, extracting the executable file from the APK of the target application, and decompiling the executable file to obtain basic information;
[0028] Extract the address range of the function to be protected from the encrypted code segment feature library, generate a key, and encrypt the corresponding code segment;
[0029] Integrate the encrypted code into a new executable file, and reintegrate the new executable file into the original APK to form a hardened APK. Pass the hardened APK path to the installation function in the system service simulator to complete the installation of the hardened APK application.
[0030] Preferably, S2 includes:
[0031] When the reinforced APK application loads the protected executable file, the decryption key is reorganized to complete the decryption of the protected executable file;
[0032] Verify the integrity of the protected executable file to determine whether the code that calls the target function is legal;
[0033] The libc.so function intercepted by the Android virtual framework is encrypted or decrypted according to the integrity verification result.
[0034] Preferably, the libc.so function intercepted by the Android virtual framework is encrypted or decrypted according to the integrity verification result, including:
[0035] When the intercepted libc.so function is a write function, the written content is encrypted using the encryption key;
[0036] When the intercepted libc.so function is a read function, the encrypted content read is decrypted using the decryption key.
[0037] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses an encryption system and method for an Android virtual framework. By reinforcing the APK in advance and then installing it, although malicious applications in the framework can access the sandbox directory of the reinforced application, the reinforced application does not have complete DEX and SO files in the file system (sandbox directory, SDcard), which provides good protection for the application code and the data of the application in the virtual framework; important data (important privacy data such as passwords) saved by the application is added with data transparent encryption and decryption functions through the reinforcement module, so that when malicious applications perform static analysis on other applications and obtain privacy data, what they obtain will be some ciphertexts, which are difficult to crack the meaning, thereby protecting the privacy data of application users to a great extent and providing good protection for the application data. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0039] Figure 1 The overall architecture diagram of the encryption system of the present invention applied to the Android virtual framework. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] On the one hand, the embodiment of the present invention discloses an encryption system applied to an Android virtual framework, referring to Figure 1 The system is applied to the APP virtualization engine. The APP virtualization engine implements an Android virtual framework through the framework's virtualization layer, so that the third-party APP inside the virtual framework actually runs on the Android Framework of the virtualization engine. The virtualization engine has intercepted the Binder communication and system call communication requests of its third-party APP, and achieved comprehensive control over the third-party APP through the virtualization layer.
[0042] Specifically, the system includes: a reinforcement module connected to a system service simulator of an APP virtualization engine in an Android virtual framework, the reinforcement module including a mobile terminal reinforcement submodule and a running defense submodule.
[0043] The mobile terminal reinforcement submodule is mainly responsible for obtaining the executable file of the native code from the target application and reinforcing the executable file, including a file preprocessing unit, a code encryption unit and a reinforcement code integration unit.
[0044] Furthermore, the file preprocessing unit is responsible for reading the APK file path of the target application from the VPMS service in the system service simulator, extracting the ELF file from the APK of the target application, and decompiling the ELF file through IDA to obtain basic information such as the function symbol table.
[0045] The code encryption unit extracts the address range of the function to be protected from the encrypted code segment feature library, generates a key, and encrypts the code segment.
[0046] The hardened code integration unit integrates the encrypted code and other codes into a new ELF file, and reintegrates the ELF file into the original APK to form a hardened APK. Finally, the hardened APK path is passed to the installation function in the VPMS service to complete the installation of the hardened APK application.
[0047] The installation of the hardened APK application is ensured that there are no complete DEX and SO files in the file system (sandbox directory, SDcard), which provides good protection for the application code and the data of the application in the virtual framework (this is because the code content in the DEX and SO files is encrypted, so even if the attacker obtains the corresponding files, the files have been encrypted and cannot be analyzed).
[0048] The runtime defense submodule is mainly responsible for protecting the runtime APK. It will be loaded when the hardened APK is running, and provide real-time defense of the native code of the hardened APK during operation.
[0049] Furthermore, the operation defense submodule includes a code decryption unit, an integrity verification unit, and a data encryption and decryption strategy implantation unit;
[0050] The code decryption unit is responsible for reorganizing the decryption key and decrypting the ELF file when the hardened APK loads the protected ELF file.
[0051] The integrity verification unit is responsible for checking the integrity of the ELF file by comparing the signatures when calling the protected function during the execution of the native code to determine whether the code calling the target function is legal.
[0052] It is known that the APP virtualization engine is responsible for intercepting third-party application system function calls, and the data encryption and decryption strategy implantation unit is responsible for encrypting or decrypting the libc.so function intercepted by the APP virtualization engine in the Android virtual framework according to the integrity verification results.
[0053] Specifically, when the code calling the target function is legal, if the write function of libc.so is intercepted, the written content is encrypted by the encryption key, so that the file is saved in the private space of the sandbox environment in the form of ciphertext, so as to make up for the security risks brought by the virtual framework without sandbox isolation mechanism;
[0054] When the read function of libc.so is intercepted, the encrypted content is decrypted using the decryption key to ensure that the plaintext file is in the application memory and the third-party application can run normally.
[0055] On the other hand, the present invention also discloses an encryption method applied to an Android virtual framework, which is applicable to the above encryption system, and the method comprises the following steps:
[0056] S1. Use the system service simulator to read the APK file path of the target application, extract the executable file and reinforce the executable file, pass the reinforced APK path to the system service simulator, and complete the installation of the reinforced APK application;
[0057] S2. Perform real-time defense when the hardened APK application is running. The operation of the hardened APK application is implemented based on the system service simulator.
[0058] Preferably, S1 comprises:
[0059] Read the APK file path of the target application from the system service simulator, extract the executable file from the APK of the target application, decompile the executable file, and obtain basic information such as the function symbol table. The function symbol table is mainly used for corresponding code encryption;
[0060] Extract the address range of the function to be protected from the encrypted code segment feature library, generate a key, and encrypt the corresponding code segment;
[0061] Integrate the encrypted code into a new executable file, and reintegrate the new executable file into the original APK to form a hardened APK. Pass the hardened APK path to the installation function in the system service simulator to complete the installation of the hardened APK application.
[0062] Preferably, S2 comprises:
[0063] When the hardened APK application loads the protected executable file, it reorganizes the decryption key and completes the decryption of the protected executable file;
[0064] Verify the integrity of the protected executable file to determine whether the code that calls the target function is legal;
[0065] The libc.so function intercepted by the Android virtual framework is encrypted or decrypted according to the integrity verification result.
[0066] Preferably, the libc.so function intercepted by the Android virtual framework is encrypted or decrypted according to the integrity verification result, including:
[0067] When the intercepted libc.so function is a write function, the written content is encrypted using the encryption key;
[0068] When the intercepted libc.so function is a read function, the encrypted content read is decrypted using the decryption key.
[0069] In another specific embodiment, an encryption method applied to an Android virtual framework proposed by the present invention is described as follows:
[0070] S10. Read the APK to be installed into the reinforcement module of the virtual framework, and after being reinforced by the reinforcement module, pass the reinforced APK path to the installation function;
[0071] S20. Parse AndroidManifest.xml to obtain APK internal information, including component information, permission information, etc., and serialize this information to disk and memory for later use;
[0072] S30. Prepare the private space of the application in the virtual framework application sandbox environment, and copy some necessary APK and so libs;
[0073] S40. Finally, notify the front desk that the installation is complete.
[0074] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0075] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An encryption system applied to an Android virtual framework, characterized in that: include: A reinforcement module connected to the system service simulator in the Android virtual framework, the reinforcement module including a mobile terminal reinforcement submodule and a running defense submodule; The mobile terminal reinforcement submodule uses the system service simulator to read the APK file path of the target application, extracts the executable file and reinforces the executable file, transmits the reinforced APK path to the system service simulator, and completes the installation of the reinforced APK application; The operation defense submodule is used to perform real-time defense when the reinforced APK application is running, and the operation of the reinforced APK application is implemented based on the system service simulator; The mobile terminal reinforcement submodule includes a file preprocessing unit, a code encryption unit and a reinforcement code integration unit; The file preprocessing unit reads the APK file path of the target application from the system service simulator, extracts the executable file from the APK of the target application, and decompiles the executable file to obtain basic information; The code encryption unit extracts the address interval of the function to be protected from the encrypted code segment feature library, generates a key, and encrypts the corresponding code segment; The reinforcement code integration unit integrates the encrypted code into a new executable file, and reintegrates the new executable file into the original APK to form a reinforced APK, passes the reinforced APK path to the installation function in the system service simulator, and completes the installation of the reinforced APK application.
2. According to claim 1, an encryption system applied to an Android virtual framework is characterized in that: The operation defense submodule includes a code decryption unit, an integrity verification unit, and a data encryption and decryption strategy implantation unit; The code decryption unit is used to reorganize the decryption key and complete the decryption of the protected executable file when the hardened APK application loads the protected executable file; The integrity verification unit is used to perform integrity verification on the protected executable file to determine whether the code that calls the target function is legal; The data encryption and decryption strategy implantation unit is used to encrypt or decrypt the libc.so function intercepted by the Android virtual framework according to the integrity verification result.
3. According to claim 2, an encryption system applied to an Android virtual framework is characterized in that: The data encryption and decryption strategy implantation unit is used to encrypt or decrypt the libc.so function intercepted by the Android virtual framework, including: When the intercepted libc.so function is a write function, the written content is encrypted using the encryption key; When the intercepted libc.so function is a read function, the encrypted content read is decrypted using the decryption key.
4. An encryption method applied to an Android virtual framework, characterized in that: The following steps are involved: S1. Use the system service simulator to read the APK file path of the target application, extract the executable file and reinforce the executable file, pass the reinforced APK path to the system service simulator, and complete the installation of the reinforced APK application; S2. Perform real-time defense when the reinforced APK application is running, and the operation of the reinforced APK application is based on the system service simulator; The S1 includes: Reading the APK file path of the target application from the system service simulator, extracting the executable file from the APK of the target application, and decompiling the executable file to obtain basic information; Extract the address range of the function to be protected from the encrypted code segment feature library, generate a key, and encrypt the corresponding code segment; Integrate the encrypted code into a new executable file, and reintegrate the new executable file into the original APK to form a hardened APK. Pass the hardened APK path to the installation function in the system service simulator to complete the installation of the hardened APK application.
5. According to claim 4, an encryption method applied to an Android virtual framework is characterized in that: The S2 includes: When the reinforced APK application loads the protected executable file, the decryption key is reorganized to complete the decryption of the protected executable file; Verify the integrity of the protected executable file to determine whether the code that calls the target function is legal; The libc.so function intercepted by the Android virtual framework is encrypted or decrypted according to the integrity verification result.
6. According to claim 5, an encryption method applied to an Android virtual framework is characterized in that: According to the integrity verification result, the libc.so function intercepted by the Android virtual framework is encrypted or decrypted, including: When the intercepted libc.so function is a write function, the written content is encrypted by the encryption key; when the intercepted libc.so function is a read function, the read encrypted content is decrypted by the decryption key.
Citation Information
Patent Citations
Application program installation package processing method and device, and mobile apparatus
CN104484585A
Method for generating APK file and terminal
CN104932902A
so file dynamic recovery-based Android application reinforcement method
CN106650327A
Reinforcing method and system for preventing reverse cracking of Android application program and decryption method
CN106778103A
A dynamic encryption and decryption-based Android application reinforcing method
CN107169324A
