Rapid7

module

FreeBSD rtld execl() Privilege Escalation

Disclosed
Nov 30, 2009
Created
May 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).

Authors

Kingcope
stealth
bcoles [email protected]

Platform

BSD

Architectures

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

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

Title
Rapid7 Labs

2026 Global Threat Landscape Report

The predictive window has collapsed. Exploitation follows disclosure in days. See how attackers are accelerating and how to stay ahead.