CVE-2022-23653: B2 Command Line Tool TOCTOU application key disclosure

Published Feb 23, 2022
·
Updated

Impact

Linux and Mac releases of the B2 command-line tool version 3.2.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.

The command line tool saves API keys (and bucket name-to-id mapping) in a local database file ($XDGCONFIGHOME/b2/accountinfo, ~/.b2accountinfo or a user-defined path) when b2 authorize-account is first run. This happens regardless of whether a valid key is provided or not. 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 is readable by a local attacker and the user did not yet run b2 authorize-account 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.

Remediation

Users that have not yet run b2 authorize-account should upgrade to B2 Command-Line Tool v3.2.1 before running it.

Users that have run b2 authorize-account are safe if at the time of the file creation no other local users had read access to the local configuration file.

Users that have run b2 authorize-account where the designated path could be opened by another local user should upgrade to B2 Command-Line Tool v3.2.1 and remove the database and regenerate all application keys. Note that b2 clear-account does not remove the database file and it should not be used to ensure that all open handles to the file are invalidated.

Workarounds If B2 Command-Line Tool cannot be upgraded to v3.2.1 due to a dependency conflict, a binary release can be used instead. Alternatively a new version could be installed within a virtualenv, or the permissions can be changed to prevent local users from opening the database file.

For more information If you have any questions or comments about this advisory: Open an issue in B2 Command-Line Tool mentioning the CVE id in the issue title Email us at security@backblaze.com

Other sources

B2 Command Line Tool is the official command line tool for the backblaze cloud storage service. Linux and Mac releases of the B2 command-line tool version 3.2.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. The command line tool saves API keys (and bucket name-to-id mapping) in a local database file ($XDGCONFIGHOME/b2/accountinfo, ~/.b2accountinfo or a user-defined path) when b2 authorize-account is first run. This happens regardless of whether a valid key is provided or not. 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 is readable by a local attacker and the user did not yet run b2 authorize-account 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. Users that have not yet run b2 authorize-account should upgrade to B2 Command-Line Tool v3.2.1 before running it. Users that have run b2 authorize-account are safe if at the time of the file creation no other local users had read access to the local configuration file. Users that have run b2 authorize-account where the designated path could be opened by another local user should upgrade to B2 Command-Line Tool v3.2.1 and remove the database and regenerate all application keys. Note that b2 clear-account does not remove the database file and it should not be used to ensure that all open handles to the file are invalidated. If B2 Command-Line Tool cannot be upgraded to v3.2.1 due to a dependency conflict, a binary release can be used instead. Alternatively a new version could be installed within a virtualenv, or the permissions can be changed to prevent local users from opening the database file.

Affected Software

3 affected componentsFixes available
pip/b2<3.2.1
3.2.1
Backblaze B2 Command Line Tool Linux<=3.2.0
Backblaze B2 Command Line Tool Mac<=3.2.0

Event History

Feb 23, 2022
CVE Published
via MITRE·11:05 PM
Data Sourced
via MITRE·11:05 PM
DescriptionSeverityWeakness
Feb 24, 2022
Advisory Published
via GitHub·01:11 PM

Frequently Asked Questions

1

What is the severity of CVE-2022-23653?

CVE-2022-23653 has a medium severity rating due to its key disclosure vulnerability that can be exploited by local attackers.

2

How do I fix CVE-2022-23653?

To fix CVE-2022-23653, upgrade the Backblaze B2 command-line tool to version 3.2.1 or above.

3

What versions are affected by CVE-2022-23653?

CVE-2022-23653 affects the Backblaze B2 command-line tool versions 3.2.0 and below on both Linux and Mac.

4

What type of vulnerability is CVE-2022-23653?

CVE-2022-23653 is a key disclosure vulnerability categorized as a time-of-check-time-of-use (TOCTOU) race condition.

5

Who is impacted by CVE-2022-23653?

Users of the Backblaze B2 command-line tool on Linux and Mac systems are impacted by CVE-2022-23653.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203