This one has a public, reliable exploit, and CISA says ransomware crews have used it. Worth double-checking your servers.

At a glance

  • CVE: CVE-2024-1086
  • Severity: 7.8 (High) on NVD, and Red Hat rates it Important. It’s local only: the attacker has to be running code on the machine first.
  • Affected: Linux 3.15 up to (but not including) 5.15.149, 6.1.76, 6.6.15 and 6.7.3, plus 6.8 release candidates. That covers a lot of servers: Ubuntu 16.04 through 23.10, Debian 10 through 12, and RHEL 7, 8 and 9 all needed updates. Ubuntu 24.04 isn’t affected.
  • Known exploited: Yes. CISA added it to its Known Exploited Vulnerabilities (KEV) catalog on 2024-05-30 and says it’s known to be used in ransomware campaigns.

What’s going on

This is a bug in nf_tables, the engine behind the nftables firewall. When a firewall rule decides to drop a packet, it can attach an error code to that “drop” verdict. The kernel expected either zero or a proper (negative) error code there, but it let positive values through too, including one that looks exactly like “accept”. The packet-handling code then got confused, freed memory and kept using it: a use-after-free (NVD’s description calls it a double free).

The researcher who found it, Notselwyn, published a detailed write-up and a working exploit. His README says the exploit works on unpatched kernels from 5.14 through 6.6, succeeds 99.4% of the time on KernelCTF images, and runs out of the box on Debian and Ubuntu, because they ship with unprivileged user namespaces and nf_tables turned on. A public exploit that reliably works on common server distros is exactly why this one deserves your attention.

For web hosting, this is a textbook local privilege escalation. A shell as www-data from a vulnerable plugin, or a leaked SSH key for a non-root user, becomes root on the server. On a Docker host or Kubernetes node, that’s root on the node.

Timeline

  • Fixed upstream: 2024-01-24 (commit f342de4e2f33, part of 6.8-rc2)
  • Published to NVD: 2024-01-31
  • Stable kernel fixes: February 2024, per the researcher’s README
  • Distro patches: Red Hat shipped RHEL 7 updates on 2024-03-12, RHEL 8 on 2024-04-02 and RHEL 9 on 2024-04-30
  • Added to CISA KEV: 2024-05-30

== UPDATE ==

Patches are out for every major distro. With a public exploit and ransomware use, don’t let this one sit.

  • Patch available: Yep.
  • Fixed in: upstream 5.15.149, 6.1.76, 6.6.15, 6.7.3, 6.8 and later. Distro examples: Ubuntu 22.04 kernel 5.15.0-101.111, Ubuntu 20.04 5.4.0-174.193, Debian 12 “bookworm” 6.1.76-1, Debian 11 “bullseye” 5.10.209-2, RHEL 9 5.14.0-427.13.1.el9_4, RHEL 8 4.18.0-513.24.1.el8_9 and RHEL 7 3.10.0-1160.114.2.el7. Check your distro’s tracker (linked below) for your release.
  • How to apply: update the kernel and reboot: sudo apt update && sudo apt upgrade on Debian/Ubuntu, sudo dnf upgrade --refresh on RHEL 8/9 and friends, or sudo yum update kernel on RHEL/CentOS 7. Then check uname -r to make sure the new kernel is the one running.
  • If you can’t patch yet: you’ve got two stopgaps, both from the distros. First, turn off unprivileged user namespaces. On Ubuntu that’s sudo sysctl -w kernel.unprivileged_userns_clone=0, and to keep it after a reboot, echo kernel.unprivileged_userns_clone=0 | sudo tee /etc/sysctl.d/99-disable-unpriv-userns.conf. On RHEL, put user.max_user_namespaces=0 in /etc/sysctl.d/userns.conf and run sudo sysctl -p /etc/sysctl.d/userns.conf. Don’t do this on container hosts that need user namespaces. Second, Red Hat suggests blocking the nf_tables module from loading, but that’s only safe if nothing on the box uses nftables, so check your firewall setup first.

References