# CVE-2023-28859: redis-py Race Condition due to incomplete fix

> An attacker can read response data from unrelated requests due to connection leakage in the async Redis client.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 26 Mar 2023
- **Updated:** 20 Feb 2025
- **Also known as:** GHSA-8fww-64cx-x8p5, PYSEC-2023-46, UBUNTU-CVE-2023-28859

## What is CVE-2023-28859?

CVE-2023-28859 is a medium-severity vulnerability in n/a, published on 26 Mar 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

redis-py before 4.4.4 and 4.5.x before 4.5.4 leaves a connection open after canceling an async Redis command at an inopportune time, and can send response data to the client of an unrelated request. (This could, for example, happen for a non-pipeline operation.) NOTE: the solutions for CVE-2023-28859 address data leakage across AsyncIO connections in general.

Weakness: CWE-459 (Incomplete Cleanup)

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

5 open source packages ship an affected version, including redis. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `redis` | PyPI | From 4.2.0 | 4.4.4, 4.5.4 |
| `redis` | PyPI | From 4.2.0 | 4.4.4 |
| `redis` | PyPI | From 4.2.0 | 4.4.4 |
| `redis` | PyPI | From 4.5.0 | 4.5.4 |
| `redis` | PyPI | From 4.5.0 | 4.5.4 |

Products: Redis Redis-Py.

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

Upgrade redis to a fixed version for your release line: 4.4.4 or 4.5.4.

## Is CVE-2023-28859 being exploited?

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

## Other vulnerabilities in n/a

- [CVE-2023-28858](https://insights.sbomify.com/CVE-2023-28858/): redis-py Race Condition vulnerability (low 3.7)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-28859 is a medium-severity vulnerability in n/a, published on 26 Mar 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-28859 in the wild and no public exploit code.

Affected packages and fixed versions:
- redis (PyPI): affected from 4.2.0; fixed in 4.4.4, 4.5.4
- redis (PyPI): affected from 4.2.0; fixed in 4.4.4
- redis (PyPI): affected from 4.2.0; fixed in 4.4.4
- redis (PyPI): affected from 4.5.0; fixed in 4.5.4
- redis (PyPI): affected from 4.5.0; fixed in 4.5.4

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-28859/ (Markdown: https://insights.sbomify.com/CVE-2023-28859/index.md)
```

## Sources

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

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