Guides / Famous CVEs

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

intermediateUpdated 26 Nov 2026795 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. That makes the loader very sensitive: variables such as LD_PRELOAD and LD_LIBRARY_PATH are restricted or ignored 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, in plain terms

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. 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)
RHEL 8 2.28 glibc-2.28-225.el8_8.6
RHEL 9 2.34 glibc-2.34-60.el9_2.7

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

glibc is loaded by almost every process. 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 does not matter, 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

  • Setuid programs make every environment parser a root attack surface. The fewer setuid binaries, the better: find / -xdev -perm -4000 -type f lists them.
  • Distributions change old versions. Debian 11 has glibc 2.31, older than 2.34, and still needed the fix. Check with the distribution tracker, not with the upstream version.
  • Local bugs complete remote ones. On a server, a local root bug turns a compromised web application into a compromised machine. Patch them within days, not months, especially on hosts that run code from others.

Sources

Check your servers every day

The agent of Patchbrief reports the packages and settings of a server once a day; the digest names what to fix first.

Start free