WO2024260299A1 - 系统合法性验证方法、装置及电子设备 - Google Patents

系统合法性验证方法、装置及电子设备 Download PDF

Info

Publication number
WO2024260299A1
WO2024260299A1 PCT/CN2024/099283 CN2024099283W WO2024260299A1 WO 2024260299 A1 WO2024260299 A1 WO 2024260299A1 CN 2024099283 W CN2024099283 W CN 2024099283W WO 2024260299 A1 WO2024260299 A1 WO 2024260299A1
Authority
WO
WIPO (PCT)
Prior art keywords
structured data
verification
configuration file
verified
policy configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2024/099283
Other languages
English (en)
French (fr)
Inventor
苏涛
洪文博
成明江
何文登
王尚之
赵梓伊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Publication of WO2024260299A1 publication Critical patent/WO2024260299A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities

Definitions

  • the present application belongs to the field of kernel security, and specifically relates to a system legitimacy verification method, device and electronic equipment.
  • the legitimacy of the loaded system is critical to the security of the device. If the loaded system is damaged, such as loading an illegal image or loading an illegal kernel module, the terminal system may be rooted, or a remotely controlled virus or Trojan may be run. This may lead to the loss or theft of private data in the user's mobile phone, or the user's mobile phone may be remotely controlled, which may reduce the user's trust in the mobile phone.
  • the main solutions are secure boot and verified boot. However, the existing secure boot and verified boot only verify the legitimacy of static system images, and cannot verify the legitimacy of structured data.
  • the purpose of the embodiments of the present application is to provide a system legitimacy verification method, device and electronic device, which can solve the problem that the existing technology cannot realize the legal verification of structured data.
  • an embodiment of the present application provides a system legitimacy verification method, the method comprising:
  • an alarm prompt message is generated, and a first process is performed according to the verification strategy; wherein the first process includes any one of the following:
  • an embodiment of the present application provides a system legitimacy verification device, including:
  • a first acquisition module used to acquire first structured data, where the first structured data is structured data to be loaded into a system kernel
  • a verification module is used to verify the integrity of the first structured data through a preset verification method to obtain a verification result. fruit;
  • a first processing module configured to load the first structured data into the system kernel if the verification result indicates that the first structured data is complete
  • the second processing module is configured to generate an alarm prompt message and perform a first process according to a verification strategy when the verification result indicates that the first structured data is incomplete; wherein the first process includes any one of the following:
  • an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the system legitimacy verification method described in the first aspect are implemented.
  • an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored.
  • the program or instruction is executed by a processor, the steps of the system legitimacy verification method described in the first aspect are implemented.
  • an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the system legitimacy verification method as described in the first aspect.
  • an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the system legitimacy verification method as described in the first aspect.
  • an embodiment of the present application provides an electronic device, which is configured to execute the system legitimacy verification method as in the first aspect.
  • first structured data is obtained, and the first structured data is structured data to be loaded into the system kernel; then, the integrity of the first structured data is verified through a preset verification method to obtain a verification result; finally, when the verification result indicates that the first structured data is complete, the first structured data is loaded into the system kernel; when the verification result indicates that the first structured data is incomplete, an alarm prompt message is generated, and a first processing is performed according to a verification strategy; wherein the first processing includes any one of the following: loading the first structured data into the system kernel; restricting the loading of the first structured data; stopping the operation of the current device or application, so that by adding the legitimacy verification of the structured data loaded in the kernel, the scope of the system legitimacy verification is expanded from the static image legitimacy verification to the legitimacy verification of the structured data dynamically loaded by the kernel, thereby realizing the legitimacy verification of the structured data.
  • FIG1 is a block diagram of a system legitimacy verification according to an embodiment of the present invention.
  • FIG2 is a schematic diagram of a flow chart of a method for verifying the legitimacy of a system according to an embodiment of the present
  • FIG3 is a second block diagram of the system legitimacy verification of an embodiment of the present invention.
  • FIG4 is a schematic diagram of a module of a system legitimacy verification device according to an embodiment of the present invention.
  • FIG5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
  • FIG. 6 is a second schematic diagram of the hardware structure of the electronic device according to the embodiment of the present invention.
  • first, second, etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first”, “second”, etc. are generally of one type, and the number of objects is not limited.
  • the first object can be one or more.
  • “and/or” in the specification and claims represents at least one of the connected objects, and the character “/" generally indicates that the objects associated with each other are in an "or” relationship.
  • the method of the embodiment of the present invention adds integrity verification of structured data loaded in the system kernel on the basis of secure boot and verified boot.
  • the method is based on the integrity of structured data loaded by the system and assists in verifying the legitimacy of the running system.
  • the system legitimacy verification includes the security startup phase, the verification startup phase and the structured data integrity verification phase. Specifically, it includes the following steps:
  • Step 101 During the startup process, the mobile terminal verifies hardware-related modules through secure startup.
  • the hardware is used as the first module to be loaded, and the signature verification is performed on the modules loaded subsequently.
  • the corresponding module is loaded only after the signature verification is passed, otherwise the loading is not allowed (that is, the startup fails).
  • Step 102 after completing the secure boot verification hardware related modules, enter the verification boot phase. That is, the first module to be started performs hash value verification on the image to be loaded later. Only after the hash value verification is passed, the corresponding system image is loaded, otherwise an error is reported (the boot can continue).
  • the first module started is usually the Boot Loader for secure boot verification.
  • Boot Loader is a boot loader that runs before the operating system kernel runs.
  • Step 103 after completing the verification startup step, the system kernel image is loaded and the kernel init process (the first process in the kernel) is started. After that, the structured data integrity verification phase is entered. Specifically, after the process is started, a hash value is calculated for the structured data loaded into the memory by adding a hook at a specific location, and the hash value is passed to the trusted application (TA) running in the trusted execution environment (TEE) for local verification, or remote verification is performed through a remote attestation protocol.
  • TA trusted application
  • TEE trusted execution environment
  • FIG2 it is a schematic diagram of a flow chart of a system legitimacy verification method provided by an embodiment of the present invention.
  • the method may specifically include:
  • Step 201 obtaining first structured data, where the first structured data is structured data to be loaded into a system kernel;
  • the first structured data includes second structured data and third structured data, wherein the second structured data is structured data contained in an upper-layer system, and the third structured data is structured data contained in an application of the upper-layer system.
  • the upper-layer system is installed in the electronic device that executes the method. It is a system above the system kernel and should be understood as a high-level operating system (HLOS).
  • the structured data that the upper-layer system needs to load into the system kernel includes but is not limited to: structured data of kernel modules and structured data of system services.
  • Step 202 verifying the integrity of the first structured data through a preset verification method to obtain a verification result
  • the preset verification methods include local verification and remote verification.
  • the local verification method refers to the method of using the TA running in the TEE for local verification
  • the remote verification method refers to the method of using the TA running in the TEE to perform remote verification through a remote server (third-party server) that communicates with the TA.
  • a remote server third-party server
  • Step 203 if the verification result indicates that the first structured data is complete, load the first structured data into the system kernel;
  • the verification result indicates that the first structured data is complete, it means that the services and operating system running on the system are safe and there is no risk of being attacked. At this time, the first structured data is loaded into the system kernel.
  • Step 204 if the verification result indicates that the first structured data is incomplete, generate an alarm prompt message and perform a first process according to the verification strategy; wherein the first process includes any one of the following:
  • the verification result indicates that the first structured data is incomplete, it means that the service and/or operating system running on the system is unsafe and at risk of being attacked.
  • an alarm message is generated to remind the user that the system integrity of the current device is destroyed; in addition, whether to load the first structured data into the system kernel is determined by the verification strategy.
  • the first structured data is loaded into the system kernel according to the preset strategy, considering that if some structured data is not loaded, it will cause the system to freeze or the software to crash.
  • limiting the loading of the first structured data means not loading the first structured data, or prohibiting the loading of the first structured data.
  • the system legitimacy verification method of the embodiment of the present invention is based on the integrity of structured data loaded by the system, and assists in verifying the legitimacy of the running system, thereby reducing the risk of the system being illegally flashed and hacked.
  • step 201 obtaining the first structured data, specifically includes:
  • Step 211 after completing the secure boot and verification boot, and detecting the pending verification in the preset storage location of the system file
  • the first structured data is obtained at the preset storage location.
  • a detection is performed in a preset storage location of the system file to determine whether there is first structured data that needs to be verified.
  • the preset storage location is a file storage location corresponding to structured data that needs to be verified for data integrity that is pre-stored in the system measurement policy configuration file, and is sent by a system compilation server to an electronic device that executes the method.
  • the first structured data may be extracted by adding a hook in a preset storage location (such as in kernel XXX_exec() and XXX_execve() functions).
  • step 202 verifying the integrity of the first structured data by a preset verification method to obtain a verification result, includes:
  • Step 2021 performing hash calculation on the first structured data to obtain a first hash value
  • the first hash value may include the hash value of the structured data of the kernel module after hash calculation, the hash value of the structured data of the system service after hash calculation, and the hash value of the structured data that the application in the upper system needs to load into the system kernel after hash calculation.
  • Step 2022 passing the first hash value to a trusted application TA running in a trusted execution environment
  • Step 2023 Verify the first hash value through the TA to obtain a verification result.
  • the TA here is set in the electronic device that executes the method, and can be a TA participating in local authentication or a TA participating in remote authentication.
  • the first hash value is verified by the TA to obtain a verification result, which may specifically include:
  • Step 20231a Compare the first hash value with a pre-stored second hash value through the TA to obtain a comparison result, where the second hash value is a correct hash value obtained by performing hash calculation on the first structured data in advance;
  • the correct hash value corresponding to the structured data that needs to be verified for data integrity after hash calculation is pre-stored in a verification TA policy configuration file, and the verification TA policy configuration file is sent by a system compilation server to the electronic device that executes the method.
  • Step 20232a when the comparison result is that the first Hash value is the same as the second Hash value, obtaining a verification result indicating that the first structured data is complete;
  • Step 20233a When the comparison result is that the first Hash value is different from the second Hash value, a verification result indicating that the first structured data is incomplete is obtained.
  • the following overall implementation process of system legitimacy verification is explained through an example from the secure boot phase, the verification boot phase and the structured data integrity verification phase (in this phase, the structured data integrity verification is implemented by TA performing local verification).
  • Step 301 during the startup process, the mobile terminal first loads the bootROM, and performs signature verification on the XBL module (ie, the startup module) using the public key stored in the module. If the signature verification is successful, the process proceeds to step 302; otherwise, the startup is stopped.
  • the XBL module ie, the startup module
  • the bootROM is a small piece of masked ROM or write-protected memory embedded in the processor chip. It contains the first code executed by the processor when it is powered on or reset.
  • the bootROM is provided by the chip vendor. This module is considered the trusted root of the device and is hardened in the chip by the chip manufacturer. The module code cannot be changed.
  • the chip manufacturer stores the public key of the public-private key pair used to sign its own related modules in this module.
  • Step 302 After the XBL module is loaded, the public key is used to perform signature verification on the TEE module. If the signature verification is successful, the process proceeds to step 303; otherwise, the process stops.
  • the public key in this step is the public key in the above step 301.
  • Step 303 after the TEE module is loaded, the hash value verification TA based on TEE is started, and the signature verification of the hypervisor module of the virtual machine management program is performed using the public key. If the signature verification is successful, step 304 is entered; otherwise, the startup is stopped.
  • Step 304 after the Hypervisor module is loaded, the virtual machine based on the hypervisor is started to run the hash value verification TA, and the APPSBL module (i.e., the startup module of the upper system) is signature verified using the public key. If the signature verification is successful, step 305 is entered; otherwise, the startup is stopped.
  • the APPSBL module i.e., the startup module of the upper system
  • Step 305 the Hypervisor module loads the image of the upper layer system, and the boot enters the verification boot phase.
  • the hash value of the loaded image is compared with the whitelist stored in the system partition (such as the vbmeta partition). If they match, the image is loaded normally, otherwise a warning is issued.
  • step 305 corresponds to the verification startup phase.
  • Step 306 after the HLOS is started, a hook is added to a specific location of the kernel (such as in the kernel XXX_exec() and XXX_execve() functions), a hash value is calculated for the structured data loaded into the memory and the hash value is passed to the TA participating in the local verification.
  • a hook is added to a specific location of the kernel (such as in the kernel XXX_exec() and XXX_execve() functions)
  • a hash value is calculated for the structured data loaded into the memory and the hash value is passed to the TA participating in the local verification.
  • the structured data loaded into the memory includes but is not limited to: structured data of the kernel module and structured data of the system service.
  • the APP application of the upper-layer system running in the HLOS needs to load the structured data into the system memory for hash value calculation and pass the hash value to the TA participating in local verification.
  • Step 307 after receiving the hash value, the TA participating in the local verification compares it with the whitelist stored in the trusted environment; if the comparison fails, an alarm is issued, or the loading of the corresponding structured data is restricted, and the use of the device or application is stopped.
  • the whitelist in the trusted environment includes the correct hash value corresponding to the structured data after hash calculation.
  • Steps 306 to 307 correspond to the structured data integrity verification phase.
  • the first hash value is authenticated by the TA to obtain the authentication result, which may specifically include:
  • Step 20231b The TA signs the first Hash value using a first random number, and sends the signed first Hash value to the remote server, wherein the first random number is transmitted between the TA and the remote server.
  • Step 20232b obtaining a verification result sent by the remote server, wherein the verification result is obtained by the remote server after performing integrity verification on the first structured data based on the signed first hash value.
  • the integrity verification of the structured data is completed by a remote server (third party), which can reduce the processing burden of the executing electronic device.
  • step 401 the system security engineer identifies the structured data that needs to be verified based on experience, ensuring that the legitimacy of the system is known when the structured data is known.
  • system kernel and system framework such as the Android framework
  • system measurement strategy can be set through the location, type and other attributes of the file system of structured data.
  • Step 402 The system compilation engineer updates the system measurement policy configuration file according to the list generated in step 401 during the process of compiling the system on devices of different models.
  • the file information of the system measurement policy configuration file includes a list of structured data that needs to be calculated for the system of the device model, and location indication information of the corresponding structured data.
  • the kernel of the electronic device calculates (for example, performs hash calculation) the structured data loaded into the kernel according to the list of structured data and location indication information in the system measurement policy configuration file.
  • step 403 the system TA engineer records the correct hash value of the structured data according to the list generated in step 401 , and generates a corresponding verification TA policy configuration file.
  • the file information of the verification TA policy configuration file includes a list of structured data that needs to be verified for data integrity, the correct hash value obtained after the structured data is hashed, and the corresponding verification strategy when different structured data verification fails.
  • the verification TA in the electronic device verifies the loaded structured data according to the verification TA policy configuration file.
  • Step 404 the system compilation server configures the system measurement policy configuration file and the verification TA policy configuration file to the electronic device by means of new machine deployment or OTA delivery. That is, in an optional embodiment, the method of the present invention may also include:
  • Step 405 obtaining the system measurement policy configuration file and the verification TA policy configuration file issued by the system compilation server;
  • the system measurement policy configuration file is used to obtain the first structured data;
  • the file information of the system measurement policy configuration file includes a list of structured data that need to be verified for data integrity and location indication information, and the location indication information is used to indicate the file storage location corresponding to the structured data that need to be verified for data integrity;
  • the verification TA policy configuration file is used to obtain the verification policy when the verification of the first structured data is incomplete;
  • the file information of the verification TA policy configuration file includes: a list of structured data that need to be verified for data integrity, a correct hash value obtained after hash calculation of the structured data that need to be verified for data integrity, and different The corresponding validation strategy when the structured data validation fails.
  • Step 406 Store the system measurement policy configuration file and the verification TA policy configuration file.
  • the electronic device calculates the loaded structured data through the system measurement policy configuration file, such as do_exec(), open_exec(), etc., and passes the calculation results to the verification TA.
  • the system measurement policy configuration file such as do_exec(), open_exec(), etc.
  • the verification TA verifies the structured data according to the verification TA policy configuration file and makes corresponding feedback.
  • the system legitimacy verification method of the embodiment of the present invention first obtains first structured data, where the first structured data is structured data to be loaded into the system kernel; then, the integrity of the first structured data is verified through a preset verification method to obtain a verification result; finally, when the verification result indicates that the first structured data is complete, the first structured data is loaded into the system kernel; when the verification result indicates that the first structured data is incomplete, an alarm prompt message is generated, and a first processing is performed according to a verification strategy; wherein the first processing includes any one of the following: loading the first structured data into the system kernel; restricting the loading of the first structured data; stopping the operation of the current device or application, so that by adding the legitimacy verification of the structured data loaded in the kernel, the scope of the system legitimacy verification is expanded from static image legitimacy verification to legitimacy verification of structured data dynamically loaded by the kernel, thereby realizing the legitimacy verification of the structured data.
  • the system legality verification method provided in the embodiment of the present application can be executed by a system legality verification device.
  • the system legality verification device executing the system legality verification method is taken as an example to illustrate the system legality verification device provided in the embodiment of the present application.
  • an embodiment of the present invention further provides a system legitimacy verification device, and the device 400 may include:
  • a first acquisition module 410 is used to acquire first structured data, where the first structured data is structured data to be loaded into the system kernel;
  • a verification module 420 configured to verify the integrity of the first structured data by a preset verification method to obtain a verification result
  • a first processing module 430 is configured to load the first structured data into the system kernel if the verification result indicates that the first structured data is complete;
  • the second processing module 440 is configured to generate an alarm prompt message and perform a first process according to a verification strategy when the verification result indicates that the first structured data is incomplete; wherein the first process includes any one of the following:
  • the first acquisition module 410 includes:
  • the first acquisition unit is configured to, after completing the secure startup and the verified startup, acquire the first structured data to be verified at the preset storage location of the system file when the first structured data to be verified is detected at the preset storage location of the system file. according to.
  • the first structured data includes second structured data and third structured data, wherein the second structured data is structured data contained in an upper-layer system, and the third structured data is structured data contained in an application of the upper-layer system.
  • the verification module 420 includes:
  • a first calculation unit configured to perform a hash calculation on the first structured data to obtain a first hash value
  • a first processing unit configured to transmit the first hash value to a trusted application TA running in a trusted execution environment
  • the verification unit is used to verify the first hash value through the TA to obtain a verification result.
  • the device 400 further includes:
  • the second acquisition module is used to obtain the system measurement policy configuration file and the verification TA policy configuration file issued by the system compilation server;
  • a storage module used for storing the system measurement policy configuration file and the verification TA policy configuration file
  • the system measurement policy configuration file is used to obtain the first structured data;
  • the file information of the system measurement policy configuration file includes a list of structured data that need to be verified for data integrity and location indication information, and the location indication information is used to indicate the file storage location corresponding to the structured data that need to be verified for data integrity;
  • the verification TA policy configuration file is used to obtain the verification strategy when the verification of the first structured data is incomplete;
  • the file information of the verification TA policy configuration file includes: a list of structured data that need to be verified for data integrity, the correct hash value obtained after hash calculation of the structured data that needs to be verified for data integrity, and the corresponding verification strategies when different structured data verification fails.
  • the system legitimacy verification device of the embodiment of the present invention first obtains first structured data, where the first structured data is structured data to be loaded into the system kernel; then, the integrity of the first structured data is verified through a preset verification method to obtain a verification result; finally, when the verification result indicates that the first structured data is complete, the first structured data is loaded into the system kernel; when the verification result indicates that the first structured data is incomplete, an alarm prompt message is generated, and a first processing is performed according to a verification strategy; wherein the first processing includes any one of the following: loading the first structured data into the system kernel; restricting the loading of the first structured data; stopping the operation of the current device or application, so that by adding the legitimacy verification of the structured data loaded in the kernel, the scope of the system legitimacy verification is expanded from the static image legitimacy verification to the legitimacy verification of the structured data dynamically loaded by the kernel, thereby realizing the legitimacy verification of the structured data.
  • the system legitimacy verification device in the embodiment of the present application can be an electronic device or a component in the electronic device, such as an integrated circuit or a chip.
  • the electronic device can be a terminal or other devices other than a terminal.
  • the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., a network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), ATM or self-service machine, etc., the embodiments of the present application are not specifically limited.
  • the system legitimacy verification device in the embodiment of the present application may be a device having an operating system.
  • the operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
  • the system legitimacy verification device provided in the embodiment of the present application can implement each process implemented by the method embodiments of Figures 1 to 3. To avoid repetition, they will not be described here.
  • an embodiment of the present application also provides an electronic device 500, including a processor 501 and a memory 502, and the memory 502 stores a program or instruction that can be executed on the processor 501.
  • the program or instruction is executed by the processor 501, the various steps of the above-mentioned system legitimacy verification method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
  • the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
  • FIG. 6 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
  • the electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, and a processor 610.
  • the electronic device 600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 610 through a power management system, so that the power management system can manage charging, discharging, and power consumption.
  • a power source such as a battery
  • the electronic device structure shown in FIG6 does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange components differently, which will not be described in detail here.
  • the processor 610 is used for:
  • an alarm prompt message is generated, and a first process is performed according to the verification strategy; wherein the first process includes any one of the following: loading the first structured data into the system kernel; limiting the loading of the first structured data; stopping the operation of the current device or application.
  • the electronic device of the embodiment of the present invention expands the scope of system legitimacy verification from static image legitimacy verification to legitimacy verification of structured data dynamically loaded by the kernel by adding legitimacy verification of structured data loaded in the kernel, thereby realizing legitimacy verification of structured data.
  • processor 610 is further configured to:
  • the first structured data to be verified is detected at the preset storage location of the system file, the first structured data is obtained at the preset storage location.
  • the first structured data includes second structured data and third structured data, wherein the second structured data is structured data contained in an upper-layer system, and the third structured data is structured data contained in an application of the upper-layer system.
  • processor 610 is further configured to:
  • the first hash value is verified to obtain a verification result.
  • processor 610 is further configured to:
  • the system measurement policy configuration file is used to obtain the first structured data;
  • the file information of the system measurement policy configuration file includes a list of structured data that need to be verified for data integrity and location indication information, and the location indication information is used to indicate the file storage location corresponding to the structured data that need to be verified for data integrity;
  • the verification TA policy configuration file is used to obtain the verification strategy when the verification of the first structured data is incomplete;
  • the file information of the verification TA policy configuration file includes: a list of structured data that need to be verified for data integrity, the correct hash value obtained after hash calculation of the structured data that needs to be verified for data integrity, and the corresponding verification strategies when different structured data verification fails.
  • the input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042, and the graphics processor 6041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode.
  • the display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc.
  • the user input unit 607 includes a touch panel 6071 and at least one of other input devices 6072.
  • the touch panel 6071 is also called a touch screen.
  • the touch panel 6071 may include two parts: a touch detection device and a touch controller.
  • Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
  • the memory 609 can be used to store software programs and various data.
  • the memory 609 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc.
  • the memory 609 may include a volatile memory or a non-volatile memory, or the memory 609 may include both volatile and non-volatile memories.
  • the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory may be a random access memory (RAM), a static random access memory (SRAM), or a non-volatile memory.
  • the memory 609 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
  • the processor 610 may include one or more processing units; optionally, the processor 610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 610.
  • An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored.
  • a program or instruction is stored.
  • the program or instruction is executed by a processor, each process of the above-mentioned system legitimacy verification method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
  • the processor is the processor in the electronic device described in the above embodiment.
  • the readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
  • An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned system legitimacy verification method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
  • the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
  • An embodiment of the present application provides a computer program product, which is stored in a storage medium.
  • the computer program product is executed by at least one processor to implement the various processes of the above-mentioned system legitimacy verification embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
  • the above embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware, but in many cases the former is more convenient.
  • the technical solution of the present application, or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种系统合法性验证方法、装置及电子设备,属于内核安全领域。本申请的方法包括:获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略,对所述第一结构化数据进行第一处理;其中,所述第一处理包括下述中的一项:将所述第一结构化数据加载至所述系统内核;限制对所述第一结构化数据的加载;停止当前设备或应用的运行。

