Rapid7 Vulnerability & Exploit Database

Sudo Heap-Based Buffer Overflow

Back to Search

Sudo Heap-Based Buffer Overflow

Disclosed
01/26/2021
Created
02/04/2021

Description

A heap based buffer overflow exists in the sudo command line utility that can be exploited by a local attacker to gain elevated privileges. The vulnerability was introduced in July of 2011 and affects version 1.8.2 through 1.8.31p2 as well as 1.9.0 through 1.9.5p1 in their default configurations. The technique used by this implementation leverages the overflow to overwrite a service_user struct in memory to reference an attacker controlled library which results in it being loaded with the elevated privileges held by sudo.

Author(s)

  • Qualys
  • Spencer McIntyre
  • bwatters-r7
  • smashery
  • blasty <blasty@fail0verflow.com>
  • worawit
  • Alexander Krog

Platform

Linux,Unix

Architectures

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

;