# CVE-2023-28858: redis-py Race Condition vulnerability

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

- **Severity:** Low 3.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 26 Mar 2023
- **Updated:** 20 Feb 2025
- **Also known as:** DEBIAN-CVE-2023-28858, GHSA-24wv-mv5m-xv4h, PYSEC-2023-45, UBUNTU-CVE-2023-28858

## What is CVE-2023-28858?

CVE-2023-28858 is a low-severity vulnerability in n/a, published on 26 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

redis-py before 4.5.3 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 in an off-by-one manner. NOTE: this CVE Record was initially created in response to reports about ChatGPT, and 4.3.6, 4.4.3, and 4.5.3 were released (changing the behavior for pipeline operations); however, please see CVE-2023-28859 about addressing data leakage across AsyncIO connections in general.

Weakness: CWE-193 (Off-by-one Error)

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

7 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.3.6, 4.4.3, 4.5.3 |
| `redis` | PyPI | From 4.2.0 | 4.3.6 |
| `redis` | PyPI | From 4.2.0 | 4.3.6 |
| `redis` | PyPI | From 4.4.0 | 4.4.3 |
| `redis` | PyPI | From 4.4.0 | 4.4.3 |
| `redis` | PyPI | From 4.5.0 | 4.5.3 |
| `redis` | PyPI | From 4.5.0 | 4.5.3 |

Products: Redis Redis-Py.

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

Upgrade redis to a fixed version for your release line: 4.3.6, 4.4.3 or 4.5.3.

## Is CVE-2023-28858 being exploited?

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

## Other vulnerabilities in n/a

- [CVE-2023-28859](https://insights.sbomify.com/CVE-2023-28859/): redis-py Race Condition due to incomplete fix (medium 6.5)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-28858 is a low-severity vulnerability in n/a, published on 26 Mar 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-28858 in the wild and no public exploit code.

Affected packages and fixed versions:
- redis (PyPI): affected from 4.2.0; fixed in 4.3.6, 4.4.3, 4.5.3
- redis (PyPI): affected from 4.2.0; fixed in 4.3.6
- redis (PyPI): affected from 4.2.0; fixed in 4.3.6
- redis (PyPI): affected from 4.4.0; fixed in 4.4.3
- redis (PyPI): affected from 4.4.0; fixed in 4.4.3
- redis (PyPI): affected from 4.5.0; fixed in 4.5.3
- redis (PyPI): affected from 4.5.0; fixed in 4.5.3

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

## Sources

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

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