CVE-2023-28858: Redis Redis-py Race Condition Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-24wv-mv5m-xv4h
CVSS 3.7
CWE-193
Published
Advisory Summary

CVE-2023-28858 is a MODERATE (CVSS 3.7) redis-py race condition vulnerability vulnerability (CWE-193: Off-by-one Error) affecting Redis libraries in the PyPI ecosystem. The issue involves redis-py race condition vulnerability. Remediation is available by upgrading affected packages to version 4.4.3, 4.5.3, 4.3.6.

CVE-2023-28858 at a Glance

CVE Identifier CVE-2023-28858
GHSA Identifier GHSA-24wv-mv5m-xv4h
Severity MODERATE
CVSS v3.1 Base Score 3.7
CWE Classification CWE-193: Off-by-one Error
Affected Product Redis
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-28858

To remediate this vulnerability, upgrade all affected Redis dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

redis fixed: 4.4.3
pip install redis>=4.4.3
redis fixed: 4.5.3
pip install redis>=4.5.3
redis fixed: 4.3.6
pip install redis>=4.3.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show redis

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-28858, inspect your installed packages using pip:

pip show redis

Analyze the terminal output to locate any version of Redis in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.4.3), your application is affected.

Note: The pip show redis command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-193: Off-by-one Error, where a product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value. In Redis, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

redis-py before 4.5.3, as used in ChatGPT and other products, leaves a connection open after canceling an async Redis command at an inopportune time (in the case of a pipeline operation), and can send response data to the client of an unrelated request in an off-by-one manner. The fixed versions for this CVE Record are 4.3.6, 4.4.3, and 4.5.3, but [are believed to be incomplete](https://github.com/redis/redis-py/issues/2665). CVE-2023-28859 has been assigned the issues caused by the incomplete fixes.

CVE-2023-28858 Affected Redis Versions

3 component(s)
Fixed Versions:
4.4.34.5.34.3.6
Product / Package Ecosystem Affected Versions Fixed Version
redis
PyPI
≥ 4.4.0
< 4.4.3
4.4.3
redis
PyPI
≥ 4.5.0
< 4.5.3
4.5.3
redis
PyPI
≥ 4.2.0
< 4.3.6
4.3.6

References

Frequently Asked Questions

What is CVE-2023-28858?
CVE-2023-28858 is a security vulnerability in Redis involving redis-py Race Condition vulnerability under CWE-193: Off-by-one Error.
Which Redis versions are affected?
Affected versions include releases prior to 4.4.3, 4.5.3, 4.3.6 across affected packages: redis.
What version fixes CVE-2023-28858?
Upgrading to 4.4.3, 4.5.3, 4.3.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is redis affected?
Yes, redis is affected in releases prior to 4.4.3, 4.5.3, 4.3.6. Upgrade your dependency to 4.4.3, 4.5.3, 4.3.6 or later.
What is the CVSS score of CVE-2023-28858?
CVE-2023-28858 has a CVSS v3.1 base score of 3.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2023-28858?
CVE-2023-28858 is classified under CWE-193: Off-by-one Error (A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value.).
How can I check PyPI dependencies for CVE-2023-28858?
Run the dependency tree command: 'pip show redis'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-24wv-mv5m-xv4h",
  "modified" : "2024-10-25T21:45:26Z",
  "published" : "2023-03-26T21:30:23Z",
  "aliases" : [ "CVE-2023-28858" ],
  "summary" : "redis-py Race Condition vulnerability",
  "details" : "redis-py before 4.5.3, as used in ChatGPT and other products, leaves a connection open after canceling an async Redis command at an inopportune time (in the case of a pipeline operation), and can send response data to the client of an unrelated request in an off-by-one manner. The fixed versions for this CVE Record are 4.3.6, 4.4.3, and 4.5.3, but [are believed to be incomplete](https://github.com/redis/redis-py/issues/2665). CVE-2023-28859 has been assigned the issues caused by the incomplete fixes.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "redis"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.4.0"
      }, {
        "fixed" : "4.4.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "redis"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.5.0"
      }, {
        "fixed" : "4.5.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "redis"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2.0"
      }, {
        "fixed" : "4.3.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-28858"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/issues/2624"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/pull/2641"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/commit/d56baeb683fc1935cfa343fa2eeb0fa9bd955283"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/redis/PYSEC-2023-45.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/redis/redis-py"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/compare/v4.3.5...v4.3.6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/compare/v4.4.2...v4.4.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/compare/v4.5.2...v4.5.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/releases/tag/v4.4.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/redis/redis-py/releases/tag/v4.5.4"
  }, {
    "type" : "WEB",
    "url" : "https://openai.com/blog/march-20-chatgpt-outage"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-193" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-27T21:31:45Z",
    "nvd_published_at" : "2023-03-26T19:15:00Z"
  }
}