CVE-2022-23653: B2 Command Line Tool TOCTOU Application Key Disclosure

b2 Updated 02 Oct 2025

Summary

24/02/2022
Yes i
Moderate
4.7

CVE-2022-23653: B2 Command Line Tool TOCTOU application key disclosure. Affects b2 versions < 3.2.1. Fixed in 3.2.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The B2 command-line tool is a software package used for interacting with the B2 Cloud Storage service. It provides a command-line interface for managing files, buckets, and other resources in the B2 cloud. The tool allows users to authorize their B2 account, upload and download files, and perform various administrative tasks. However, versions 3.2.0 and below of the B2 command-line tool for Linux and Mac contain a key disclosure vulnerability that can be exploited by local attackers through a time-of-check-time-of-use (TOCTOU) race condition.

Vulnerability Detail

The vulnerability in the B2 command-line tool arises from the way it saves API keys and bucket name-to-id mapping in a local database file. When the b2 authorize-account command is first run, the tool creates this file ($XDG_CONFIG_HOME/b2/account_info, ~/.b2_account_info, or a user-defined path) and saves the sensitive information to it. However, during a brief period between file creation and permission modification, the file is world-readable. If a local attacker has read access to the directory and can race to open the file before the permissions are changed, they can obtain the API keys and other sensitive data. This vulnerability is classified as a time-of-check-time-of-use (TOCTOU) race condition.

How To Fix

Minimum fixed version

3.2.1

This is the first release that contains the fix.

pip install --upgrade "b2==3.2.1"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to B2 Command-Line Tool v3.2.1 is not possible due to dependency conflicts, a binary release can be used as an alternative. Another option is to install a new version within a virtual environment (virtualenv). Alternatively, the permissions of the database file can be changed to prevent local users from opening it.

Conclusion

The B2 Command Line Tool version 3.2.0 and below for Linux and Mac contains a key disclosure vulnerability that can be exploited by local attackers. Users are advised to upgrade to B2 Command-Line Tool v3.2.1 and follow the recommended steps to fix the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for b2 →

Share this vulnerability

FAQ

The B2 command-line tool is a software package used for interacting with the B2 Cloud Storage service. It provides a command-line interface for managing files, buckets, and other resources in the B2 cloud.

The key disclosure vulnerability in the B2 command-line tool can be exploited by local attackers to obtain API keys and other sensitive information. This can lead to unauthorized access to the B2 Cloud Storage service and potential data breaches.

Users should upgrade to B2 Command-Line Tool v3.2.1 if they have not yet run the b2 authorize-account command. If the command has already been run, it is recommended to upgrade to v3.2.1, remove the existing database file, and regenerate all application keys.

If upgrading to v3.2.1 is not possible, users can use a binary release or install a new version within a virtual environment. Another option is to change the permissions of the database file to prevent local users from accessing it.

No, running b2 clear-account does not remove the database file. It is recommended to manually remove the file and regenerate all application keys to ensure security.

How To Fix

Minimum fixed version

3.2.1

This is the first release that contains the fix.

pip install --upgrade "b2==3.2.1"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback