Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1xMjRtLTZoMzgtNXhqOM4AA2kK

ydb-go-sdk token in custom credentials object can leak through logs

Impact

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. Printf func use placeholder %q for string representation of argument with quotes. If an argument implements interface fmt.Stringer, it will used through String() func. In other cases used fallback - serialization with reflection.

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.

Who is impacted: applications with custom credentials object with an explicit token field.

A leak could have occurred if all of these conditions were met simultaneously:

  1. The credentials object does not implement the fmt.Stringer interface (does not have a String() method) - potentially these are custom credentials. Official credentials have a String() method.
  2. There was an error connecting to YDB during driver creation via ydb.Open(...).
  3. Some logging system was configured (ydb-go-sdk does not log such errors by default).
  4. The connection error was logged into a system that a malicious user had access to.

Patches

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 (PR).

Workarounds

Implement the fmt.Stringer interface in your custom credentials type with explicit stringify of object state.

Permalink: https://github.com/advisories/GHSA-q24m-6h38-5xj8
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xMjRtLTZoMzgtNXhqOM4AA2kK
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 1 year ago
Updated: 12 months ago


CVSS Score: 5.5
CVSS vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

EPSS Percentage: 0.00045
EPSS Percentile: 0.16558

Identifiers: GHSA-q24m-6h38-5xj8, CVE-2023-45825
References: Repository: https://github.com/ydb-platform/ydb-go-sdk
Blast Radius: 9.3

Affected Packages

go:github.com/ydb-platform/ydb-go-sdk/v3
Dependent packages: 40
Dependent repositories: 49
Downloads:
Affected Version Ranges: >= 3.48.6, < 3.53.3
Fixed in: 3.53.3
All affected versions: 3.48.6, 3.48.7, 3.48.8, 3.49.0, 3.49.1, 3.50.0, 3.51.0, 3.51.1, 3.51.2, 3.51.3, 3.52.0, 3.52.1, 3.52.2, 3.52.3, 3.53.0, 3.53.1, 3.53.2
All unaffected versions: 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5.0, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.6.0, 3.6.2, 3.7.0, 3.7.1, 3.7.2, 3.8.0, 3.8.1, 3.8.2, 3.8.3, 3.8.4, 3.8.5, 3.8.6, 3.8.7, 3.8.8, 3.8.9, 3.8.10, 3.8.11, 3.8.12, 3.9.0, 3.9.1, 3.9.2, 3.9.3, 3.9.4, 3.10.0, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.11.5, 3.11.6, 3.11.7, 3.11.8, 3.11.9, 3.11.10, 3.11.11, 3.11.12, 3.11.13, 3.12.0, 3.12.1, 3.13.0, 3.13.1, 3.13.2, 3.13.3, 3.14.0, 3.14.1, 3.14.2, 3.14.3, 3.14.4, 3.15.0, 3.15.1, 3.16.0, 3.16.1, 3.16.2, 3.16.3, 3.16.4, 3.16.5, 3.16.6, 3.16.7, 3.16.8, 3.16.9, 3.16.10, 3.16.11, 3.16.12, 3.17.0, 3.18.0, 3.18.1, 3.18.2, 3.18.3, 3.18.4, 3.18.5, 3.19.0, 3.19.1, 3.20.0, 3.20.1, 3.20.2, 3.21.0, 3.22.0, 3.23.0, 3.24.0, 3.24.1, 3.24.2, 3.25.0, 3.25.1, 3.25.2, 3.25.3, 3.26.0, 3.26.1, 3.26.2, 3.26.3, 3.26.4, 3.26.5, 3.26.6, 3.26.7, 3.26.8, 3.26.9, 3.26.10, 3.27.0, 3.28.0, 3.28.1, 3.28.2, 3.28.3, 3.29.0, 3.29.1, 3.29.2, 3.29.3, 3.29.4, 3.29.5, 3.30.0, 3.31.0, 3.32.0, 3.32.1, 3.33.0, 3.34.0, 3.34.1, 3.34.2, 3.35.0, 3.35.1, 3.36.0, 3.36.1, 3.36.2, 3.37.0, 3.37.1, 3.37.2, 3.37.3, 3.37.4, 3.37.5, 3.37.6, 3.37.7, 3.37.8, 3.38.0, 3.38.1, 3.38.2, 3.38.3, 3.38.4, 3.38.5, 3.39.0, 3.40.0, 3.40.1, 3.41.0, 3.42.0, 3.42.1, 3.42.2, 3.42.3, 3.42.4, 3.42.5, 3.42.6, 3.42.7, 3.42.8, 3.42.9, 3.42.10, 3.42.11, 3.42.12, 3.42.13, 3.42.14, 3.42.15, 3.43.0, 3.44.0, 3.44.1, 3.44.2, 3.44.3, 3.45.0, 3.46.0, 3.46.1, 3.47.0, 3.47.1, 3.47.2, 3.47.3, 3.47.4, 3.47.5, 3.48.0, 3.48.1, 3.48.2, 3.48.3, 3.48.4, 3.48.5, 3.53.3, 3.53.4, 3.54.0, 3.54.1, 3.54.2, 3.54.3, 3.55.0, 3.55.1, 3.55.2, 3.55.3, 3.56.0, 3.56.1, 3.56.2, 3.57.0, 3.57.1, 3.57.2, 3.57.3, 3.57.4, 3.58.0, 3.58.1, 3.58.2, 3.59.0, 3.59.1, 3.59.2, 3.59.3, 3.60.0, 3.60.1, 3.61.0, 3.61.1, 3.61.2, 3.62.0, 3.63.0, 3.64.0, 3.65.0, 3.65.1, 3.65.2, 3.65.3, 3.66.0, 3.66.1, 3.66.2, 3.66.3, 3.67.0, 3.67.1, 3.67.2, 3.68.0, 3.68.1, 3.69.0, 3.70.0, 3.71.0, 3.72.0, 3.73.0, 3.73.1, 3.74.0, 3.74.1, 3.74.2, 3.74.3, 3.74.4, 3.74.5, 3.75.0, 3.75.1, 3.75.2, 3.76.0, 3.76.1, 3.76.2, 3.76.3, 3.76.4, 3.76.5, 3.76.6, 3.77.0, 3.77.1, 3.78.0, 3.79.0, 3.79.1, 3.79.2, 3.80.0, 3.80.1, 3.80.2, 3.80.3, 3.80.4, 3.80.5, 3.80.6, 3.80.7, 3.80.8, 3.80.9, 3.80.10, 3.81.0, 3.81.1, 3.81.2, 3.81.3, 3.81.4, 3.82.0, 3.83.0, 3.84.0, 3.84.1, 3.85.0, 3.85.1, 3.85.2, 3.85.3, 3.86.0, 3.86.1, 3.87.0, 3.88.0, 3.89.0, 3.89.1, 3.89.2, 3.89.3, 3.89.4, 3.89.5, 3.89.6, 3.90.0, 3.90.1, 3.90.2, 3.91.0, 3.92.0, 3.92.1, 3.92.2, 3.92.3, 3.92.4, 3.92.5, 3.92.6