Rapid7 Vulnerability & Exploit Database

glibc 'realpath()' Privilege Escalation

Back to Search

glibc 'realpath()' Privilege Escalation

Disclosed
01/16/2018
Created
06/14/2018

Description

This module attempts to gain root privileges on Linux systems by abusing a vulnerability in GNU C Library (glibc) version 2.26 and prior. This module uses halfdog's RationalLove exploit to exploit a buffer underflow in glibc realpath() and create a SUID root shell. The exploit has offsets for glibc versions 2.23-0ubuntu9 and 2.24-11+deb9u1. The target system must have unprivileged user namespaces enabled. This module has been tested successfully on Ubuntu Linux 16.04.3 (x86_64) with glibc version 2.23-0ubuntu9; and Debian 9.0 (x86_64) with glibc version 2.24-11+deb9u1.

Author(s)

  • halfdog
  • bcoles <bcoles@gmail.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/glibc_realpath_priv_esc
msf exploit(glibc_realpath_priv_esc) > show targets
    ...targets...
msf exploit(glibc_realpath_priv_esc) > set TARGET < target-id >
msf exploit(glibc_realpath_priv_esc) > show options
    ...show and set options...
msf exploit(glibc_realpath_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

;