A data extraction method and device protected by an SELinux security mechanism
By constructing a system process permission acquisition scheme library and a global SELinux domain communication relationship graph, and dynamically building data transmission channels, the problem of data extraction under SELinux mandatory access control in high-version Android devices is solved, realizing automated and flexible data transmission and judicial effectiveness of evidence collection results.
Patent Information
- Application Number
- CN202611002215.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies cannot effectively break through process domain isolation in the SELinux mandatory access control mode of high-version Android devices, causing data extraction solutions to fail in high-version hardened devices and manufacturer-customized systems. They lack universality and automation, and the data transmission logic is highly coupled with the permission acquisition logic, resulting in high maintenance costs and the inability to support multi-level data transmission.
A system process permission acquisition scheme library is built. By parsing AOSP and device local SELinux policies, a global SELinux domain communication relationship graph is generated, and data transmission channels are dynamically constructed. Multiple communication methods and multi-level relay links are supported to achieve automated permission acquisition and data transmission.
It enables stable data transmission under various complex SELinux policy environments, adapts to Android devices from different manufacturers and versions, reduces adaptation costs, improves automation and scalability, and ensures the judicial validity of evidence collection results.
Smart Images

Figure CN123116255A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic digital forensics technology, specifically to a data extraction method and apparatus protected by the SELinux security mechanism. Background Technology
[0002] In the field of electronic forensics and underlying data collection on Android mobile devices, forensic personnel can obtain execution permissions for specific system processes through various system security mechanism adaptations and local system process permission acquisition techniques.
[0003] High-version Android systems generally enable SELinux mandatory access control mode. This mode implements a strict process domain isolation mechanism. Each process, regardless of whether its UID is Root, is strictly restricted by the permission rules of the SELinux domain to which the process belongs. Even if a high-version Android system obtains execution permissions for a high-privilege process (including system processes with the UID Root), that process can only operate within the scope allowed by its SELinux domain rules and cannot directly establish communication or transfer data with ordinary shell processes or ADB processes.
[0004] In existing technologies, most traditional data extraction solutions bypass domain isolation restrictions by disabling SELinux or modifying SELinux policies. However, in a large number of high-version hardened devices, vendor-customized systems, and kernel protection devices, SELinux forced mode is locked and cannot be disabled or modified through conventional methods, causing traditional solutions to become completely ineffective.
[0005] Meanwhile, simply obtaining root privileges is insufficient to overcome the common technical challenge of domain isolation: even if the root UID is successfully obtained, the process is still strictly limited by the permission rules of its SELinux domain, and the system cannot directly establish a communication link with ordinary shell processes or ADB processes to transmit data.
[0006] In addition, the existing technology has the following significant drawbacks: First, it lacks a universal framework for matching system process permission acquisition schemes, and the system cannot automatically match available system process permission acquisition schemes based on different device models and Android versions; Second, the permission acquisition logic and data transmission logic are highly coupled, with each system process permission acquisition scheme corresponding to a set of independent data transmission code, resulting in high maintenance costs and poor scalability; Third, the screening of high-privilege processes and the planning of data transmission paths rely on manual experience, which is inefficient and prone to missed or incorrect judgments; Fourth, the data extraction process only supports fixed single-level data transfer and cannot dynamically construct multi-level transmission links based on the actual available process permissions.
[0007] Therefore, there is an urgent need for a general, automated, and dynamically matched system process permission acquisition solution that supports multi-level data transmission and bypasses SELinux domain isolation for data extraction, in order to solve the problem of electronic data forensics in high-version Android devices under SELinux forced locking scenarios. Summary of the Invention
[0008] This application addresses one or more technical deficiencies in the prior art by proposing the following technical solution.
[0009] Based on the first aspect of this application, a data extraction method protected by the SELinux security mechanism is proposed, comprising: S1: Collect feature information of the target Android device. When SELinux is in a forced-on state and cannot be turned off or modified, match the feature information in the pre-built system process permission acquisition scheme library to obtain all system process permission acquisition schemes applicable to the target Android device. S2: Execute the system process permission acquisition scheme according to priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; S3: Generate a global SELinux domain communication relationship graph by analyzing the AOSP open-source SELinux policy and the device's local SELinux policy; S4: Based on the global SELinux domain communication relationship graph, starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell process or ADB process belongs, a data transmission channel is constructed and its validity is verified. S5: The Shell terminal or ADB terminal sends a data extraction command through the data transmission channel to extract user data.
[0010] This application solves the problem of electronic data forensics in SELinux-enforced locking scenarios for high-version Android devices; it is compatible with Android devices from different manufacturers and versions, and supports any system process permission acquisition scheme and any high-privilege system process; when adding a new system process permission acquisition scheme, there is no need to modify the data transmission logic, only the corresponding entry needs to be added to the system process permission acquisition scheme library; and it supports multiple communication methods and multi-level relay links to ensure stable data transmission in various complex SELinux policy environments, without shutting down or modifying the SELinux policy, without destroying the original data of the device, and can guarantee the judicial validity of the forensic results.
[0011] Furthermore, the system process permission acquisition scheme library stores all available system process permission acquisition schemes and their supported device models, Android versions, and process information for which permissions can be acquired; Different system process permission acquisition schemes can acquire execution permissions for different system processes.
[0012] This step can automatically match devices from different manufacturers and with different Android versions, avoiding the tedious operation of manually searching for adaptation solutions and greatly reducing the time and manpower costs of solution adaptation and maintenance.
[0013] Furthermore, the system processes include system processes with UID permissions of Root, and system processes with UID permissions of non-Root but with user data read permissions.
[0014] Furthermore, step S2 also specifically includes verifying whether the system process has execution permissions with the ability to read user data. If it does not have such permissions, the next system process permission acquisition scheme is executed until execution permissions with the ability to read user data are acquired.
[0015] This step automatically filters out invalid processes that lack data reading capabilities, avoiding wasted time in subsequent channel construction and ensuring that the system always plans paths based on valid permissions, thus improving the stability and automation of the overall process.
[0016] Furthermore, S3 specifically includes: Parse the SELinux policy file in the corresponding Android version AOSP project, extract the communication trust rules and process startup permission rules between each SELinux domain, and generate an offline domain communication relationship matrix; Using the acquired system process execution privileges, read the SELinux policy file stored locally on the device, parse the domain communication rules that are actually in effect on the device, and generate an online domain communication relationship matrix; The offline domain communication relationship matrix and the online domain communication relationship matrix are cross-fused to generate a global SELinux domain communication relationship graph.
[0017] This step effectively corrects the offline rule deviation problem caused by the vendor's deep customization of SELinux policies, and can accurately and completely restore the currently effective inter-domain communication trust relationship of the device, providing a solid data foundation for the accurate construction of subsequent data transmission channels.
[0018] Furthermore, the construction of the data transmission channel specifically includes: Starting from the SELinux domain to which the system process with acquired privileges belongs, and ending at the SELinux domain to which the Shell process or ADB process belongs, search for the shortest path in the global SELinux domain communication relationship graph. First, search for a single-level direct connection path, find an intermediate process that has communication trust with both the starting SELinux domain and the ending Shell domain, and build a single-level data transmission channel; If no single-level direct path exists, then recursively search for multi-level relay paths to construct a chain-like data transmission link consisting of multiple intermediate processes. Based on the communication types allowed by the SELinux policy, the optimal communication method for each data transmission channel is selected to obtain the data transmission channel.
[0019] This step allows for flexible path planning and is highly adaptable, enabling the construction of data transmission channels in various complex SELinux policy environments.
[0020] Furthermore, the data transmission channel supports communication methods including Socket communication, file transfer, and memory sharing.
[0021] This step can flexibly adapt to the restrictions of different SELinux rules on communication types, effectively avoiding transmission failures caused by the disabling of a single communication method.
[0022] Furthermore, the validity verification specifically includes: Start all intermediate processes in the data transmission channel and verify whether a normal communication connection has been established between the processes. Test commands are sent to authorized system processes via the data transmission channel to verify whether the commands arrive and are executed correctly. Verify that the test data returned by the system process is accurately and completely transmitted to the Shell terminal or ADB terminal.
[0023] This step can detect abnormal nodes in the data transmission channel in advance, ensuring that the data transmission channel is smooth and the data is accurate during actual operation, eliminating the risk of interruption or data corruption during data extraction, and improving the success rate of evidence collection tasks.
[0024] Based on a second aspect of this application, a data extraction device protected by the SELinux security mechanism is also proposed, comprising: Solution acquisition unit: Collects feature information of the target Android device. When SELinux is forcibly enabled and cannot be disabled or modified, it matches the feature information in the pre-built system process permission acquisition solution library to obtain all system process permission acquisition solutions applicable to the target Android device. Permission acquisition unit: Executes the system process permission acquisition scheme in order of priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; Policy parsing unit: Generates a global SELinux domain communication relationship graph by parsing AOSP open-source SELinux policies and device-local SELinux policies; Transmission Channel Unit: Based on the global SELinux domain communication relationship graph, a data transmission channel is constructed and its validity is verified, starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell process or ADB process belongs. Data extraction unit: The Shell terminal or ADB terminal issues a data extraction command through the data transmission channel to extract user data.
[0025] Based on a third aspect of this application, a computer program product is also proposed, on which one or more computer programs are stored, which, when executed by a computer processor, implement the method described above.
[0026] The technical advantages of this application are as follows: This application constructs a general system process permission acquisition framework that includes a system process permission acquisition scheme library and a device matching engine. It can automatically match available system process permission acquisition schemes according to different device models and Android versions, solving the problems of poor adaptability and high maintenance costs of existing technologies. It achieves complete decoupling of permission acquisition logic and data transmission logic, supporting dynamic combinations of any system process permission acquisition scheme and any data transmission path, greatly improving the scalability and flexibility of the scheme. It no longer presets fixed data sources and transmission paths, but dynamically constructs the optimal data transmission channel based on the actual acquired process permissions. The relay process does not need to have root privileges, only communication trust capabilities. It adopts a dual-path parsing method combining AOSP offline parsing and device local online parsing, completely and accurately obtaining the device's domain communication relationships, effectively solving the problem of inaccurate rules caused by manufacturer-customized strategies. Without disabling or modifying SELinux policies, it utilizes cross-domain communication paths natively allowed by the system to bypass the domain isolation mechanism, without damaging the original device data, ensuring the judicial validity of the evidence results. Attached Figure Description
[0027] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0028] Figure 1 This is a flowchart of a data extraction method protected by the SELinux security mechanism according to an embodiment of this application.
[0029] Figure 2 This is an architecture diagram of a data extraction device protected by the SELinux security mechanism, provided according to an embodiment of this application.
[0030] Figure 3 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the embodiments of this application. Detailed Implementation
[0031] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0032] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0033] Figure 1 This application illustrates a method for extracting data protected by the SELinux security mechanism, comprising: S1: Collect feature information of the target Android device. When SELinux is in a forced-on state and cannot be turned off or modified, match the feature information in the pre-built system process permission acquisition scheme library to obtain all system process permission acquisition schemes applicable to the target Android device. S2: Execute the system process permission acquisition scheme according to priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; S3: Generate a global SELinux domain communication relationship graph by analyzing the AOSP open-source SELinux policy and the device's local SELinux policy; S4: Based on the global SELinux domain communication relationship graph, starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell process or ADB process belongs, a data transmission channel is constructed and its validity is verified. S5: The Shell terminal or ADB terminal sends a data extraction command through the data transmission channel to extract user data.
[0034] It should be noted that this application solves the problem of electronic data forensics in SELinux-mandated locking scenarios for high-version Android devices; it is compatible with Android devices from different manufacturers and versions, supports any system process permission acquisition scheme and any high-privilege system process; when adding a new system process permission acquisition scheme, there is no need to modify the data transmission logic, only the corresponding entry needs to be added to the system process permission acquisition scheme library; and it supports multiple communication methods and multi-level relay links to ensure stable data transmission in various complex SELinux policy environments, without closing or modifying the SELinux policy, without destroying the original data of the device, and can guarantee the judicial validity of the forensic results.
[0035] It should be noted that the system process permission acquisition scheme library stores all available system process permission acquisition schemes and their supported device models, Android versions, and process information for which permissions can be acquired; Different system process permission acquisition schemes can be used to acquire execution permissions for different system processes.
[0036] It should be noted that this step can automatically match devices from different manufacturers and with different Android versions, avoiding the tedious operation of manually searching for adaptation solutions and greatly reducing the time and manpower maintenance costs of solution adaptation.
[0037] It should be noted that the system processes include system processes with Root UID permissions, and system processes with non-Root UID permissions but with user data read permissions.
[0038] It should be noted that step S2 also specifically includes verifying whether the system process has execution permissions with the ability to read user data. If it does not have such permissions, the next system process permission acquisition scheme is executed until execution permissions with the ability to read user data are acquired.
[0039] It should be noted that this step can automatically filter out invalid processes that do not have the ability to read data, avoiding wasting time in subsequent channel construction, ensuring that the system always plans paths based on valid permissions, and improving the stability and automation of the overall process. It should be noted that S3 specifically includes: Parse the SELinux policy file in the corresponding Android version AOSP project, extract the communication trust rules and process startup permission rules between each SELinux domain, and generate an offline domain communication relationship matrix; Using the acquired system process execution privileges, read the SELinux policy file stored locally on the device, parse the domain communication rules that are actually in effect on the device, and generate an online domain communication relationship matrix; The offline domain communication relationship matrix and the online domain communication relationship matrix are cross-fused to generate a global SELinux domain communication relationship graph.
[0040] It should be noted that this step effectively corrects the offline rule deviation problem caused by the deep customization of SELinux policies by the vendors, and can accurately and completely restore the currently effective inter-domain communication trust relationship of the device, providing a solid data foundation for the accurate construction of subsequent data transmission channels.
[0041] It should be noted that the construction of the data transmission channel specifically includes: Starting from the SELinux domain to which the system process with acquired privileges belongs, and ending at the SELinux domain to which the Shell process or ADB process belongs, search for the shortest path in the global SELinux domain communication relationship graph. First, search for a single-level direct connection path, find an intermediate process that has communication trust with both the starting SELinux domain and the ending Shell domain, and build a single-level data transmission channel; If no single-level direct path exists, then recursively search for multi-level relay paths to construct a chain-like data transmission link consisting of multiple intermediate processes. Based on the communication types allowed by the SELinux policy, the optimal communication method for each data transmission channel is selected to obtain the data transmission channel.
[0042] It should be noted that this step allows for flexible path planning and is highly adaptable, enabling the construction of data transmission channels in various complex SELinux policy environments.
[0043] It should be noted that the data transmission channel supports communication methods including Socket communication, file transfer, and memory sharing.
[0044] It should be noted that this step can flexibly adapt to the restrictions of different SELinux rules on communication types, effectively avoiding transmission failures caused by the disabling of a single communication method.
[0045] It should be noted that the validity verification specifically includes: Start all intermediate processes in the data transmission channel and verify whether a normal communication connection has been established between the processes. Test commands are sent to authorized system processes via the data transmission channel to verify whether the commands arrive and are executed correctly. Verify that the test data returned by the system process is accurately and completely transmitted to the Shell terminal or ADB terminal.
[0046] It should be noted that this step can detect abnormal nodes in the data transmission channel in advance, ensuring that the data transmission channel is smooth and the data is accurate during actual operation, eliminating the risk of interruption or data corruption during data extraction, and improving the success rate of evidence collection tasks.
[0047] Based on a second aspect of this application, a data extraction device protected by the SELinux security mechanism is also proposed, comprising: Solution acquisition unit 201: Collects feature information of the target Android device. When SELinux is in a forced-on state and cannot be turned off or modified, it matches the feature information in the pre-built system process permission acquisition solution library to obtain all system process permission acquisition solutions applicable to the target Android device. Permission acquisition unit 202: Executes the system process permission acquisition scheme in order of priority to acquire the execution permissions of the system process, wherein the execution permissions of the system process include UID permissions and SELinux domain permissions; Policy parsing unit 203: Generates a device-wide SELinux domain communication relationship graph by parsing the AOSP open-source SELinux policy and the device's local SELinux policy; Transmission channel unit 204: Based on the global SELinux domain communication relationship map, starting from the SELinux domain to which the system process with acquired permissions belongs, and ending at the SELinux domain to which the Shell process or ADB process belongs, a data transmission channel is constructed and its validity is verified. Data extraction unit 205: A Shell terminal or ADB terminal issues a data extraction command through the data transmission channel to extract user data.
[0048] It should be noted that this application is compatible with Android devices from different manufacturers and versions, supports any system process permission acquisition scheme and any high-privilege system process; it achieves full automation of system process permission acquisition scheme matching and data transmission channel construction without manual intervention; it supports multiple communication methods and multi-level relay links to ensure stable data transmission under various complex SELinux policy environments; when adding a new system process permission acquisition scheme, there is no need to modify the data transmission logic, only the corresponding entry needs to be added to the system process permission acquisition scheme library; the entire process does not modify the system configuration, does not destroy the original data, and the evidence obtained has judicial validity.
[0049] It should be noted that this application does not disable SELinux or modify SELinux policies throughout the entire process, and all cross-domain communication is implemented based on the device's native SELinux trust rules.
[0050] In a specific embodiment, the following steps are performed in the device described in this application, including: Step 1: Collect device characteristic information and match system process permission acquisition scheme; Connect to the target Android device and collect device characteristic information, including brand, model, Android version, and kernel version; verify the SELinux running status to confirm that it is forcibly enabled and cannot be disabled or modified; based on the device characteristic information, match it in a pre-built system process permission acquisition scheme library to filter out all available system process permission acquisition schemes applicable to the device; sort the available system process permission acquisition schemes according to permission acquisition success rate and priority of processes that can acquire permissions; Step 2: Execute the system process permission acquisition scheme and acquire process permissions; The system process permission acquisition schemes are executed sequentially according to priority. If the permission acquisition is successful, the execution permission of the corresponding target process is obtained, and the process's UID and SELinux domain are recorded. The process is verified to have the necessary user data reading capabilities (such as disk block read / write, system private file read, etc.). If the acquisition fails, the next available system process permission acquisition scheme is tried until a process with data reading capabilities is obtained. Step 3: SELinux policy dual-path resolution; Offline parsing involves matching the Android version of the target device, parsing the SELinux policy file in the AOSP open-source project, extracting communication trust rules and process startup permission rules between SELinux domains, and generating an offline domain communication relationship matrix. Online parsing utilizes the acquired process permissions to read the SELinux policy file stored locally on the device, parses the domain communication rules that are actually in effect on the device, and generates an online domain communication relationship matrix; The offline domain communication relationship matrix is cross-compared and fused with the online domain communication relationship matrix to correct the differences caused by the vendor's customized strategy and generate the final full-domain SELinux domain communication relationship map. Step 4: Construct a dynamic data transmission channel; Starting from the SELinux domain to which the process with acquired privileges belongs, and ending at the SELinux domain to which the Shell process or ADB process belongs, the shortest path is searched in the global communication relationship graph. Prioritize searching for single-level direct connection paths, find intermediate processes that have communication trust with both the starting SELinux domain and the ending Shell domain, and build a single-level data transmission channel; If no single-level direct path exists, a multi-level relay path is recursively searched, and a chain-like data transmission link consisting of multiple intermediate processes is automatically constructed to ensure that there is SELinux native communication trust between the domains of every two adjacent processes. Based on the communication types allowed by the SELinux policy, the optimal communication method is selected for each segment of the data transmission channel, including Socket communication, file transfer, and memory sharing; Step 5: Verify the validity of the data transmission channel; Start all intermediate processes in the constructed data transmission channel and verify whether communication connections can be established normally between the processes; Test commands are sent to processes that have acquired permissions through the data transmission channel to verify whether the commands can be received and executed normally. Verify whether the test data returned by the process can be transmitted completely and accurately to the Shell terminal or ADB terminal through the data transmission channel; Step Six: User Data Extraction and Export; Data extraction commands are issued via a Shell terminal or ADB terminal. These commands are forwarded level by level through the data transmission channel to the target process that has obtained the necessary permissions. The target process performs data reading operations to obtain user data such as disk block data, system private files, and database data. The user data is then transmitted back level by level through the data transmission channel to the Shell terminal or ADB terminal. The user data is received and saved in the Shell terminal or ADB terminal, thus completing the electronic data extraction.
[0051] It should be noted that this application constructs a general system process permission acquisition framework that includes a system process permission acquisition scheme library and a device matching engine. It can automatically match available system process permission acquisition schemes according to different device models and different Android versions, thus solving the problems of poor adaptability and high maintenance costs of existing technologies.
[0052] It should be noted that this application achieves complete decoupling between permission acquisition logic and data transmission logic, supports dynamic combination of any system process permission acquisition scheme and any data transmission path, and greatly improves the scalability and flexibility of the scheme.
[0053] It should be noted that this application uses dynamic path planning based on process permissions, and no longer presets fixed data sources and transmission paths. Instead, it dynamically constructs the optimal data transmission channel based on the actual process permissions obtained. The relay process does not need to have root privileges, as long as it has communication authorization.
[0054] It should be noted that this application adopts a dual-path resolution method that combines AOSP offline resolution with device local online resolution, which completely and accurately obtains the domain communication relationship of the device and effectively solves the problem of inaccurate rules caused by manufacturer-customized strategies.
[0055] It should be noted that this application bypasses the domain isolation mechanism by utilizing the cross-domain communication path natively allowed by the system without disabling or modifying the SELinux policy, thus ensuring the judicial validity of the evidence obtained without damaging the original data of the device.
[0056] The following is for reference. Figure 3 It shows a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application. Figure 3 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0057] like Figure 3 As shown, the computer system includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 302 or programs loaded from storage section 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for system operation. The CPU 301, ROM 302, and RAM 303 are interconnected via bus 304. An input / output (I / O) interface 305 is also connected to bus 304.
[0058] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a liquid crystal display (LCD) and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card and a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.
[0059] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the methods of this application. It should be noted that the computer-readable storage medium of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0060] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages—such as Java, Smalltalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0061] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0062] The modules described in the embodiments of this application can be implemented in software or in hardware.
[0063] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by the electronic device, the electronic device performs the following actions: It collects characteristic information of the target Android device; when SELinux is forcibly enabled and cannot be disabled or modified, it matches the characteristic information against a pre-built system process permission acquisition scheme library to obtain all applicable system process permission acquisition schemes for the target Android device; it executes the system process permission acquisition schemes sequentially according to priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; it generates a device-wide SELinux domain communication relationship graph by parsing the AOSP open-source SELinux policy and the device's local SELinux policy; based on the device-wide SELinux domain communication relationship graph, it constructs a data transmission channel starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell / ADB process belongs, and performs validity verification; the Shell / ADB terminal issues a data extraction command through the data transmission channel to extract user data.
[0064] Finally, it should be noted that the above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A method for extracting data protected by the SELinux security mechanism, characterized in that, include: S1: Collect feature information of the target Android device. When SELinux is in a forced-on state and cannot be turned off or modified, match the feature information in the pre-built system process permission acquisition scheme library to obtain all system process permission acquisition schemes applicable to the target Android device. S2: Execute the system process permission acquisition scheme according to priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; S3: Generate a global SELinux domain communication relationship graph by analyzing the AOSP open-source SELinux policy and the device's local SELinux policy; S4: Based on the global SELinux domain communication relationship graph, starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell process or ADB process belongs, a data transmission channel is constructed and its validity is verified. S5: The Shell terminal or ADB terminal sends a data extraction command through the data transmission channel to extract user data.
2. The method according to claim 1, characterized in that, The system process permission acquisition scheme library stores all available system process permission acquisition schemes, their supported device models, Android versions, and process information for which permissions can be acquired; Different system process permission acquisition schemes can acquire execution permissions for different system processes.
3. The method according to claim 1, characterized in that, The system processes include system processes with UID permissions of Root, and system processes with UID permissions of non-Root but with user data read permissions.
4. The method according to claim 1, characterized in that, Step S2 further includes verifying whether the system process has execution permissions with the ability to read user data. If it does not have such permissions, the next system process permission acquisition scheme is executed until execution permissions with the ability to read user data are acquired.
5. The method according to claim 1, characterized in that, S3 specifically includes: Parse the SELinux policy file in the corresponding Android version AOSP project, extract the communication trust rules and process startup permission rules between each SELinux domain, and generate an offline domain communication relationship matrix; Using the acquired system process execution privileges, read the SELinux policy file stored locally on the device, parse the domain communication rules that are actually in effect on the device, and generate an online domain communication relationship matrix; The offline domain communication relationship matrix and the online domain communication relationship matrix are cross-fused to generate a global SELinux domain communication relationship graph.
6. The method according to claim 1, characterized in that, The construction of the data transmission channel specifically includes: Starting from the SELinux domain to which the system process with acquired privileges belongs, and ending at the SELinux domain to which the Shell / ADB process belongs, search for the shortest path in the global SELinux domain communication relationship graph. Search for a single-level direct connection path, find an intermediate process that has communication trust with both the starting SELinux domain and the ending Shell domain, and build a single-level data transmission channel; If no single-level direct path exists, then recursively search for multi-level relay paths to construct a chain-like data transmission link consisting of multiple intermediate processes. Based on the communication types allowed by the SELinux policy, the optimal communication method for each data transmission channel is selected to obtain the data transmission channel.
7. The method according to claim 6, characterized in that, The data transmission channel supports communication methods including Socket communication, file transfer, and memory sharing.
8. The method according to claim 1, characterized in that, The validity verification specifically includes: Start all intermediate processes in the data transmission channel and verify whether a normal communication connection has been established between the processes. Test commands are sent to authorized system processes via the data transmission channel to verify whether the commands arrive and are executed correctly. Verify that the test data returned by the system process is accurately and completely transmitted to the Shell / ADB terminal.
9. A data extraction device protected by SELinux security mechanism, characterized in that, include: Solution acquisition unit: Collects feature information of the target Android device. When SELinux is forcibly enabled and cannot be disabled or modified, it matches the feature information in the pre-built system process permission acquisition solution library to obtain all system process permission acquisition solutions applicable to the target Android device. Permission acquisition unit: Executes the system process permission acquisition scheme in order of priority to acquire the execution permissions of the system process, including UID permissions and SELinux domain permissions; Policy parsing unit: Generates a global SELinux domain communication relationship graph by parsing AOSP open-source SELinux policies and device-local SELinux policies; Transmission Channel Unit: Based on the global SELinux domain communication relationship graph, a data transmission channel is constructed and its validity is verified, starting from the SELinux domain to which the system process with acquired permissions belongs and ending at the SELinux domain to which the Shell process or ADB process belongs. Data extraction unit: The Shell terminal or ADB terminal issues a data extraction command through the data transmission channel to extract user data.
10. A computer program product having one or more computer programs stored thereon, characterized in that, When the computer program is executed by a computer processor, the method described in any one of claims 1-8 is performed.
