Guides / Famous CVEs

Looney Tunables (CVE-2023-4911): root through the glibc loader

intermediateUpdated 26 Nov 2026900 words

On 2023-10-03 Qualys published Looney Tunables, a buffer overflow in the dynamic loader of glibc. Any local user could become root by starting a setuid program with a crafted GLIBC_TUNABLES environment variable. Qualys exploited it on default installations of Fedora 37 and 38, Ubuntu 22.04 and 23.04, and Debian 12 and 13. CISA added it to the KEV catalog on 2023-11-21.

What broke

Every dynamically linked program on Linux starts in ld.so, the loader of glibc, which loads shared libraries before main() runs. When the program is setuid root, the loader runs with root privileges while it reads an environment the user chose. For that reason the loader restricts or ignores variables such as LD_PRELOAD and LD_LIBRARY_PATH for setuid programs.

GLIBC_TUNABLES lets users adjust glibc settings, for example glibc.malloc.mxfast=64. For setuid programs the loader copies the variable and removes the tunables that are not safe. The code that did this, added in April 2021 for glibc 2.34 (commit 2ed18c), mishandled a value of the form name=name=value: it wrote past the end of its buffer.

How the attack worked

The attacker starts a setuid-root program, such as su, with a crafted GLIBC_TUNABLES and a large block of other environment strings. The overflow overwrites a pointer the loader later uses to decide which directories to trust for libraries. The attacker makes it point at the environment strings on the stack, which name a directory they own, and the loader then loads the libc of the attacker from there, as root.

Stack addresses are randomised, so the attack guesses: in the Qualys tests the brute force took about 30 seconds on Debian and about 5 minutes on Ubuntu and Fedora, where crash handlers slowed it down. It worked against almost every setuid-root program installed by default. Exceptions were sudo (its own library path overrides the overwritten one), chage and passwd on Fedora (SELinux rules) and snap-confine on Ubuntu (AppArmor rules).

The CVSS v3.1 score is 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Who was affected

The CVE record lists glibc 2.34 up to, not including, 2.39. Some distributions with older glibc versions needed the fix too, because they carry changes from newer releases, so the upstream number alone does not tell you. Fixed packages, among others:

Release glibc Fixed package
Debian 10 2.28 not affected
Debian 11 2.31 2.31-13+deb11u7 (DSA-5514-1)
Debian 12 2.36 2.36-9+deb12u3 (DSA-5514-1)
Ubuntu 20.04 2.31 not affected
Ubuntu 22.04 2.35 2.35-0ubuntu3.4 (USN-6409-1)
RHEL 7 2.17 not affected
RHEL 8 2.28 glibc-2.28-225.el8_8.6 (RHSA-2023:5455)
RHEL 9 2.34 glibc-2.34-60.el9_2.7 (RHSA-2023:5453)

Alpine Linux uses musl, not glibc, and was not affected.

How to check a server today

Check the glibc package:

dpkg-query -W libc6     # Debian, Ubuntu
rpm -q glibc            # RHEL family
ldd --version | head -1

Qualys published a test that crashes a vulnerable loader and does nothing on a fixed one. Run it as a normal user:

env -i "GLIBC_TUNABLES=glibc.malloc.mxfast=glibc.malloc.mxfast=A" \
  "Z=$(printf '%08192x' 1)" /usr/bin/su --help >/dev/null
echo "exit code $?"

A vulnerable system prints Segmentation fault and an exit code of 139. On a fixed Debian 12 (libc6 2.36-9+deb12u14) the exit code is 0.

After the update

Almost every process loads glibc. The fix protects new processes at once, because the loader runs fresh for each program start, and the attack needs a new start of a setuid program. Long-running services keep the old library in memory until they restart. For this CVE that makes no difference, but for other glibc fixes it does: restart services after a glibc update, or reboot. needrestart on Debian and Ubuntu lists what still uses the old library.

How it was fixed

glibc fixed the parser (commit 1056e5b4c3f2 upstream), and the fix was backported to the stable branches and by the distributions. Debian shipped it in DSA-5514-1.

What to take from it

Every setuid program hands the environment parsing of the loader to any local user, with root privileges. Keep the number of setuid binaries low; find / -xdev -perm -4000 -type f lists them.

Debian 11 has glibc 2.31, older than 2.34, and still needed the fix, because Debian had backported the vulnerable code into its package 2.31-12. Ubuntu 20.04, also on glibc 2.31, was not affected. Debian 10 and RHEL 8 both have glibc 2.28, and only RHEL 8 needed the fix. Check with the distribution tracker, not with the upstream version.

On a server, a local root bug turns a compromised web application into a compromised machine. Patch local root bugs within days, especially on hosts that run code from others.

Sources

Check your servers every day

The Vulnpocalypse collector reports the packages and settings of a server once a day, and the digest lists what to fix, most urgent first.

Start free