CVE-2022-3023: TiDB vulnerable to Use of Externally-Controlled Format String
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.26509%
CWE
Published
11/4/2022
Updated
2/3/2023
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| github.com/pingcap/tidb | go | <= 6.1.2 | |
| github.com/pingcap/tidb | go | >= 6.2.0, <= 6.4.0-alpha1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from unsafe DSN construction using user-controlled input. The createDB function directly interpolated the database name into the DSN string, allowing attackers to inject MySQL parameters. The ToDSN method concatenated connection parameters (including user-controlled Vars) without proper URL encoding, enabling format string manipulation. The patches replaced DSN string building with structured mysql.Config usage to prevent injection, confirming these were the vulnerable paths. The PoC demonstrates exploitation via parameter injection in database names, directly implicating these functions.