An application that allows users to gain full control -- root access -- over their Android devices is taking advantage of a security flaw in the Linux kernel that has remained unpatched in Android since its discovery two years ago.

The bug was originally fixed in the Linux kernel in April 2014, but wasn't flagged as a vulnerability until February 2015 when its security implications were understood and it received the CVE-2015-1805 identifier. Even then, the fix did not get ported to Android, which is based on the Linux kernel.

It wasn't until Feb. 19 that researchers from a security outfit called C0RE Team notified Google that the vulnerability could be exploited on Android in order to achieve privilege escalation -- the execution of code with the privileges of the root account.

Google started working on a patch that was scheduled to be included in a future monthly update, but then on Mar. 15 researchers from mobile security team Zimperium alerted the company that this vulnerability was already being used to root devices.

Rooting refers to the process of removing the security restrictions normally enforced by Android for third-party applications and giving them full control over the device. Rooting is legitimately used by Android enthusiasts to unlock functionality that's not normally available on their devices, but can also be abused by malware.

Because of this, rooting tools are not allowed on the Google Play app store and their installation is detected and blocked locally through Android's built-in Verify Apps scanner.

"Google has confirmed the existence of a publicly available rooting application that abuses this vulnerability on Nexus 5 and Nexus 6 to provide the device user with root privileges," Google said in an emergency security advisory.

While this particular rooting tool is not classified as malicious, the danger exists that attackers could exploit the same vulnerability to spread malware.

Google has already shared patches for the flaw with device manufacturers and also published them to the Android Open Source Project (AOSP) for the 3.4, 3.10 and 3.14 versions of the Android kernel. Versions 3.18 and above are not vulnerable.

The company also plans to include the patches in the April monthly security updates for its Nexus devices.

Meanwhile, users are advised to download apps only from Google Play and to have the Verify Apps setting turned on. Devices that list a security patch level of March 18, 2016 or later are already protected.