CVE-2021-3782 Integer overflow in wayland

Medium 6.6 Published Updated

Integer overflow in Wayland buffer pool reference counting allows use-after-free, potentially leading to code execution or memory leakage.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2021-3782?

CVE-2021-3782 is a medium-severity vulnerability in wayland, published on 23 Sep 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

An internal reference count is held on the buffer pool, incremented every time a new buffer is created from the pool. The reference count is maintained as an int; on LP64 systems this can cause the reference count to overflow if the client creates a large number of wl_shm buffer objects, or if it can coerce the server to create a large number of external references to the buffer storage. With the reference count overflowing, a use-after-free can be constructed on the wl_shm_pool tracking structure, where values may be incremented or decremented; it may also be possible to construct a limited oracle to leak 4 bytes of server-side memory to the attacking client at a time.

Weakness: CWE-190

Which versions are affected by CVE-2021-3782?

It affects 1 product.

Linux distribution packages (40)
libwayland-client AlmaLinux:8All versions1.21.0-1.el8
libwayland-cursor AlmaLinux:8All versions1.21.0-1.el8
libwayland-egl AlmaLinux:8All versions1.21.0-1.el8
libwayland-server AlmaLinux:8All versions1.21.0-1.el8
wayland-devel AlmaLinux:8All versions1.21.0-1.el8
libwayland-client Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-client-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-cursor Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-cursor-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-egl Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-egl-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-server Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
libwayland-server-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland-devel Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland-devel-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.21.0-1.el8
wayland Rocky Linux:8All versions0:1.21.0-1.el8
wayland SUSE:Enterprise Storage 7All versions1.18.0-150200.3.3.1
wayland SUSE:Enterprise Storage 7.1All versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSSAll versions1.16.0-150100.7.3.1
wayland SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSSAll versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise High Performance Computing 15 SP3-ESPOSAll versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSAll versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Micro 5.2All versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Micro 5.3All versions1.19.0-150400.3.3.1
wayland SUSE:Linux Enterprise Micro 5.4All versions1.19.0-150400.3.3.1
wayland SUSE:Linux Enterprise Module for Basesystem 15 SP4All versions1.19.0-150400.3.3.1
wayland SUSE:Linux Enterprise Real Time 15 SP3All versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Server 12 SP5All versions1.13.0-3.3.1
wayland SUSE:Linux Enterprise Server 15 SP1-LTSSAll versions1.16.0-150100.7.3.1
wayland SUSE:Linux Enterprise Server 15 SP2-LTSSAll versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Server 15 SP3-LTSSAll versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Server for SAP Applications 12 SP5All versions1.13.0-3.3.1
wayland SUSE:Linux Enterprise Server for SAP Applications 15 SP1All versions1.16.0-150100.7.3.1
wayland SUSE:Linux Enterprise Server for SAP Applications 15 SP2All versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Server for SAP Applications 15 SP3All versions1.18.0-150200.3.3.1
wayland SUSE:Linux Enterprise Software Development Kit 12 SP5All versions1.13.0-3.3.1
wayland SUSE:Manager Proxy 4.2All versions1.18.0-150200.3.3.1

Products include Wayland Wayland.

How do I fix CVE-2021-3782?

Apply the vendor's patch.

Is CVE-2021-3782 being exploited?

There is no known exploitation of CVE-2021-3782 in the wild and no public exploit code.

Sources

Also known as ALSA-2023:2786, AZL-11019, DEBIAN-CVE-2021-3782, GHSA-pvw2-9h4r-c5cr, JLSEC-2026-97, MGASA-2022-0418 and 10 more.

Is CVE-2021-3782 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free