Most probably if you not using a top flagship Android smart phone or tablet for a top company like Google Motorola, Samsung, HTC or LG then you are using a smart phone with Android 4.3 Jelly Bean version running aboard. And if you are using the Android 4.3 Jelly Bean or earlier version run smart phone or tablet, you, or rather your smart phone/tablet is vulnerable to a serious code-execution vulnerability. This vulnerability was discovered by the Application Security Team of IBM, nine months ago. This vulnerability has been patched in the latest Android version from Google, the 4.4 KitKat version but Android 4.3 and older Android versions remain highly vulnerable.
As per the latest data available, only 13.6 % of total Android users have Kitkat on their smart phone or tablet. Which means that around 86.4 % of Android smart phones and tablets are vulnerable to this high risk vulnerability.
The IBM security researchers discovered that the stack buffer overflow vulnerability resides in the Android’s KeyStore storage service, which is responsible for storing and securing device’s cryptographic keys.
“A stack buffer is created by the ‘KeyStore::getKeyForName’ method” “This function has several callers, which are accessible by external applications using the Binder interface (e.g., ‘android::KeyStoreProxy::get’). Therefore, the ‘keyName’ variable can be controllable with an arbitrary size by a malicious application,” Hay said. “The ‘encode_key’ routine that is called by ‘encode_key_for_uid’ can overflow the ‘filename’ buffer, since bounds checking is absent.” explained the experts
Anybody with knowledge of Android API programming can successfully exploit this vulnerability. Once exploited the hacker can execute a malicious code under the keystore process. Once executed, such code can lead to serious leaking of the device’s lock credentials. Since the master key is derived by the lock credentials, whenever the device is unlocked, ‘Android::KeyStoreProxy::password’ is called with the credentials.
It can also leak decrypted master keys, data and hardware-backed key identifiers from the memory and encrypted master keys, data and hardware-backed key identifiers from the disk for an offline attack. The hackers can also remotely interact with the hardware-backed storage and perform crypto operations (e.g., arbitrary data signing) on behalf of the user.
An potential wannabe hacker can theoretically exploit the above vulnerability that exists in all the Android devices prior to the Android 4.4 Kitkat but experts believe that exploit is pretty hard to execute due to the presence of numerous difficulties likes the need to to bypass memory-based protections native to the operating system, including Data Execution Prevention (DEP) and Address Space Layout Randomization (ASLR). The Data Execution Prevention is an exploit mitigation that is used to prevent execution of malicious code, but the attackers have had success to bypass it using the Return Oriented Programming (ROP) attacks. The ASLR is used to mitigate buffer overflow attacks randomizing the memory locations used by system files and other programs, implementing this technique it is hard to guess the location of a given process.
“However, the Android KeyStore is respawned every time it terminates. This behaviour enables a probabilistic approach; moreover, the attacker may even theoretically abuse ASLR to defeat the encoding” states the post.
The experts confirmed that they haven’t seen the flaw being exploited in the wild yet.