# CVE-2023-45825: Token in custom credentials object can leak through logs in ydb-go-sdk

> Attackers with log access can steal database credentials leaked by the Go YDB driver when using custom credentials objects.

- **Severity:** Medium 5.5 (`CVSS:3.1/AV:L/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:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Oct 2023
- **Updated:** 12 Sep 2024
- **Also known as:** GHSA-q24m-6h38-5xj8, GO-2023-2137

## What is CVE-2023-45825?

CVE-2023-45825 is a medium-severity vulnerability in ydb-platform ydb-go-sdk, published on 19 Oct 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

ydb-go-sdk is a pure Go native and database/sql driver for the YDB platform. Since ydb-go-sdk v3.48.6 if you use a custom credentials object (implementation of interface Credentials it may leak into logs. This happens because this object could be serialized into an error message using `fmt.Errorf("something went wrong (credentials: %q)", credentials)` during connection to the YDB server. If such logging occurred, a  malicious user with access to logs could read sensitive information (i.e. credentials) information and use it to get access to the database. ydb-go-sdk contains this problem in versions from v3.48.6 to v3.53.2. The fix for this problem has been released in version v3.53.3. Users are advised to upgrade. Users unable to upgrade should implement the `fmt.Stringer` interface in your custom credentials type with explicit stringify of object state.

Weakness: CWE-532 (Insertion of Sensitive Information into Log File)

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

3 open source packages ship an affected version, including github.com/ydb-platform/ydb-go-sdk/v3. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/ydb-platform/ydb-go-sdk/v3` | Go | From 3.48.6 | 3.53.3 |
| `github.com/ydb-platform/ydb-go-sdk/v3` | Go | From 3.48.6 | 3.53.3 |
| `github.com/ydb-platform/ydb-go-sdk/v3` | Go | From 3.48.6 | 3.53.3 |

Products: Ydb Ydb-Go-Sdk.

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

Upgrade github.com/ydb-platform/ydb-go-sdk/v3 to 3.53.3 or later.

## Is CVE-2023-45825 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2023-45825 is a medium-severity vulnerability in ydb-platform ydb-go-sdk, published on 19 Oct 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-45825 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/ydb-platform/ydb-go-sdk/v3 (Go): affected from 3.48.6; fixed in 3.53.3
- github.com/ydb-platform/ydb-go-sdk/v3 (Go): affected from 3.48.6; fixed in 3.53.3
- github.com/ydb-platform/ydb-go-sdk/v3 (Go): affected from 3.48.6; fixed in 3.53.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-45825/ (Markdown: https://insights.sbomify.com/CVE-2023-45825/index.md)
```

## Sources

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

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