
Proof-of-concept exploit for CVE-2023-0386, a Linux OverlayFS local privilege escalation vulnerability. Demonstrates how incorrect file capability handling during copy-up allows unprivileged users to gain root access.
This repository provides a proof of concept for CVE-2023-0386: https://nvd.nist.gov/vuln/detail/CVE-2023-0386
Team members: Bǎnicǎ Dragoș-Marius and Borsos Matheas-Roland
Here is the video: https://www.youtube.com/watch?v=Ikux1rjIYP0
This repository contains a proof-of-concept (PoC) exploit for CVE-2023-0386, a local privilege escalation vulnerability in the Linux kernel OverlayFS subsystem.
The vulnerability allows a local, unprivileged user to escalate privileges to root by exploiting incorrect handling of file capabilities and ownership during OverlayFS copy-up operations. The PoC demonstrates how a carefully crafted OverlayFS setup can produce an executable that retains elevated privileges, even when copied from a nosuid mount.
OverlayFS is a union filesystem used to combine multiple directory trees into a single unified view. It is heavily used in:
OverlayFS consists of:
When a file from the lower layer is modified, OverlayFS performs a copy-up operation: the file is copied into the upper layer and then modified there.
The vulnerability lies in how OverlayFS handles file metadata during copy-up, specifically:
CAP_SETUID)nosuid mount optionsIn affected kernel versions:
nosuid lower layer.This breaks the security assumption that nosuid mounts prevent privilege escalation.
CVE-2023-0386_POC/
├── exp.c # Main exploit logic
├── fuse.c # User-space filesystem helper (FUSE)
├── getshell.c # Privilege escalation payload
├── ovlcap/ # OverlayFS capability test utilities
│ ├── Makefile
│ └── ...
├── Makefile # Top-level build instructions
└── README.md
nosuid lower layer.gccmakelibfuse-dev (or equivalent)libcap-dev (or equivalent)git clone https://github.com/dragosbanica/CVE-2023-0386_POC.git
cd CVE-2023-0386_POC
make all
Start two terminals and in the first one type
./fuse ./ovlcap/lower ./gc
In the second terminal type
./exp