Live data from Hacker News

Linux kernel use-after-free in Netfilter, local privilege escalation

seclists.org

1–10 of 107 posts

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#4
> delete an existing nft rule that uses an nft anonymous set. And an example of the latter operation is an attempt to delete an element from that nft anonymous set after the set gets deleted

I'd be very interested to hear how this can be done by an unprivileged user.

Try to race set add/removals, sure, but if it depends on the set itself getting deleted, that seems… harder.

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#5
post #2

Glad to have sticked with the good old iptables and left CONFIG_NF_TABLES unset in kernel configuration.

Aren't iptables just an emulation layer on top of netfilter?

Probably depends on the distro. Iptables is a wrapper around nftables in most distros, but probably not all.

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#6
post #2

Glad to have sticked with the good old iptables and left CONFIG_NF_TABLES unset in kernel configuration.

Aren't iptables just an emulation layer on top of netfilter?

Yes, AFAIU (not an expert), iptables and nftables are two command line tools and abstractions (chains vs. tables) for interacting with the same underlying netfilter API.

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#7
post #4

> delete an existing nft rule that uses an nft anonymous set. And an example of the latter operation is an attempt to delete an element from that nft anonymous set after the set gets deleted I'd be very interested to hear how this can be done by an unprivileged user. Try to race set add/removals, sure, but if it depends on the set itself getting deleted, that seems… harder.

on https://bugzilla.redhat.com/show_bug.cgi?id=2196105 a comment suggests that it might only be possible if you have "unprivileged user namespaces" enabled

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#8
"We developed an exploit that allows unprivileged local users to start a root shell by abusing the above issue. That exploit was shared privately with to assist with fix development. Somebody from the Linux kernel team then emailed the proposed fix to and that email also included a link to download our description of exploitation techniques and our exploit source code.

Therefore, according to the linux-distros list policy, the exploit must be published within 7 days from this advisory. In order to comply with that policy, I intend to publish both the description of exploitation techniques and also the exploit source code on Monday 15th by email to this list."

Interesting.. they didn't write what conditions have to be met for it to be exploitable. Also interesting that someone screwed up and accidentally forwarded an email including the exploit to a broad mailing list...

Part of the nf modules are active if you have iptables, which you have if you run ufw (for example), so pretty broad exploit if that's all that's required, but the specific module in question in the patch, nf_tables, is not loaded on my Ubuntu 20.04LTS 5.40 kernel running iptables/ufw at least.

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#9

Earlier quoted context omitted.

Aren't iptables just an emulation layer on top of netfilter?

Yes, AFAIU (not an expert), iptables and nftables are two command line tools and abstractions (chains vs. tables) for interacting with the same underlying netfilter API.

I believe at one time they were two separate subsystems, but they got merged in 4.x or 5.x

Re: Linux kernel use-after-free in Netfilter, local privilege escalation

#10
post #8

"We developed an exploit that allows unprivileged local users to start a root shell by abusing the above issue. That exploit was shared privately with to assist with fix development. Somebody from the Linux kernel team then emailed the proposed fix to and that email also included a link to download our description of exploitation techniques and our exploit source code. Therefore, according to the linux-distros list p…

> but the specific module in question in the patch, nf_tables, is not loaded on my Ubuntu 20.04LTS 5.40 kernel running iptables/ufw at least

This doesn't matter since Linux has autoloading of most network modules, and you can cause the modules to be loaded on Ubuntu since it supports unprivileged user/net namespaces.

  ubuntu:~% grep DISTRIB_DESCRIPTION /etc/lsb-release
  DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
  ubuntu:~% lsmod|grep nf_table
  ubuntu:~% unshare -U -m -n -r
  ubuntu:~% nft add table inet filter
  ubuntu:~% lsmod|grep nf_table
  nf_tables             249856  0
Post reply on HN