# CVE-2023-3138: Memory corruption in libX11

> A malicious X server or proxy can cause client crashes via out-of-bounds writes in libX11 due to missing bounds checks on protocol IDs.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Jun 2023
- **Updated:** 2 Aug 2024
- **Also known as:** ALPINE-CVE-2023-3138, ALSA-2023:6497, ALSA-2023:7029, AZL-27274, CLSA-2025-1745270046, DEBIAN-CVE-2023-3138, DLA-3472-1, DSA-5433-1, GHSA-849h-8wj5-xmx8, JLSEC-2026-472, MGASA-2023-0206, OESA-2023-1376, OESA-2023-1377, OESA-2023-1378, OESA-2023-1392, RHSA-2023:6497, RHSA-2023:7029, RHSA-2024:1088, RHSA-2024:1417, SUSE-SU-2023:2531-1, SUSE-SU-2023:2614-1, UBUNTU-CVE-2023-3138, USN-6168-1, USN-6168-2, openSUSE-SU-2024:13008-1

## What is CVE-2023-3138?

CVE-2023-3138 is a high-severity memory corruption vulnerability in Redhat Enterprise Linux, published on 28 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A vulnerability was found in libX11. The security flaw occurs because the functions in src/InitExt.c in libX11 do not check that the values provided for the Request, Event, or Error IDs are within the bounds of the arrays that those functions write to, using those IDs as array indexes. They trust that they were called with values provided by an Xserver adhering to the bounds specified in the X11 protocol, as all X servers provided by X.Org do. As the protocol only specifies a single byte for these values, an out-of-bounds value provided by a malicious server (or a malicious proxy-in-the-middle) can only overwrite other portions of the Display structure and not write outside the bounds of the Display structure itself, possibly causing the client to crash with this memory corruption.

Weakness: CWE-787 (Out-of-bounds Write), CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer)

## Which versions are affected by CVE-2023-3138?

It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libX11` | AlmaLinux:8 | All versions | 1.6.8-6.el8 |
| `libX11-common` | AlmaLinux:8 | All versions | 1.6.8-6.el8 |
| `libX11-devel` | AlmaLinux:8 | All versions | 1.6.8-6.el8 |
| `libX11-xcb` | AlmaLinux:8 | All versions | 1.6.8-6.el8 |
| `libX11` | AlmaLinux:9 | All versions | 1.7.0-8.el9 |
| `libX11-common` | AlmaLinux:9 | All versions | 1.7.0-8.el9 |
| `libX11-devel` | AlmaLinux:9 | All versions | 1.7.0-8.el9 |
| `libX11-xcb` | AlmaLinux:9 | All versions | 1.7.0-8.el9 |
| `libX11` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-common` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-xcb` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11-xcb-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.6.8-6.el8 |
| `libX11` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-common` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-debugsource` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-devel` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-xcb` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11-xcb-debuginfo` | Red Hat:enterprise_linux:9::appstream | All versions | 0:1.7.0-8.el9 |
| `libX11` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-common` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-debuginfo` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-debugsource` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-devel` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-xcb` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11-xcb-debuginfo` | Red Hat:rhel_eus:8.8::appstream | All versions | 0:1.6.8-6.el8_8 |
| `libX11` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-common` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-debuginfo` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-debugsource` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-devel` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-xcb` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11-xcb-debuginfo` | Red Hat:rhel_eus:9.2::appstream | All versions | 0:1.7.0-8.el9_2 |
| `libX11` | SUSE:Enterprise Storage 7 | All versions | 1.6.5-150000.3.30.1 |
| `libX11` | SUSE:Enterprise Storage 7.1 | All versions | 1.6.5-150000.3.30.1 |
| `libX11` | SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 1.6.5-150000.3.30.1 |
| `libX11` | SUSE:Linux Enterprise High Performance Computing 15 SP2-LTSS | All versions | 1.6.5-150000.3.30.1 |

Products: Redhat Enterprise Linux, X.org Libx11.

## How do I fix CVE-2023-3138?

Apply the vendor's patch.

## Is CVE-2023-3138 being exploited?

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

## Other vulnerabilities in Redhat Enterprise Linux

- [CVE-2018-14667](https://insights.sbomify.com/CVE-2018-14667/): Red Hat JBoss RichFaces Framework Expression Language Injection (critical 9.8, exploited in the wild)
- [CVE-2021-20325](https://insights.sbomify.com/CVE-2021-20325/): Missing fixes for CVE-2021-40438 and CVE-2021-26691 in the versions of httpd, as shipped in Red Hat Enterprise Linux 8.5.0, causes a securit (critical 9.8)
- [CVE-2018-25011](https://insights.sbomify.com/CVE-2018-25011/): Memory corruption in libwebp (critical 9.8)
- [CVE-2018-25014](https://insights.sbomify.com/CVE-2018-25014/): Other in libwebp (critical 9.8)
- [CVE-2014-3585](https://insights.sbomify.com/CVE-2014-3585/): Supply chain in redhat-upgrade-tool (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-3138 and fix it if it is affected.

What it is: CVE-2023-3138 is a high-severity memory corruption vulnerability in Redhat Enterprise Linux, published on 28 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-3138 in the wild and no public exploit code.

Affected product: Redhat Enterprise Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-3138/ (Markdown: https://insights.sbomify.com/CVE-2023-3138/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-3138
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-3138
- OSV: https://osv.dev/vulnerability/CVE-2023-3138

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-3138/
Summaries are generated and may contain mistakes; the official description above is the record.
