CVE-2023-1386
High · 7.8CVSS
7.8
EPSS
0.2%
Published
Jul 24, 2023
CISA due date
—
Cloudanix analysis
A bug in virtual-machine software can let someone already inside a virtual machine keep special access rights on files they create, which could let them take over the virtual machine and sometimes the computer running it.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Privilege Gain
- Component
- Application
- Class
- Privilege Escalation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The 9p passthrough filesystem in QEMU fails to strip SUID and SGID bits when a guest user writes executable files, allowing those privilege bits to persist on the host filesystem backing the share.
Why it matters to the business
Attackers who already have a foothold inside a virtual machine can obtain elevated rights inside that guest and, in limited configurations, leverage the flaw to gain elevated rights on the hypervisor host, increasing the blast radius of a single compromised VM.
How an attack unfolds
A local attacker inside the guest writes a binary with SUID or SGID permissions through a 9p-mounted share; because the bits are not cleared, the file retains those permissions on the host side. The attacker then executes the binary inside the guest to obtain elevated privileges and, under rare shared-filesystem configurations, can abuse the same file to affect the host.
How to fix it
Upgrade QEMU to a release containing the corrected 9pfs implementation that properly drops SUID/SGID bits on writes. If an immediate update is not possible, disable or restrict 9pfs shares for untrusted guests and avoid exposing host directories that contain setuid binaries.
How to confirm the fix worked
Confirm the installed QEMU version is newer than the vulnerable releases, then create a test executable with SUID bits inside the guest via the 9p share and verify the bits are stripped on the host side.
Typical attack path
- Obtain local access inside a QEMU guest that exposes a 9pfs share
- Compile or copy an executable and set SUID/SGID mode bits while writing it via the 9p mount
- Execute the resulting binary inside the guest to gain elevated privileges
- Abuse the retained permissions on the host-side backing file to escalate on the hypervisor (rare)
How to detect it
Search guest and host audit logs for creation or chmod operations on files with SUID/SGID bits inside 9p-mounted directories; monitor for unexpected setuid binaries appearing in shared host paths.
What your security team should do
- Apply the QEMU security update as soon as packages are available in your distribution
- Audit all VMs that use 9pfs shares and restrict the feature to trusted workloads only
- Enable file-integrity monitoring on host directories exposed via 9pfs to detect unexpected SUID/SGID files
The record
A flaw was found in the 9p passthrough filesystem (9pfs) implementation in QEMU. When a local user in the guest writes an executable file with SUID or SGID, none of these privileged bits are correctly dropped. As a result, in rare circumstances, this flaw could be used by malicious users in the guest to elevate their privileges within the guest and help a host local user to elevate privileges on the host.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | qemu | 0 | No fix |
| Debian:12 | qemu | 0 | No fix |
| Debian:13 | qemu | 0 | No fix |
| Ubuntu:20.04:LTS | qemu | 0 | No fix |
| Ubuntu:22.04:LTS | qemu | 0 | No fix |
| Ubuntu:24.04:LTS | qemu | 0 | No fix |
| Ubuntu:24.10 | qemu | 0 | No fix |
| Ubuntu:25.04 | qemu | 0 | No fix |
| Ubuntu:25.10 | qemu | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | qemu | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | qemu | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | qemu | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | qemu | 0 | No fix |
Related vulnerabilities
- CVE-2024-7730 A heap buffer overflow was found in the virtio-snd device in QEMU. Also affects qemu
- CVE-2024-3447 A heap-based buffer overflow was found in the SDHCI device emulation of QEMU. Also affects qemu
- CVE-2024-6519 A use-after-free vulnerability was found in the QEMU LSI53C895A SCSI Host Bus Adapter… Also affects qemu
- CVE-2024-8612 A flaw was found in QEMU, in the virtio-scsi, virtio-blk, and virtio-crypto devices. Also affects qemu
- CVE-2024-8354 A flaw was found in QEMU. Also affects qemu
- CVE-2024-7409 A flaw was found in the QEMU NBD Server. Also affects qemu
- CVE-2024-6505 A flaw was found in the virtio-net device in QEMU. Also affects qemu
- CVE-2024-4467 A flaw was found in the QEMU disk image utility (qemu-img) 'info' command. Also affects qemu