module

FreeBSD ip6_setpktopt Use-After-Free Privilege Escalation

Disclosed
2020-07-07
Created
2020-07-30

Description

This module exploits a race and use-after-free vulnerability in the
FreeBSD kernel IPv6 socket handling. A missing synchronization lock
in the `IPV6_2292PKTOPTIONS` option handling in `setsockopt` permits
racing `ip6_setpktopt` access to a freed `ip6_pktopts` struct.

This exploit overwrites the `ip6po_pktinfo` pointer of a `ip6_pktopts`
struct in freed memory to achieve arbitrary kernel read/write.

This module has been tested successfully on:

FreeBSD 9.0-RELEASE #0 (amd64);
FreeBSD 9.1-RELEASE #0 r243825 (amd64);
FreeBSD 9.2-RELEASE #0 r255898 (amd64);
FreeBSD 9.3-RELEASE #0 r268512 (amd64);
FreeBSD 12.0-RELEASE r341666 (amd64); and
FreeBSD 12.1-RELEASE r354233 (amd64).

Authors

Andy Nguyen
bcoles bcoles@gmail.com

Platform

BSD

Architectures

x64

Module Options

To display the available options, load the module within the Metasploit console and run the commands ‘show options’ or ‘show advanced’:


msf > use exploit/freebsd/local/ip6_setpktopt_uaf_priv_esc
msf exploit(ip6_setpktopt_uaf_priv_esc) > show targets
...targets...
msf exploit(ip6_setpktopt_uaf_priv_esc) > set TARGET < target-id >
msf exploit(ip6_setpktopt_uaf_priv_esc) > show options
...show and set options...
msf exploit(ip6_setpktopt_uaf_priv_esc) > exploit

Title
NEW

Explore Exposure Command

Confidently identify and prioritize exposures from endpoint to cloud with full attack surface visibility and threat-aware risk context.