Mobile terminal operating system information protection method based on hardware certificate
Technical Field
The invention relates to the field of encryption protection, in particular to a mobile terminal operating system information protection method based on a hardware certificate.
Background
The current mobile terminal has very high popularity, and the mobile terminal brings higher efficiency, richer experience and more fun for the work and life entertainment of the user. At present, as a mobile terminal mainly represents a smart phone of a product, an initial design of an operating system (including android and IOS) of the smart phone is a consumer product, and requirements of users (especially commercial users) on security stability and custom development are not considered at the beginning of the design, especially the openness of original codes of the android system, so that other smart phones are completely exposed to threats of malicious users. In addition, there are a large number of unrepaired security BUGs for reasons of system design, etc., including release versions of IOS and android.
Specifically, the main security threats faced by the mobile terminal operating system are as follows:
(1) The application obtains the ROOT authority: because An Zhuokai source is used, malicious users can conduct comprehensive security hole research on codes, a large number of ROOT schemes of Zhuo Baochu can be used for acquiring system authorities by a brushless machine, and when a malicious user acquires the highest authority of the system, the system can be threatened by means of injection, fraud, tampering, stealing and the like.
The problem also exists with IOS systems, where historical versions of IOS also have several vulnerabilities that can be used to gain access to the system's ROOT rights in jail-breaking.
(2) XPOSED framework and APP Container: the Xposed Framework (Xposed Framework) is a set of Framework services which are open-source and run in the Android high-authority mode, can influence the running of programs (modifying a system) without modifying an APK file, can be used for manufacturing a plurality of powerful modules based on the Framework services, and can run simultaneously under the condition that functions are not conflicted. The return value of the parameter of any function can be easily obtained and tampered by using the HOOK component of XPOSED.
The Virtual APP is a relatively well-known framework of the APP container, and by utilizing the Virtual APP framework, a malicious user can easily enable any application to run in the memory of the Virtual APP, so that unrestricted control of any application and interception and tampering of information are realized.
(3) Application cloning vulnerabilities: application cloning is to clone an APP on the mobile phone of other people, so that a cloner can easily acquire account rights, steal user account numbers, funds and the like, which is afraid, but an attack model of the application cloning exists, the discovered vulnerability at this time at least relates to one tenth of the APP in the domestic android application market, and the APP is basically an application represented by the mainstream APP, such as a meal ordering class, a trip class and the like, and the APP is more mature in eyes of the user, so that potential safety hazards exist, and the APP can be often broken down.
A laboratory demonstrated the effect of an "apply cloning" attack with a certain APP as an example: on the mobile phone updated to the latest android 8.1.0, an attacker sends a mobile phone short message containing a malicious link to a user by utilizing the vulnerability of the attacker, once the user clicks, the account of the attacker is cloned into the mobile phone of the attacker for one second, and then the attacker can randomly check the user information, directly operate the application, steal the private information, steal the account number, funds and the like. However, the laboratory responsible person indicates that the application cloning loophole discovered at this time is only aimed at the android system.
It is known that based on this attack model, the laboratory checks with some security problem that is often ignored by vendors, and that 27 vulnerabilities are found in 200 mobile applications, in proportion to more than 10%.
(4) Application information fraud: the security event is caused by tampering information in a client or network pipeline, and the following two-dimensional code payment tampering and funds stealing are carried out:
a. tamper two-dimensional code mode, as shown in figure 1;
b. tamper with the transaction data pattern as in fig. 2.
(5) Process injection and information theft: malicious code may be injected into the current process in a number of ways, such as the Cordova plug-in of the IOS; as another example, the principle of payment code can be stolen by ptrace, xposed in android, as shown in fig. 3.
Disclosure of Invention
The invention aims to overcome the defects and shortcomings of the prior art and provide a mobile terminal operating system information protection method based on a hardware certificate, which eliminates risks of tampering and stealing of the existing mobile terminal operating system files and solves the problems that the existing system is easy to be broken by a ROOT (jail), SO (SO) injection, an xposed framework is installed, an APP application end is injected with a Trojan horse and the like.
The aim of the invention is achieved by the following technical scheme:
a mobile terminal operating system information protection method based on hardware certificate includes the following steps:
s1, reading a public key in a recovery partition when a mobile terminal operating system is started through the boot partition;
s2, when the mobile terminal operating system is started through the recovery partition, reading a public key in the boot partition;
s3, after the mobile terminal operating system is started through the boot partition, the public key in the kernel of the partition is added with the public key in the kernel of the recovery partition to verify the system partition;
s4, after the mobile terminal operating system is started through the recovery partition, the public key in the kernel of the partition is added with the public key of the boot partition to verify the system partition;
s5, when the system integrity fingerprint verification fails, the system is started, and the system is shut down.
In step S1, when the mobile terminal operating system uses boot to start, after the kernel loading is completed, decrypting and reading the recovery partition through the public key file b.cer in the kernel of the boot partition, decrypting and reading the encrypted part of the boot partition through the public key file r.cer in the kernel of the recovery partition, and after decrypting, checking the decrypted file by using the public key b.cer in the kernel; when the verification fails, the starting fails.
In step S2, when the mobile terminal operating system starts up by using recovery, after the kernel loading is completed, the boot partition is decrypted by the public key file r.cer in the kernel of the recovery partition, the integrity is checked, the encrypted part of the file is decrypted and read by the public key file b.cer in the kernel of the boot partition, and after the decryption, the decrypted and read file is checked by the public key r.cer in the kernel; when the verification fails, the starting fails.
The step S3 specifically comprises the following steps:
s301: after the mobile terminal operating system is started through boot partition, reading a system integrity key C and a decrypted key combination A of the local verification system;
s302: reading a verification system integrity key C and a decrypted key combination B through public key b.cer decryption in a boot partition kernel;
s303: acquiring a system decryption key A+B and checking an integrity verification key C;
s304: decrypting the read system partition boot-up into the system with decryption key A+B and verifying the system partition integrity with integrity key C;
s305: if the decryption key A+B cannot decrypt the system, the system is exited;
s306: if the integrity key D fails to verify, the starting is stopped.
The step S4 specifically includes the following steps:
s401: after the mobile terminal operating system is started through the recovery partition, reading a local area verification system integrity key D and a decrypted key combination A;
s402: the recovery partition integrity generates a fingerprint decryption reading boot partition reading verification system integrity key D and a decrypted key combination B;
s403: acquiring a system decryption key A+B and checking an integrity verification key D;
s404: decrypting the read system partition with decryption key A+B and verifying the integrity of the system partition with integrity key D;
s405: if the decryption key A+B cannot be decrypted, the system partition exits the system;
s406: if the verification by the integrity fingerprint D fails, the start-up is exited.
The method further comprises the following steps:
the hardware is firstly loaded into the mobile terminal operating system, and encryption initialization is needed to be carried out by using the IMEI of the mobile terminal as a read-write key of the kernel integrity file.
The encryption initialization uses mobile terminal IMEI as read-write key of kernel integrity file, specifically comprising the following steps:
s601: the starting system encrypts the system partition by using an asymmetric encryption algorithm, and divides a private key C into two parts;
s602: dividing a key C into two parts A and B, and respectively storing the two parts A and B in a boot partition and a recovery partition;
s603: and encrypting the boot partition and the recovery partition by using an asymmetric encryption algorithm, wherein a private key is not disclosed, and a read key is stored in an unencrypted kernel part.
Meanwhile, the invention provides:
a server comprising a processor and a memory, wherein at least one section of program is stored in the memory, and the program is loaded and executed by the processor to realize the commercial mobile terminal operating system information protection method based on hardware certificates.
A computer-readable storage medium having stored therein at least one program loaded and executed by a processor to implement the above-described method for protecting operating system information of a commercial mobile terminal based on a hardware certificate.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the method for encrypting the bootable partition and encrypting the system partition by using the asymmetric encryption algorithm ensures that the mobile operating system file and the running environment are not influenced by tampering and stealing, and realizes the safety protection. Because the mobile phone terminal only has a decryption algorithm, the core boot\recovery\system partition of the equivalent mobile phone terminal is in an undemandable state.
2. The invention adopts an open architecture, and is convenient for secondary development.
3. The method and the device can prevent the APP of the mobile terminal from being repackaged and the Trojan horse from being added.
4. The invention can avoid the file of the mobile operating system from being stolen and modified.
5. The invention can avoid that the mobile operating system is ROOT, the third party starting system is installed, and the XPOSED and other third party frameworks are installed.
6. The local system file is in a read-only state and cannot be modified by a user, so that all the problems listed above are perfectly solved.
Drawings
FIG. 1 is a schematic diagram of a two-dimensional code tamper scheme;
FIG. 2 is a schematic diagram of a way of tampering with transaction data;
FIG. 3 is a schematic diagram of the principle of ptrace, xposed, stealing payment codes;
FIG. 4 is a partition diagram of an android phone;
FIG. 5 is a schematic diagram of the operating system partition of the mobile terminal according to the present invention;
FIG. 6 is a flowchart of boot initiation of the mobile terminal operating system according to the present invention;
fig. 7 is a flowchart of the mobile terminal operating system according to the present invention for starting the restore mode.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but embodiments of the present invention are not limited thereto.
As shown in fig. 4 to 7, a method for protecting information of an operating system of a mobile terminal based on a hardware certificate includes the steps of:
s1, reading a public key in a recovery partition when a mobile terminal operating system is started through the boot partition;
when the mobile terminal operating system is started by using a boot, after kernel loading is completed, decrypting and reading the recovery partition through a public key file b.cer in the kernel of the boot partition, decrypting and reading an encrypted part of the file of the boot partition through a public key file r.cer in the kernel of the recovery partition, and after decrypting, checking the decrypted file by using the public key b.cer in the kernel; when the verification fails, the starting fails.
S2, when the mobile terminal operating system is started through the recovery partition, reading a public key in the boot partition;
when the mobile terminal operating system is started by using recovery, after kernel loading is completed, decrypting the boot partition through a public key file r.cer in the kernel of the recovery partition, checking the integrity, decrypting and reading an encrypted part of file through a public key file b.cer in the kernel of the boot partition, and after decryption, checking and decrypting and reading the file through a public key r.cer in the kernel; when the verification fails, the starting fails.
S3, after the mobile terminal operating system is started through the boot partition, the public key in the kernel of the partition is added with the public key in the kernel of the recovery partition to verify the system partition;
the method specifically comprises the following steps:
s301: after the mobile terminal operating system is started through boot partition, reading a system integrity key C and a decrypted key combination A of the local verification system;
s302: reading a verification system integrity key C and a decrypted key combination B through public key b.cer decryption in a boot partition kernel;
s303: acquiring a system decryption key A+B and checking an integrity verification key C;
s304: decrypting the read system partition boot-up into the system with decryption key A+B and verifying the system partition integrity with integrity key C;
s305: if the decryption key A+B cannot decrypt the system, the system is exited;
s306: if the integrity key D fails to verify, the starting is stopped.
S4, after the mobile terminal operating system is started through the recovery partition, the public key in the kernel of the partition is added with the public key of the boot partition to verify the system partition;
the method specifically comprises the following steps:
s401: after the mobile terminal operating system is started through the recovery partition, reading a local area verification system integrity key D and a decrypted key combination A;
s402: the recovery partition integrity generates a fingerprint decryption reading boot partition reading verification system integrity key D and a decrypted key combination B;
s403: acquiring a system decryption key A+B and checking an integrity verification key D;
s404: decrypting the read system partition with decryption key A+B and verifying the integrity of the system partition with integrity key D;
s405: if the decryption key A+B cannot be decrypted, the system partition exits the system;
s406: if the verification by the integrity fingerprint D fails, the start-up is exited.
S5, when the system integrity fingerprint verification fails, the system is started, and the system is shut down.
The method further comprises the following steps:
the hardware is firstly loaded into the mobile terminal operating system, and encryption initialization is needed to be carried out by using the IMEI of the mobile terminal as a read-write key of the kernel integrity file.
The encryption initialization uses mobile terminal IMEI as read-write key of kernel integrity file, specifically comprising the following steps:
s601: the starting system encrypts the system partition by using an asymmetric encryption algorithm, and divides a private key C into two parts;
s602: dividing a key C into two parts A and B, and respectively storing the two parts A and B in a boot partition and a recovery partition;
s603: and encrypting the boot partition and the recovery partition by using an asymmetric encryption algorithm, wherein a private key is not disclosed, and a read key is stored in an unencrypted kernel part.
Meanwhile, the invention provides:
a server comprising a processor and a memory, wherein at least one section of program is stored in the memory, and the program is loaded and executed by the processor to realize the commercial mobile terminal operating system information protection method based on hardware certificates.
A computer-readable storage medium having stored therein at least one program loaded and executed by a processor to implement the above-described method for protecting operating system information of a commercial mobile terminal based on a hardware certificate.
The normal start-up procedure is shown in fig. 6.
The Bootloader guiding system loads the kernel in the boot partition, reads the b.cer file in the kernel of the boot partition, reads the encryption part of the recovery partition through the b.cer, and reads the decryption key B. Reading an encrypted part of the boot partition through an r.cer in the recovery partition, reading a decryption key A, normally loading the boot partition, decrypting the loading system partition through the decryption key A+B, and checking the integrity of the system partition by using a key D.
The recovery mode (recovery) starts the flow as shown in fig. 7.
The Bootloader booting system loads the kernel in the recovery partition, and reads the b.cer file in the kernel of the boot partition. And reading an encrypted part of the recovery partition through the b.cer in the boot partition, normally loading the recovery partition, and entering a recovery mode system.
The mobile terminal can select two modes to start when starting the boot: boot, normal start; recovery boot, enter recovery mode. Because the user can load an independent and complete third-party operating system by rewriting the recovery guide partition, and because the files of the boot partition and the system partition are common file systems without encryption, the third-party operating system can easily modify part of the system files to realize bypassing of a system security protection mechanism, for example, an ID lock anti-riot cracking mechanism when the system is modified, and realize that the system is free from the entry password of the anti-riot cracking system. The core of the problems is that a malicious user can easily read the system file of the mobile terminal in the mode, and the security mechanism of the mobile terminal can be cracked by writing back the system after modification in decompilation, injection and other modes.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.