A privilege-escalation bug in the Linux kernel, that could allow any application to gain root-level access and take over a device, has been present in the kernel since version 2.6.22 which was released in 2007.
The bug, dubbed Dirty COW, is being exploited in the wild, with Linux developer Phil Oester spotting the exploit as it was being uploaded to one of his webservers.
The bug is present in all GNU/Linux distributions and the better known among them like Red Hat, Debian and Ubuntu have all released patches.
It is also present in Android, which uses the Linux kernel, and in many devices like routers that use the kernel.
{loadposition sam08}According to the Red Hat advisory, the bug is due to a race condition in the way the kernel's memory subsystem handles the copy-on-write (COW) breakage of private read-only memory mappings.
This flaw could be utilised by an unprivileged local user to gain write access to otherwise read-only memory mappings and thus increase their privileges on the system.
Linux creator Linus Torvalds has admitted that he tried to fix this bug 11 years ago but did not succeed because of other changes in the kernel.
Security firm Immunity has released proof-of-concept code for its customers to test.
Oester told Ars Technica: "For the past few years, I have been capturing all inbound traffic to my webservers for forensic analysis. This practice has proved invaluable on numerous occasions, and I would recommend it to all admins. In this case, I was able to extract the uploaded binary from those captures to analyse its behaviour, and escalate to the appropriate Linux kernel maintainers.
“The vulnerability is easiest exploited with local access to a system such as shell accounts. Less trivially, any web server/application vulnerability which allows the attacker to upload a file to the impacted system and execute it also works."
A community group has set up a site to provide details about the bug.