Description

系统合法性验证方法、装置及电子设备
相关申请的交叉引用
本申请主张在2023年06月19日在中国提交的中国专利申请202310728699.2的优先权,其全部内容通过引用包含于此。
技术领域
本申请属于内核安全领域,具体涉及一种系统合法性验证方法、装置及电子设备。
背景技术
在移动终端启动的过程中,加载系统的合法性对设备安全性十分关键。如果加载的系统被破坏,例如加载了非法镜像,加载非法的内核模块等场景中,可以导致端侧系统被root、运行远程控制的病毒或木马等。进而导致用户手机内隐私数据的丢失、窃取,用户手机被远程控制等情况,造成用户对于手机的信任度降低。对于上述问题,现在主要的解决方案为安全启动(Secure Boot)和验证启动(Verified Boot)。但是现有的安全启动和验证启动都仅是对于静态的系统镜像合法性进行的验证,无法实现对结构化数据的合法验证。
发明内容
本申请实施例的目的是提供一种系统合法性验证方法、装置及电子设备,能够解决现有技术无法实现对结构化数据的合法验证的问题。
第一方面,本申请实施例提供了一种系统合法性验证方法,该方法包括:
获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:
将所述第一结构化数据加载至所述系统内核;
限制对所述第一结构化数据的加载;
停止当前设备或应用的运行。
第二方面,本申请实施例提供了一种系统合法性验证装置,包括:
第一获取模块,用于获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
验证模块,用于通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结 果;
第一处理模块,用于在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
第二处理模块,用于在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:
将所述第一结构化数据加载至所述系统内核;
限制对所述第一结构化数据的加载;
停止当前设备或应用的运行。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器和存储器,所述存储器存储可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的系统合法性验证方法的步骤。
第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的系统合法性验证方法的步骤。
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的系统合法性验证方法。
第六方面,本申请实施例提供一种计算机程序产品,该计算机程序产品被存储在存储介质中,该计算机程序产品被至少一个处理器执行以实现如第一方面所述的系统合法性验证方法。
第七方面,本申请实施例提供了一种电子设备,所述电子设备被配置成执行如第一方面的系统合法性验证方法。
在本申请实施例中,首先,获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;然后,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;最后,在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:将所述第一结构化数据加载至所述系统内核;限制对所述第一结构化数据的加载;停止当前设备或应用的运行,这样通过增加对于内核中加载结构化数据的合法性验证,将系统合法性验证的范围由静态的镜像合法性验证拓展到内核动态地加载的结构化数据合法性验证,从而实现了对结构化数据的合法性验证。
附图说明
图1是本发明实施例的系统合法性验证框图之一;
图2是本发明实施例的系统合法性验证方法的流程示意图;
图3是本发明实施例的系统合法性验证框图之二;
图4是本发明实施例的系统合法性验证装置的模块示意图;
图5是本发明实施例的电子设备的硬件结构示意图之一;
图6是本发明实施例的电子设备的硬件结构示意图之二。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。
需要说明的是,本发明实施例的方法是在安全启动和验证启动的基础上,增加的对于系统内核中加载的结构化数据的完整性验证,该方法是以系统加载的结构化数据完整性为基础,辅助验证运行系统的合法性。
参见图1,系统合法性验证依次包括安全启动阶段、验证启动阶段和结构化数据完整性验证阶段。具体包括以下步骤:
步骤101,移动终端在启动过程中,通过安全启动验证硬件相关的模块。
即在硬件作为最先启动加载的模块,对后续加载的模块进行签名验证。只有在签名验证通过后才加载对应的模块,否则不允许加载(即启动失败)。
步骤102,完成安全启动验证硬件相关模块后,进入验证启动阶段。即由最先启动的模块,对之后需要加载的镜像进行哈希值验证。只有在哈希值验证通过后,加载对应的系统镜像,否则进行报错(启动可以继续)。
这里,最先启动的模块通常为安全启动验证的Boot Loader,Boot Loader为引导加载程序,其在操作系统内核运行之前运行。
步骤103,完成验证启动的步骤后,系统内核镜像被加载,拉起内核init进程(内核中的第一个进程)。之后,进入结构化数据完整性验证阶段。具体的,进程启动后,通过在特定位置添加hook的方式,对加载进入内存的结构化数据进行哈希值计算,并且将哈希值传递给运行于可信执行环境(Trusted Execution Environment,TEE)中的受信任的应用(Trusted Application,TA)进行本地验证,或者通过远程证明协议进行远程验证。
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的系统合法性验证方法进行详细地说明。
如图2所示,为本发明实施例提供的系统合法性验证方法的流程示意图。该方法可具体包括:
步骤201,获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
可选地,所述第一结构化数据包括第二结构化数据和第三结构化数据,其中,所述第二结构化数据为上层系统中所包含的结构化数据,所述第三结构化数据为上层系统的应用中所包含的结构化数据。
其中,上层系统安装于执行该方法的电子设备内,是在系统内核之上的系统,应理解为高级操作系统(High-level Operation System,HLOS)。这里,上层系统需要加载至系统内核的结构化数据包括但不限于:内核模块的结构化数据和系统服务的结构化数据。
步骤202,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
这里,预设验证方式包括本地验证方式和远程验证方式两种。其中,本地验证方式指的是利用运行于TEE中的TA进行本地验证的方式,远程验证方式指的是利用运行于TEE中TA,通过与TA通信的远程服务器(第三方服务器)进行远程验证的方式。具体的验证过程参见下述实施例部分。
步骤203,在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
需要说明的是,验证结果表征第一结构化数据完整,则说明系统运行的服务和操作系统是安全的,没有被攻击的风险。此时,将第一结构化数据加载至该系统内核。
步骤204,在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:
将所述第一结构化数据加载至所述系统内核;
限制对所述第一结构化数据的加载;
停止当前设备或应用的运行。
这里,验证结果表征第一结构化数据不完整,则说明系统运行的服务和/或操作系统是不安全的,有被攻击的风险。此时,生成告警提示信息,用于提示用户当前设备的系统完整性被破坏;另外是否将第一结构化数据加载至该系统内核由验证策略决定。这里,根据预设策略将所述第一结构化数据加载至所述系统内核,是考虑到有些结构化数据若不加载的话会导致系统死机或者软件崩溃。
需要说明的是,限制对第一结构化数据的加载指的是不对第一结构化数据进行加载,或者是禁止加载第一结构化数据。
本发明实施例的系统合法性验证方法,以系统加载的结构化数据完整性为基础,辅助验证运行系统的合法性,降低了系统被非法刷机和攻破的风险。
在一可选地实施例中,上述步骤201,获取第一结构化数据,具体包括:
步骤2011,在完成安全启动和验证启动后,且在系统文件的预设存储位置检测到待验 证的所述第一结构化数据的情况下,在所述预设存储位置获取所述第一结构化数据。
具体的,基于预先存储的系统度量策略配置文件,在系统文件的预设存储位置检测是否存在需要进行验证的第一结构化数据。这里,预设存储位置是预先存储于系统度量策略配置文件中的需要进行数据完整性验证的结构化数据对应的文件存储位置,由系统编译服务器下发给执行该方法的电子设备。
具体的,可以通过在预设存储位置添加hook(如内核XXX_exec()和XXX_execve()函数中)的方式,抽取第一结构化数据。
也就是说,在实际应用中,并不是所有的结构化数据都需要进行数据完整性验证,这样的话会导致系统启动速度慢效率低,所以只是对需要进行数据完整性验证的结构化数据进行验证,而哪些结构化数据是需要进行数据完整性验证的,是由系统安全工程师根据经验标定出的,从而确保这些结构化数据在已知的情况下,系统的合法性已知。
在一可选地实施例中,上述步骤202,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果,包括:
步骤2021,对所述第一结构化数据进行哈希计算,得到第一哈希值;
其中,第一哈希值可以包括内核模块的结构化数据经哈希计算后的哈希值、系统服务的结构化数据经哈希计算后的哈希值和上层系统中的应用需要加载至系统内核的结构化数据经哈希计算后的哈希值。
步骤2022,将所述第一哈希值传递至运行于可信执行环境中的受信任的应用TA;
步骤2023,通过TA,将所述第一哈希值进行验证处理,获得验证结果。
这里的TA设置于执行该方法的电子设备中,可以是参与本地验证的TA,也可以是参与远程验证的TA。
下面说明该TA为参与本地验证的TA时,通过TA,将所述第一哈希值进行验证处理,获得验证结果,具体可包括:
步骤20231a,通过TA,将所述第一哈希值与预先存储的第二哈希值进行比较,获得比较结果,所述第二哈希值为预先对所述第一结构化数据进行哈希计算后得到的正确哈希值;
这里,需要进行数据完整性验证的结构化数据经哈希计算后对应的正确哈希值预先存储在验证TA策略配置文件中,该验证TA策略配置文件由系统编译服务器下发给执行该方法的电子设备。
步骤20232a,在比较结果为所述第一哈希值与所述第二哈希值相同的情况下,得到表征所述第一结构化数据完整的验证结果;
步骤20233a,在比较结果为所述第一哈希值与所述第二哈希值不同的情况下,得到表征所述第一结构化数据不完整的验证结果。
参见图3,下面通过一示例从安全启动阶段、验证启动阶段和结构化数据完整性验证阶段(该阶段中结构化数据完整性验证通过TA执行本地验证实现),整体说明系统合法性验证的实现过程。
步骤301,移动终端在启动过程中,首先加载bootROM,通过存储于该模块中的公钥对XBL模块(即启动模块)进行签名验证,签名验证成功后进入步骤302;否则停止启动。
其中,bootROM是嵌入处理器芯片内的一小块掩膜ROM或写保护内存,它包含处理器在上电或复位时执行的第一个代码。bootROM由芯片供应商提供,该模块被认为是设备的可信根,由芯片厂商硬化在芯片中,模块代码无法进行更改。芯片厂商将自身相关模块签名使用的公私钥对中的公钥存储于该模块。
步骤302,XBL模块加载后,使用公钥对TEE模块进行签名验证,签名验证成功后进入步骤303;否则停止启动。
需要说明的是,该步骤中的公钥上述步骤301中的公钥。
步骤303,TEE模块加载后,启动基于TEE的哈希值验证TA,并使用公钥对虚拟机管理程序Hypervisor模块进行签名验证,签名验证成功后进入步骤304;否则停止启动。
步骤304,Hypervisor模块加载后,启动基于hypervisor的虚拟机运行哈希值验证TA,并使用公钥对APPSBL模块(即上层系统的启动模块)进行签名验证,签名验证成功后进入步骤305;否则停止启动。
上述步骤301~步骤304对应的是安全启动阶段。
步骤305,Hypervisor模块加载上层系统的镜像,至此,启动进入验证启动阶段。加载镜像的哈希值和存储于系统分区(如vbmeta分区)的白名单进行对比,当匹配时正常加载镜像,否则发出警告。
上述步骤305对应的是验证启动阶段。
步骤306,HLOS启动后,通过在内核特定位置添加hook(如内核XXX_exec()和XXX_execve()函数中)的方式,对加载至内存的结构化数据进行哈希值计算并且将哈希值传递给参与本地验证的TA。
这里,加载至内存的结构化数据包括但不限于:内核模块的结构化数据和系统服务的结构化数据。
同理,运行在HLOS中的APP(上层系统的应用)需要加载至系统内存的结构化数据进行哈希值计算,并将哈希值传递给参与本地验证的TA。
步骤307,参与本地验证的TA在接收到哈希值后,与存储于可信环境中的白名单进行对比;如果对比出错,则对发出告警,或者限制对应的结构化数据加载,停止设备或应用的使用。
应理解,可信环境中的白名单中包括结构化数据经哈希计算后对应的正确哈希值。
步骤306~步骤307对应的是结构化数据完整性验证阶段。
下面说明该TA为参与远程验证的TA时,通过TA,将所述第一哈希值进行验证处理,获得验证结果,具体可包括:
步骤20231b,由该TA,利用第一随机数对所述第一哈希值进行签名,并将签名后的第一哈希值发送至远程服务器,其中,所述第一随机数通过所述TA与所述远程服务器之间的 交互获得;
步骤20232b,获取所述远程服务器发送的验证结果,所述验证结果由所述远程服务器基于所述签名后的第一哈希值对所述第一结构化数据进行完整性验证后得到。
该实施例中,结构化数据的完整性验证由远程服务器(第三方)完成,这样可以减轻执行电子设备的处理负担。
需要说明的是,在实际应用中,并不是所有的结构化数据都需要进行数据完整性验证,这样的话会导致系统启动速度慢效率低,所以只是对需要进行数据完整性验证的结构化数据进行验证,而哪些结构化数据是需要进行数据完整性验证的,是由系统安全工程师根据经验标定出的。步骤如下:
步骤401,系统安全工程师根据经验标定出需要进行验证的结构化数据,确保这些结构化数据在已知的情况下,系统的合法性已知。
这就需要对于系统内核和系统框架(如安卓框架)镜像有深层次的了解。其中可通过结构化数据的文件系统的位置,类型等属性设定系统度量策略。
步骤402,系统编译工程师根据步骤401生成的列表,在不同型号的设备进行系统编译的过程中,更新系统度量策略配置文件。
其中,系统度量策略配置文件的文件信息包括对于该设备型号的系统需要执行计算的结构化数据列表,以及对应结构化数据的位置指示信息。这样待之后下发给电子设备后,该电子设备的内核依据该系统度量策略配置文件中的结构化数据列表和位置指示信息,对加载至内核的结构化数据进行计算(比如进行哈希计算)。
步骤403,系统TA工程师根据步骤401生成的列表,将结构化数据的正确哈希值进行记录,并且生成对应的验证TA策略配置文件。
其中,验证TA策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表、结构化数据经哈希计算后得到的正确哈希值以及不同的结构化数据验证失败时对应的验证策略。这样待之后下发给电子设备后,该电子设备中的验证TA依据该验证TA策略配置文件,对加载的结构化数据进行验证。
步骤404,系统编译服务器通过新机部署或OTA下发的方式,将系统度量策略配置文件和验证TA策略配置文件配置到电子设备。即在一可选地实施例中,本发明的方法还可包括:
步骤405,获取系统编译服务器下发的系统度量策略配置文件和验证TA策略配置文件;
其中,所述系统度量策略配置文件用于获取所述第一结构化数据;所述系统度量策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表和位置指示信息,所述位置指示信息用于指示需要进行数据完整性验证的结构化数据对应的文件存储位置;
所述验证TA策略配置文件用于在验证所述第一结构化数据不完整情况下,获取所述验证策略;所述验证TA策略配置文件的文件信息包括:需要进行数据完整性验证的结构化数据列表、需要进行数据完整性验证的结构化数据经哈希计算后得到的正确哈希值以及不同 的结构化数据验证失败时对应的验证策略。
应理解,不同的结构化数据验证失败时对应的验证策略也就是上述实施例中的验证策略。
步骤406,存储所述系统度量策略配置文件和所述验证TA策略配置文件。
之后,电子设备通过系统度量策略配置文件,对加载的结构化数据进行计算,例如do_exec(),open_exec()等,并将计算结果传递给验证TA。
验证TA根据验证TA策略配置文件,验证结构化数据,并作出对应反馈。
本发明实施例的系统合法性验证方法,首先,获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;然后,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;最后,在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:将所述第一结构化数据加载至所述系统内核;限制对所述第一结构化数据的加载;停止当前设备或应用的运行,这样通过增加对于内核中加载结构化数据的合法性验证,将系统合法性验证的范围由静态的镜像合法性验证拓展到内核动态地加载的结构化数据合法性验证,从而实现了对结构化数据的合法性验证。
本申请实施例提供的系统合法性验证方法,执行主体可以为系统合法性验证装置。本申请实施例中以系统合法性验证装置执行系统合法性验证方法为例,说明本申请实施例提供的系统合法性验证装置。
如图4所示,本发明实施例还提供一种系统合法性验证装置,该装置400可包括:
第一获取模块410,用于获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
验证模块420,用于通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
第一处理模块430,用于在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
第二处理模块440,用于在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:
将所述第一结构化数据加载至所述系统内核;
限制对所述第一结构化数据的加载;
停止当前设备或应用的运行。
可选地,所述第一获取模块410包括:
第一获取单元,用于在完成安全启动和验证启动后,且在系统文件的预设存储位置检测到待验证的所述第一结构化数据的情况下,在所述预设存储位置获取所述第一结构化数 据。
可选地,所述第一结构化数据包括第二结构化数据和第三结构化数据,其中,所述第二结构化数据为上层系统中所包含的结构化数据,所述第三结构化数据为上层系统的应用中所包含的结构化数据。
可选地,所述验证模块420,包括:
第一计算单元,用于对所述第一结构化数据进行哈希计算,得到第一哈希值;
第一处理单元,用于将所述第一哈希值传递至运行于可信执行环境中的受信任的应用TA;
验证单元,用于通过TA,将所述第一哈希值进行验证处理,获得验证结果。
可选地,所述装置400还包括:
第二获取模块,用于获取系统编译服务器下发的系统度量策略配置文件和验证TA策略配置文件;
存储模块,用于存储所述系统度量策略配置文件和所述验证TA策略配置文件;
其中,所述系统度量策略配置文件用于获取所述第一结构化数据;所述系统度量策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表和位置指示信息,所述位置指示信息用于指示需要进行数据完整性验证的结构化数据对应的文件存储位置;
所述验证TA策略配置文件用于在验证所述第一结构化数据不完整情况下,获取所述验证策略;所述验证TA策略配置文件的文件信息包括:需要进行数据完整性验证的结构化数据列表、需要进行数据完整性验证的结构化数据经哈希计算后得到的正确哈希值以及不同的结构化数据验证失败时对应的验证策略。
本发明实施例的系统合法性验证装置,首先,获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;然后,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;最后,在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:将所述第一结构化数据加载至所述系统内核;限制对所述第一结构化数据的加载;停止当前设备或应用的运行,这样通过增加对于内核中加载结构化数据的合法性验证,将系统合法性验证的范围由静态的镜像合法性验证拓展到内核动态地加载的结构化数据合法性验证,从而实现了对结构化数据的合法性验证。
本申请实施例中的系统合法性验证装置可以是电子设备,也可以是电子设备中的部件,例如集成电路或芯片。该电子设备可以是终端,也可以为除终端之外的其他设备。示例性的,电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、移动上网装置(Mobile Internet Device,MID)、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、机器人、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,网络附属存储器 (Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。
本申请实施例中的系统合法性验证装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为IOS操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。
本申请实施例提供的系统合法性验证装置能够实现图1至图3的方法实施例实现的各个过程,为避免重复,这里不再赘述。
可选地,如图5所示,本申请实施例还提供一种电子设备500,包括处理器501和存储器502,存储器502上存储有可在所述处理器501上运行的程序或指令,该程序或指令被处理器501执行时实现上述系统合法性验证方法实施例的各个步骤,且能达到相同的技术效果,为避免重复,这里不再赘述。
需要说明的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。
图6为实现本申请实施例的一种电子设备的硬件结构示意图。
该电子设备600包括但不限于:射频单元601、网络模块602、音频输出单元603、输入单元604、传感器605、显示单元606、用户输入单元607、接口单元608、存储器609、以及处理器610等部件。
本领域技术人员可以理解,电子设备600还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器610逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图6中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。
其中,处理器610用于:
获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:将所述第一结构化数据加载至所述系统内核;限制对所述第一结构化数据的加载;停止当前设备或应用的运行。
本发明实施例的电子设备,通过增加对于内核中加载结构化数据的合法性验证,将系统合法性验证的范围由静态的镜像合法性验证拓展到内核动态地加载的结构化数据合法性验证,从而实现了对结构化数据的合法性验证。
可选地,处理器610还用于:
在完成安全启动和验证启动后,且在系统文件的预设存储位置检测到待验证的第一结构化数据的情况下,在所述预设存储位置获取所述第一结构化数据。
可选地,所述第一结构化数据包括第二结构化数据和第三结构化数据,其中,所述第二结构化数据为上层系统中所包含的结构化数据,所述第三结构化数据为上层系统的应用中所包含的结构化数据。
可选地,处理器610还用于:
对所述第一结构化数据进行哈希计算,得到第一哈希值;
将所述第一哈希值传递至运行于可信执行环境中的受信任的应用TA;
通过TA,将所述第一哈希值进行验证处理,获得验证结果。
可选地,处理器610还用于:
获取系统编译服务器下发的系统度量策略配置文件和验证TA策略配置文件;
存储所述系统度量策略配置文件和所述验证TA策略配置文件;
其中,所述系统度量策略配置文件用于获取所述第一结构化数据;所述系统度量策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表和位置指示信息,所述位置指示信息用于指示需要进行数据完整性验证的结构化数据对应的文件存储位置;
所述验证TA策略配置文件用于在验证所述第一结构化数据不完整情况下,获取所述验证策略;所述验证TA策略配置文件的文件信息包括:需要进行数据完整性验证的结构化数据列表、需要进行数据完整性验证的结构化数据经哈希计算后得到的正确哈希值以及不同的结构化数据验证失败时对应的验证策略。
应理解的是,本申请实施例中,输入单元604可以包括图形处理器(Graphics Processing Unit,GPU)6041和麦克风6042,图形处理器6041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元606可包括显示面板6061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板6061。用户输入单元607包括触控面板6071以及其他输入设备6072中的至少一种。触控面板6071,也称为触摸屏。触控面板6071可包括触摸检测装置和触摸控制器两个部分。其他输入设备6072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。
存储器609可用于存储软件程序以及各种数据。存储器609可主要包括存储程序或指令的第一存储区和存储数据的第二存储区,其中,第一存储区可存储操作系统、至少一个功能所需的应用程序或指令(比如声音播放功能、图像播放功能等)等。此外,存储器609可以包括易失性存储器或非易失性存储器,或者,存储器609可以包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(Random Access Memory,RAM),静态随机存取存储器(Static  RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)、同步动态随机存取存储器(Synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(Double Data Rate SDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(Enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(Synch link DRAM,SLDRAM)和直接内存总线随机存取存储器(Direct Rambus RAM,DRRAM)。本申请实施例中的存储器609包括但不限于这些和任意其它适合类型的存储器。
处理器610可包括一个或多个处理单元;可选的,处理器610集成应用处理器和调制解调处理器,其中,应用处理器主要处理涉及操作系统、用户界面和应用程序等的操作,调制解调处理器主要处理无线通信信号,如基带处理器。可以理解的是,上述调制解调处理器也可以不集成到处理器610中。
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述系统合法性验证方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器ROM、随机存取存储器RAM、磁碟或者光盘等。
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述系统合法性验证方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。
本申请实施例提供一种计算机程序产品,该计算机程序产品被存储在存储介质中,该计算机程序产品被至少一个处理器执行以实现如上述系统合法性验证实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者 是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以计算机软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。

Claims (15)

  1. 一种系统合法性验证方法,包括:
    获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
    通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
    在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
    在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的任意一项:
    将所述第一结构化数据加载至所述系统内核;
    限制对所述第一结构化数据的加载;
    停止当前设备或应用的运行。
  2. 根据权利要求1所述的方法,其中,所述获取第一结构化数据,包括:
    在完成安全启动和验证启动后,且在系统文件的预设存储位置检测到待验证的所述第一结构化数据的情况下,在所述预设存储位置获取所述第一结构化数据。
  3. 根据权利要求1所述的方法,其中,所述第一结构化数据包括第二结构化数据和第三结构化数据,其中,所述第二结构化数据为上层系统中所包含的结构化数据,所述第三结构化数据为上层系统的应用中所包含的结构化数据。
  4. 根据权利要求1所述的方法,其中,通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果,包括:
    对所述第一结构化数据进行哈希计算,得到第一哈希值;
    将所述第一哈希值传递至运行于可信执行环境中的受信任的应用TA;
    通过TA,将所述第一哈希值进行验证处理,获得验证结果。
  5. 根据权利要求1所述的方法,还包括:
    获取系统编译服务器下发的系统度量策略配置文件和验证TA策略配置文件;
    存储所述系统度量策略配置文件和所述验证TA策略配置文件;
    其中,所述系统度量策略配置文件用于获取所述第一结构化数据;所述系统度量策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表和位置指示信息,所述位置指示信息用于指示需要进行数据完整性验证的结构化数据对应的文件存储位置;
    所述验证TA策略配置文件用于在验证所述第一结构化数据不完整情况下,获取所述验证策略;所述验证TA策略配置文件的文件信息包括:需要进行数据完整性验证的结构化数据列表、需要进行数据完整性验证的结构化数据经哈希计算后得到的正确哈希值以及不同的结构化数据验证失败时对应的验证策略。
  6. 一种系统合法性验证装置,包括:
    第一获取模块,用于获取第一结构化数据,所述第一结构化数据为待加载至系统内核的结构化数据;
    验证模块,用于通过预设验证方式,验证所述第一结构化数据的完整性,得到验证结果;
    第一处理模块,用于在所述验证结果表征所述第一结构化数据完整的情况下,将所述第一结构化数据加载至所述系统内核;
    第二处理模块,用于在所述验证结果表征所述第一结构化数据不完整的情况下,生成告警提示信息,并根据验证策略进行第一处理;其中,所述第一处理包括下述中的一项:
    将所述第一结构化数据加载至所述系统内核;
    限制对所述第一结构化数据的加载;
    停止当前设备或应用的运行。
  7. 根据权利要求6所述的装置,其中,所述第一获取模块包括:
    第一获取单元,用于在完成安全启动和验证启动后,且在系统文件的预设存储位置检测到待验证的所述第一结构化数据的情况下,在所述预设存储位置获取所述第一结构化数据。
  8. 根据权利要求6所述的装置,其中,所述第一结构化数据包括第二结构化数据和第三结构化数据,其中,所述第二结构化数据为上层系统中所包含的结构化数据,所述第三结构化数据为上层系统的应用中所包含的结构化数据。
  9. 根据权利要求6所述的装置,其中,所述验证模块,包括:
    第一计算单元,用于对所述第一结构化数据进行哈希计算,得到第一哈希值;
    第一处理单元,用于将所述第一哈希值传递至运行于可信执行环境中的受信任的应用TA;
    验证单元,用于通过TA,将所述第一哈希值进行验证处理,获得验证结果。
  10. 根据权利要求6所述的装置,还包括:
    第二获取模块,用于获取系统编译服务器下发的系统度量策略配置文件和验证TA策略配置文件;
    存储模块,用于存储所述系统度量策略配置文件和所述验证TA策略配置文件;
    其中,所述系统度量策略配置文件用于获取所述第一结构化数据;所述系统度量策略配置文件的文件信息包括需要进行数据完整性验证的结构化数据列表和位置指示信息,所述位置指示信息用于指示需要进行数据完整性验证的结构化数据对应的文件存储位置;
    所述验证TA策略配置文件用于在验证所述第一结构化数据不完整情况下,获取所述验证策略;所述验证TA策略配置文件的文件信息包括:需要进行数据完整性验证的结构化数据列表、需要进行数据完整性验证的结构化数据经哈希计算后得到的正确哈希值以及不同的结构化数据验证失败时对应的验证策略。
  11. 一种电子设备,包括处理器和存储器,所述存储器存储可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如权利要求1至5任一项所述的系统合法性验证方法的步骤。
  12. 一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如权利要求1至5任一项所述的系统合法性验证方法的步骤。
  13. 一种芯片,包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如权利要求1-5中任一项所述的系统合法性验证方法的步骤。
  14. 一种计算机程序产品,所述计算机程序产品被存储在非易失的存储介质中,所述计算机程序产品被至少一个处理器执行以实现如权利要求1-5中任一项所述的系统合法性验证方法的步骤。
  15. 一种电子设备,所述电子设备被配置成执行如权利要求1-5中任一项所述的系统合法性验证方法的步骤。
PCT/CN2024/099283 2023-06-19 2024-06-14 系统合法性验证方法、装置及电子设备 Ceased WO2024260299A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310728699.2A CN116776317A (zh) 2023-06-19 2023-06-19 系统合法性验证方法、装置及电子设备
CN202310728699.2 2023-06-19

Publications (1)

Publication Number Publication Date
WO2024260299A1 true WO2024260299A1 (zh) 2024-12-26

Family

ID=87995778

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/099283 Ceased WO2024260299A1 (zh) 2023-06-19 2024-06-14 系统合法性验证方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN116776317A (zh)
WO (1) WO2024260299A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116776317A (zh) * 2023-06-19 2023-09-19 维沃移动通信有限公司 系统合法性验证方法、装置及电子设备
CN119902961A (zh) * 2025-03-31 2025-04-29 杭州炬华科技股份有限公司 一种终端程序校验方法、系统及可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106096412A (zh) * 2016-06-21 2016-11-09 华为技术有限公司 完整性度量方法及装置
CN112434306A (zh) * 2020-12-11 2021-03-02 中国科学院信息工程研究所 可信度量方法,装置,系统,电子设备及存储介质
CN113190831A (zh) * 2021-05-27 2021-07-30 中国人民解放军国防科技大学 一种基于tee的操作系统应用完整性度量方法及系统
US20220129566A1 (en) * 2020-10-26 2022-04-28 Nxp B.V. Secure application execution in a data processing system
CN116776317A (zh) * 2023-06-19 2023-09-19 维沃移动通信有限公司 系统合法性验证方法、装置及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106096412A (zh) * 2016-06-21 2016-11-09 华为技术有限公司 完整性度量方法及装置
US20220129566A1 (en) * 2020-10-26 2022-04-28 Nxp B.V. Secure application execution in a data processing system
CN112434306A (zh) * 2020-12-11 2021-03-02 中国科学院信息工程研究所 可信度量方法,装置,系统,电子设备及存储介质
CN113190831A (zh) * 2021-05-27 2021-07-30 中国人民解放军国防科技大学 一种基于tee的操作系统应用完整性度量方法及系统
CN116776317A (zh) * 2023-06-19 2023-09-19 维沃移动通信有限公司 系统合法性验证方法、装置及电子设备

Also Published As

Publication number Publication date
CN116776317A (zh) 2023-09-19

Similar Documents

Publication Publication Date Title
US8239688B2 (en) Securely recovering a computing device
CN101578609B (zh) 安全启动计算设备
EP2681689B1 (en) Protecting operating system configuration values
US9589139B2 (en) Method and device for altering a unified extensible firmware interface (UEFI) secure boot process in a computing device
CN109657448B (zh) 一种获取Root权限的方法、装置、电子设备及存储介质
KR101229148B1 (ko) 소프트웨어 신뢰성 검증 방법, 장치 및 컴퓨터 판독가능 매체
US20250007944A1 (en) Security assessment method and apparatus, electronic device, and readable storage medium
US20130081124A1 (en) Trusting an unverified code image in a computing device
US20080215872A1 (en) Method of booting electronic device and method of authenticating boot of electronic device
WO2024260299A1 (zh) 系统合法性验证方法、装置及电子设备
US10592661B2 (en) Package processing
CN115422545A (zh) 一种用于车载mcu的安全启动方法及装置
CN117494232B (zh) 固件的执行方法和装置、系统、存储介质及电子设备
TWI604336B (zh) 使用外部裝置之運行時驗證技術
CN114721693B (zh) 一种微处理器、bios固件更新方法、计算机设备及存储介质
CN116032484B (zh) 一种通信设备安全启动的方法、装置和电子设备
WO2016184180A1 (zh) 一种系统安全启动方法及装置
CN110362983A (zh) 一种保证双域系统一致性的方法、装置及电子设备
WO2024179285A1 (zh) 操作系统可信状态证明方法、装置、计算机及存储介质
CN117932689A (zh) 服务的保护方法、装置、电子设备及可读存储介质
CN117932612A (zh) 一种基于TrustZone技术的安全启动方法
CN117131522A (zh) 文件处理方法、装置和电子设备
CN118012450A (zh) 刷机方法、装置、电子设备、可读存储介质和程序产品

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24825195

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE