Rapid7 Vulnerability & Exploit Database

OpenBSD Dynamic Loader chpass Privilege Escalation

Back to Search

OpenBSD Dynamic Loader chpass Privilege Escalation

Disclosed
12/11/2019
Created
12/27/2019

Description

This module exploits a vulnerability in the OpenBSD `ld.so` dynamic loader (CVE-2019-19726). The `_dl_getenv()` function fails to reset the `LD_LIBRARY_PATH` environment variable when set with approximately `ARG_MAX` colons. This can be abused to load `libutil.so` from an untrusted path, using `LD_LIBRARY_PATH` in combination with the `chpass` set-uid executable, resulting in privileged code execution. This module has been tested successfully on: OpenBSD 6.1 (amd64); and OpenBSD 6.6 (amd64)

Author(s)

  • Qualys
  • bcoles <bcoles@gmail.com>

Platform

BSD,Unix

Architectures

cmd

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

;