# CVE-2021-4091: Use after free in 389-ds-base

> An attacker can crash the 389-ds-base LDAP server by sending specific search requests that trigger a double-free error in virtual attribute handling.

- **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:** 18 Feb 2022
- **Updated:** 3 Nov 2025
- **Also known as:** ALSA-2022:0889, DEBIAN-CVE-2021-4091, GHSA-qwhp-2gp7-qhfq, MGASA-2022-0106, RHSA-2022:0628, RHSA-2022:0889, RHSA-2022:1410, RLSA-2022:0889, UBUNTU-CVE-2021-4091

## What is CVE-2021-4091?

CVE-2021-4091 is a high-severity use after free vulnerability in Redhat Enterprise Linux Desktop, published on 18 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A double-free was found in the way 389-ds-base handles virtual attributes context in persistent searches. An attacker could send a series of search requests, forcing the server to behave unexpectedly, and crash.

Weakness: CWE-415 (Double Free)

## Which versions are affected by CVE-2021-4091?

It affects 8 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `389-ds-base` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `389-ds-base-devel` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `389-ds-base-legacy-tools` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `389-ds-base-libs` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `389-ds-base-snmp` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `python3-lib389` | AlmaLinux:8 | All versions | 1.4.3.23-14.module_el8.5.0+2628+c731dc97 |
| `389-ds-base` | Red Hat:enterprise_linux:7::client | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-debuginfo` | Red Hat:enterprise_linux:7::client | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-devel` | Red Hat:enterprise_linux:7::client | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-libs` | Red Hat:enterprise_linux:7::client | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-snmp` | Red Hat:enterprise_linux:7::client | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-debuginfo` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-devel` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-libs` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-snmp` | Red Hat:enterprise_linux:7::computenode | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base` | Red Hat:enterprise_linux:7::server | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-debuginfo` | Red Hat:enterprise_linux:7::server | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-devel` | Red Hat:enterprise_linux:7::server | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-libs` | Red Hat:enterprise_linux:7::server | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-snmp` | Red Hat:enterprise_linux:7::server | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-debuginfo` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-devel` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-libs` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base-snmp` | Red Hat:enterprise_linux:7::workstation | All versions | 0:1.3.10.2-15.el7_9 |
| `389-ds-base` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-debugsource` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-devel` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-legacy-tools` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-legacy-tools-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-libs` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-libs-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-snmp` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base-snmp-debuginfo` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `python3-lib389` | Red Hat:enterprise_linux:8::appstream | All versions | 0:1.4.3.23-14.module+el8.5.0+14377+c731dc97 |
| `389-ds-base` | Red Hat:rhel_eus:8.4::appstream | All versions | 0:1.4.3.16-20.module+el8.4.0+14552+b182c759 |
| `389-ds-base-debuginfo` | Red Hat:rhel_eus:8.4::appstream | All versions | 0:1.4.3.16-20.module+el8.4.0+14552+b182c759 |
| `389-ds-base-debugsource` | Red Hat:rhel_eus:8.4::appstream | All versions | 0:1.4.3.16-20.module+el8.4.0+14552+b182c759 |

Products: Port389 389-Ds-Base, Redhat Enterprise Linux Desktop, Redhat Enterprise Linux for Ibm Z Systems, Redhat Enterprise Linux for Power Big Endian, Redhat Enterprise Linux for Power Little Endian, Redhat Enterprise Linux for Scientific Computing, Redhat Enterprise Linux Server, Redhat Enterprise Linux Workstation.

## How do I fix CVE-2021-4091?

Apply the vendor's patch.

## Is CVE-2021-4091 being exploited?

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

## Other vulnerabilities in Redhat Enterprise Linux Desktop

- [CVE-2022-0918](https://insights.sbomify.com/CVE-2022-0918/): Denial of service in 389-ds-base (high 7.5)
- [CVE-2021-3652](https://insights.sbomify.com/CVE-2021-3652/): Auth bypass in 389-ds-base (medium 6.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-4091 and fix it if it is affected.

What it is: CVE-2021-4091 is a high-severity use after free vulnerability in Redhat Enterprise Linux Desktop, published on 18 Feb 2022. 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-2021-4091 in the wild and no public exploit code.

Affected product: Redhat Enterprise Linux Desktop. 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-2021-4091/ (Markdown: https://insights.sbomify.com/CVE-2021-4091/index.md)
```

## Sources

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

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