Rapid7 Vulnerability & Exploit Database

FreeBSD rtld execl() Privilege Escalation

Back to Search

FreeBSD rtld execl() Privilege Escalation

Disclosed
11/30/2009
Created
05/21/2019

Description

This module exploits a vulnerability in the FreeBSD run-time link-editor (rtld). The rtld `unsetenv()` function fails to remove `LD_*` environment variables if `__findenv()` fails. This can be abused to load arbitrary shared objects using `LD_PRELOAD`, resulting in privileged code execution. This module has been tested successfully on: FreeBSD 7.2-RELEASE (amd64); and FreeBSD 8.0-RELEASE (amd64).

Author(s)

  • Kingcope
  • stealth
  • bcoles <bcoles@gmail.com>

Platform

BSD

Architectures

x86, x64, armle, aarch64, ppc, mipsle, mipsbe

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

;