Ecosyste.ms: Advisories

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

Security Advisories: GSA_kwCzR0hTQS1wODY3LWZ4ZnItcGgyd80uRA

b2-sdk-python TOCTOU application key disclosure

Impact

Linux and Mac releases of the SDK version 1.14.0 and below contain a key disclosure vulnerability that, in certain conditions, can be exploited by local attackers through a time-of-check-time-of-use (TOCTOU) race condition.

SDK users of the SqliteAccountInfo format are vulnerable while users of the InMemoryAccountInfo format are safe. The SqliteAccountInfo saves API keys (and bucket name-to-id mapping) in a local database file ($XDG_CONFIG_HOME/b2/account_info, ~/.b2_account_info or a user-defined path). When first created, the file is world readable and is (typically a few milliseconds) later altered to be private to the user. If the directory containing the file is readable by a local attacker then during the brief period between file creation and permission modification, a local attacker can race to open the file and maintain a handle to it. This allows the local attacker to read the contents after the file after the sensitive information has been saved to it.

Consumers of this SDK who rely on it to save data using SqliteAccountInfo class should upgrade to the latest version of the SDK. Those who believe a local user might have opened a handle using this race condition, should remove the affected database files and regenerate all application keys.

Patches

Users should upgrade to b2-sdk-python 1.14.1 or later.

For more information

See the related advisory in the B2 Command Line Tool, a consumer of this SDK.

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-p867-fxfr-ph2w
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1wODY3LWZ4ZnItcGgyd80uRA
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 2 years ago
Updated: over 1 year ago


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

Identifiers: GHSA-p867-fxfr-ph2w, CVE-2022-23651
References: Repository: https://github.com/Backblaze/b2-sdk-python
Blast Radius: 9.3

Affected Packages

pypi:b2sdk
Dependent packages: 11
Dependent repositories: 96
Downloads: 93,867 last month
Affected Version Ranges: < 1.14.1
Fixed in: 1.14.1
All affected versions: 0.1.4, 0.1.6, 0.1.8, 1.0.0, 1.0.2, 1.1.0, 1.1.2, 1.1.4, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0, 1.14.0
All unaffected versions: 1.14.1, 1.15.0, 1.16.0, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.30.1, 1.31.0, 1.32.0, 1.33.0, 2.0.0, 2.1.0, 2.2.0