Cross-signature certificate vulnerability in Android system can cause system crash
Overview
Trend Micro discovered a vulnerability affecting cross-signature certificate processing in Android. The current Android version does not properly process these certificates. When two certificates are signed with A ring certificate chain (certificate A signature certificate B; Certificate B signature certificate A), these certificates are created. Trend Micro has reported this vulnerability to Google and has not provided any patches or fixed fix time.
When a specially constructed malicious certificate is imported into an Android device (by installing a new app or importing a certificate), unexpected errors may occur, the device may slow down or be in the suspended state, and can only be forcibly restarted.
Vulnerability description
This vulnerability is caused by JarFile and KeyStore, two common classes in the android framework. Any Android function that calls one of them directly or indirectly may be attacked by cross-signature certificates.
JarUtils class
JarUtils (./libcore/luni/src/main/java/org/apache/harmony/security/utils/JarUtils. java ). This type is used to verify the certificate and signature file of the jar package. However, the JarUtils class cannot properly process the loop certificate chain and bring it into an endless loop. This problem exists in all android versions.
KeyStore class
KeyStore (for example,./external/bouncycastle/src/main/java/org/bouncycastle/jce/provider/JDKPKCS12KeyStore. java) is used to process PKCS #12 files of Android KeyStore. If the PKCS #12 file contains a loop certificate chain, code processing will also be in an endless loop.
POC
Trend Micro verifies this vulnerability in two situations: Install a specially constructed app to an Android device, and import a specially constructed key chain ). By using different Certificate Signing requests to manipulate the signature process, we can easily obtain A pair of cross-signature certificates:. the issuer of cert is B. cert, and B. the issuer of cert is. cert.
In the first scenario, we will install a new app signed by the above certificate. The new app we created is created by. the app name is LoopCertsChain signed by cert. We try to install it on an Android device (the Android device of version 4.1.2 is used below, and versions earlier than 4.4 are affected ). We get the following false-dead interface.
After further checks, we found that a key process (system_server) in Android is constantly using system resources until the process ends, which causes the device to restart. You have no other options for this issue.
In the second scenario, we import a malicious PKS #12 file with a loop certificate to the Android device.
The corresponding android process com. android. certinstaller is in an endless loop and can only be killed.
Up to now, this vulnerability has not produced direct security problems, but more scenarios such as arbitrary code execution may be found in future studies.