CVE-2022-34918 - Access of Resource Using Incompatible Type ('Type Confusion')

Severity

78%

Complexity

18%

Confidentiality

98%

An issue was discovered in the Linux kernel through 5.18.9. A type confusion bug in nft_set_elem_init (leading to a buffer overflow) could be used by a local attacker to escalate privileges, a different vulnerability than CVE-2022-32250. (The attacker can obtain root access, but must start with an unprivileged user namespace to obtain CAP_NET_ADMIN access.) This can be fixed in nft_setelem_parse_data in net/netfilter/nf_tables_api.c.

CVSS 3.1 Base Score 7.8. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

CVSS 2.0 Base Score 7.2. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (AV:L/AC:L/Au:N/C:C/I:C/A:C).

Demo Examples

Access of Resource Using Incompatible Type ('Type Confusion')

CWE-843

Access of Resource Using Incompatible Type ('Type Confusion')

CWE-843

Access of Resource Using Incompatible Type ('Type Confusion')

CWE-843

The following Perl code is intended to look up the privileges for user ID's between 0 and 3, by performing an access of the $UserPrivilegeArray reference. It is expected that only userID 3 is an admin (since this is listed in the third element of the array).


               
print "\$UserPrivilegeArray = $UserPrivilegeArray\n";
print "Regular user!\n";
print "Admin!\n";

In this case, the programmer intended to use "$UserPrivilegeArray->{$userID}" to access the proper position in the array. But because the subscript was omitted, the "user" string was compared to the scalar representation of the $UserPrivilegeArray reference, which might be of the form "ARRAY(0x229e8)" or similar.

Since the logic also "fails open" (CWE-636), the result of this bug is that all users are assigned administrator privileges.

While this is a forced example, it demonstrates how type confusion can have security consequences, even in memory-safe languages.

Overview

Type

Linux

First reported 2 years ago

2022-07-04 21:15:00

Last updated 2 years ago

2022-10-26 17:05:00

Affected Software

Linux Kernel

Canonical Ubuntu Linux 14.04 LTS (Long-Term Support)

14.04

Canonical Ubuntu Linux 18.04 LTS Edition

18.04

Canonical Ubuntu Linux 20.04 LTS Edition

20.04

Canonical Ubuntu Linux 16.04 ESM Edition

16.04

References

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=7e6bc1f6cabcd30aba0b11219d8e01b952eacbb6

https://www.openwall.com/lists/oss-security/2022/07/02/3

https://lore.kernel.org/netfilter-devel/[email protected]/T/#u

[oss-security] 20220705 Re: Linux kernel: Netfilter heap buffer overflow in nft_set_elem_init

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=7e6bc1f6cabcd30aba0b11219d8e01b952eacbb6

Mailing List, Patch, Vendor Advisory

https://www.openwall.com/lists/oss-security/2022/07/02/3

Exploit, Mailing List, Third Party Advisory

https://lore.kernel.org/netfilter-devel/[email protected]/T/#u

Exploit, Mailing List, Vendor Advisory

[oss-security] 20220705 Re: Linux kernel: Netfilter heap buffer overflow in nft_set_elem_init

Exploit, Mailing List, Third Party Advisory

https://www.randorisec.fr/crack-linux-firewall/

DSA-5191

[oss-security] 20220806 Re: Linux kernel: Netfilter heap buffer overflow in nft_set_elem_init

https://security.netapp.com/advisory/ntap-20220826-0004/

http://packetstormsecurity.com/files/168191/Kernel-Live-Patch-Security-Notice-LSN-0089-1.html

http://packetstormsecurity.com/files/168543/Netfilter-nft_set_elem_init-Heap-Overflow-Privilege-Escalation.html

https://www.randorisec.fr/crack-linux-firewall/

Exploit, Third Party Advisory

DSA-5191

Third Party Advisory

[oss-security] 20220806 Re: Linux kernel: Netfilter heap buffer overflow in nft_set_elem_init

Mailing List, Third Party Advisory

https://security.netapp.com/advisory/ntap-20220826-0004/

Third Party Advisory

http://packetstormsecurity.com/files/168191/Kernel-Live-Patch-Security-Notice-LSN-0089-1.html

Third Party Advisory

http://packetstormsecurity.com/files/168543/Netfilter-nft_set_elem_init-Heap-Overflow-Privilege-Escalation.html

Exploit, Third Party Advisory

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.