CVE-2022-3023: Github.com/pingcap/tidb TiDB Vulnerable To Use Of Vulnerability

CRITICAL
Advisory Identifier: GHSA-7fxj-fr3v-r9gj
CVSS 9.8
CWE-134
Published
Advisory Summary

CVE-2022-3023 is a CRITICAL (CVSS 9.8) tidb vulnerable to use of vulnerability (CWE-134: Use of Externally-Controlled Format String) affecting Github.com/pingcap/tidb libraries in the Go ecosystem. The issue involves tidb vulnerable to use of externally-controlled format string. Remediation is available in the latest vendor maintenance releases.

CVE-2022-3023 at a Glance

CVE Identifier CVE-2022-3023
GHSA Identifier GHSA-7fxj-fr3v-r9gj
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-134: Use of Externally-Controlled Format String
Affected Product Github.com/pingcap/tidb
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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

How to Fix CVE-2022-3023

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

github.com/pingcap/tidb fixed: Latest secure release
Upgrade github.com/pingcap/tidb to Latest secure release
github.com/pingcap/tidb fixed: Latest secure release
Upgrade github.com/pingcap/tidb to Latest secure release
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/pingcap/tidb

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-3023, inspect your project dependencies for Github.com/pingcap/tidb:

inspect dependencies for github.com/pingcap/tidb

Analyze the terminal output to locate any version of Github.com/pingcap/tidb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-134: Use of Externally-Controlled Format String, where the product uses a function that accepts a format string as an argument, but the format string originates from an external source. In Github.com/pingcap/tidb, 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

TiDB server (importer CLI tool) prior to version 6.4.0 & 6.1.3 is vulnerable to data source name injection. The database name for generating and inserting data into a database does not properly sanitize user input which can lead to arbitrary file reads."

CVE-2022-3023 Affected Github.com/pingcap/tidb Versions

2 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/pingcap/tidb
Go
≤ 6.1.2
github.com/pingcap/tidb
Go
≥ 6.2.0
≤ 6.4.0-alpha1

References

Frequently Asked Questions

What is CVE-2022-3023?
CVE-2022-3023 is a security vulnerability in Github.com/pingcap/tidb involving TiDB vulnerable to Use of Externally-Controlled Format String under CWE-134: Use of Externally-Controlled Format String.
Which Github.com/pingcap/tidb versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/pingcap/tidb.
What version fixes CVE-2022-3023?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/pingcap/tidb affected?
Yes, github.com/pingcap/tidb is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2022-3023?
CVE-2022-3023 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-3023?
CVE-2022-3023 is classified under CWE-134: Use of Externally-Controlled Format String (The product uses a function that accepts a format string as an argument, but the format string originates from an external source.).
How can I check Go dependencies for CVE-2022-3023?
Run the dependency tree command: 'inspect dependencies for github.com/pingcap/tidb'. 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-7fxj-fr3v-r9gj",
  "modified" : "2022-11-24T01:13:44Z",
  "published" : "2022-11-04T19:01:17Z",
  "aliases" : [ "CVE-2022-3023" ],
  "summary" : "TiDB vulnerable to Use of Externally-Controlled Format String",
  "details" : "TiDB server (importer CLI tool) prior to version 6.4.0 & 6.1.3 is vulnerable to data source name injection. The database name for generating and inserting data into a database does not properly sanitize user input which can lead to arbitrary file reads.\"",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/pingcap/tidb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "6.1.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/pingcap/tidb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.2.0"
      }, {
        "last_affected" : "6.4.0-alpha1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-3023"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pingcap/tidb/commit/d0376379d615cc8f263a0b17c031ce403c8dcbfb"
  }, {
    "type" : "WEB",
    "url" : "https://advisory.dw1.io/45"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pingcap/tidb"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.dev/bounties/120f1346-e958-49d0-b66c-0f889a469540"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-134" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-04T20:48:44Z",
    "nvd_published_at" : "2022-11-04T12:15:00Z"
  }
}