Rapid7 Vulnerability & Exploit Database

Linux BPF doubleput UAF Privilege Escalation

Back to Search

Linux BPF doubleput UAF Privilege Escalation

Disclosed
05/04/2016
Created
05/30/2018

Description

Linux kernel 4.4 < 4.5.5 extended Berkeley Packet Filter (eBPF) does not properly reference count file descriptors, resulting in a use-after-free, which can be abused to escalate privileges. The target system must be compiled with `CONFIG_BPF_SYSCALL` and must not have `kernel.unprivileged_bpf_disabled` set to 1. Note, this module will overwrite the first few lines of `/etc/crontab` with a new cron job. The job will need to be manually removed. This module has been tested successfully on Ubuntu 16.04 (x64) kernel 4.4.0-21-generic (default kernel).

Author(s)

  • jannh <jannh@google.com>
  • h00die <mike@shorebreaksecurity.com>

Platform

Linux

Architectures

x86, x64

Development

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/linux/local/bpf_priv_esc
msf exploit(bpf_priv_esc) > show targets
    ...targets...
msf exploit(bpf_priv_esc) > set TARGET < target-id >
msf exploit(bpf_priv_esc) > show options
    ...show and set options...
msf exploit(bpf_priv_esc) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;