News: 1643158927

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

Linux distros haunted by Polkit-geist for 12+ years: Bug grants root access to any user

(2022/01/26)


Linux vendors on Tuesday issued patches for a memory corruption vulnerability in a component called polkit that allows an unprivileged logged-in user to gain full root access on a system in its default configuration.

Security vendor Qualys found the flaw and published details in a coordinated disclosure.

[1]Polkit , previously known as PolicyKit, is a tool for setting up policies governing how unprivileged processes interact with privileged ones. The vulnerability resides within polkit's pkexec , a [2]SUID-root program that's installed by default on all major Linux distributions. Designated CVE-2021-4034, the vulnerability has been given a [3]CVSS score of 7.8 .

[4]

Bharat Jogi, director of vulnerability and threat research at Qualys, explained in a [5]blog post that the pkexec flaw opens the door to root privileges for an attacker. Qualys researchers, he said, have demonstrated exploitation on default installations of Ubuntu, Debian, Fedora, and CentOS, and other Linux distributions are presumed to be vulnerable as well.

[6]

[7]

"This vulnerability has been hiding in plain sight for 12+ years and affects all versions of pkexec since its first version in May 2009," said Jogi, pointing to commit c8c3d83, which added a pkexec command.

The problem occurs when pkexec 's main() function processes command-line arguments and argc – the ARGument Count – is zero. The function tries to access the list of arguments anyway, and ends up trying to use an empty argv – the ARGument Vector of command-line argument strings. As a result, out-of-bounds memory gets read and written, which an attacker can exploit to inject an environment variable that can cause arbitrary code to be loaded from storage and run by the program as root.

[8]

"This out-of-bounds write allows us to re-introduce an 'unsecure' environment variable (for example, LD_PRELOAD ) into pkexec 's environment," explains Jogi. "These 'unsecure' variables are normally removed (by ld.so ) from the environment of SUID programs before the main() function is called."

[9]'Now' would be the right time to patch Ubuntu container hosts and ditch 21.04 thanks to heap buffer overflow bug

[10]CISA issues emergency directive to fix Log4j vulnerability

[11]Four years: That's how long Azure's App Service had a source code leak bug

[12]Open source isn't the security problem – misusing it is

The fact that these variables can be reintroduced leaves the code vulnerable. At least [13]the exploitation technique proposed by Qualys – injecting the GCONV_PATH variable into pkexec 's environment to execute a shared library as root – leaves traces in log files.

Jogi said that polkit also works with non-Linux operating systems such as Solaris and BSD. Those systems have not been tested for exploitability but OpenBSD, he said, is not affected because the kernel won't execve() – execute a program by its pathname – if argc is 0.

Patches are available for various distributions, including [14]Red Hat and [15]Ubuntu . This isn't something you'll want to leave untended particularly if you run a multi-user system. ®

Get our [16]Tech Resources



[1] https://wiki.archlinux.org/title/Polkit

[2] https://linux.die.net/man/1/pkexec

[3] https://access.redhat.com/security/cve/CVE-2021-4034

[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2YfDVd7z9mBvSe8o5x7aPbwAAABU&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0

[5] https://blog.qualys.com/vulnerabilities-threat-research/2022/01/25/pwnkit-local-privilege-escalation-vulnerability-discovered-in-polkits-pkexec-cve-2021-4034

[6] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YfDVd7z9mBvSe8o5x7aPbwAAABU&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[7] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33YfDVd7z9mBvSe8o5x7aPbwAAABU&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0

[8] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_security/front&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44YfDVd7z9mBvSe8o5x7aPbwAAABU&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0

[9] https://www.theregister.com/2022/01/20/ubuntu_2104_eol/

[10] https://www.theregister.com/2021/12/17/cisa_issues_emergency_directive_to/

[11] https://www.theregister.com/2021/12/24/azure_app_service_not_legit_source_code_leak/

[12] https://www.theregister.com/2022/01/12/open_source_isnt_the_problem/

[13] https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt

[14] https://access.redhat.com/security/vulnerabilities/RHSB-2022-001

[15] https://ubuntu.com/security/notices/USN-5252-1

[16] https://whitepapers.theregister.com/



Eyes

HildyJ

While Linux and Open Source do have a considerable advantage over closed operating systems and software because of all the eyes on the code, this points out that the eyes are mostly looking at the present and future.

The Polkit bug went unnoticed for 12+ years because the initial eyes missed it and subsequent eyes assumed what was already there was fine.

We have efforts to maintain old code (xkcd's random person in Nebraska)

But a concerted effort is needed to fund and implement a review of old code as well.

Re: Eyes

Snake

That's a dramatic statement of policy (and marketing) shift in F/OSS, and a good one. Recent years have proven that "We have more eyes on the code!" only means 'We have more eyes directed towards our [future] goals, but not necessarily reviewing our past work'.

Re: Eyes

ThePendragon

Funny, I read the same article and that is not what I got out of it at all. What got out of it is that linux is for bitches and dumb ones at that and people should use OpenBSD even though it is not always bulletproof per se either it is more secure than Linux. Linux will never be as secure as OpenBSD for political, philosophical and marketing reasons :

"OpenBSD, he said, is not affected because the kernel won't execve() – execute a program by its pathname – if argc is 0."

I say that currently running Debian on an old chromebook but I'll eventually got back into running OpenBSD on a thinkpad.

Polkit

Skiron

This is another RedHat thing that got foisted on to everybody else, isn't it?

Batteries not included.