CVE-2022-45868: H2 Password Exposure Vulnerability

HIGH
Advisory Identifier: GHSA-22wj-vf5f-wrvj
CVSS 7.8
CWE-312 CWE-200
Published
Advisory Summary

CVE-2022-45868 is a HIGH (CVSS 7.8) password exposure vulnerability (CWE-312: Cleartext Storage of Sensitive Information) affecting H2 libraries in the Maven ecosystem. The issue involves password exposure in h2 database. Remediation is available by upgrading affected packages to version 2.2.220.

CVE-2022-45868 at a Glance

CVE Identifier CVE-2022-45868
GHSA Identifier GHSA-22wj-vf5f-wrvj
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-312: Cleartext Storage of Sensitive Information
Affected Product H2
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-45868

To remediate this vulnerability, upgrade all affected H2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

com.h2database:h2 fixed: 2.2.220
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>2.2.220</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=com.h2database

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-45868, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=com.h2database

Analyze the terminal output to locate any version of H2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.220), your application is affected.

Note: The mvn dependency:tree -Dincludes=com.h2database command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-312: Cleartext Storage of Sensitive Information, where the product stores sensitive information in cleartext within a resource that might be accessible to another control sphere. In H2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The web-based admin console in H2 Database Engine through 2.1.214 can be started via the CLI with the argument -webAdminPassword, which allows the user to specify the password in cleartext for the web admin console. Consequently, a local user (or an attacker that has obtained local access through some means) would be able to discover the password by listing processes and their arguments. NOTE: the vendor states "This is not a vulnerability of H2 Console ... Passwords should never be passed on the command line and every qualified DBA or system administrator is expected to know that."

CVE-2022-45868 Affected H2 Versions

1 component(s)
Fixed Versions:
2.2.220
Product / Package Ecosystem Affected Versions Fixed Version
com.h2database:h2
Maven
≥ 1.4.198
< 2.2.220
2.2.220

References

Frequently Asked Questions

What is CVE-2022-45868?
CVE-2022-45868 is a security vulnerability in H2 involving Password exposure in H2 Database under CWE-312: Cleartext Storage of Sensitive Information.
Which H2 versions are affected?
Affected versions include releases prior to 2.2.220 across affected packages: com.h2database:h2.
What version fixes CVE-2022-45868?
Upgrading to 2.2.220 (or the latest patched release for your respective branch) resolves the vulnerability.
Is h2 affected?
Yes, com.h2database:h2 is affected in releases prior to 2.2.220. Upgrade your dependency to 2.2.220 or later.
What is the CVSS score of CVE-2022-45868?
CVE-2022-45868 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-45868?
CVE-2022-45868 is classified under CWE-312: Cleartext Storage of Sensitive Information (The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.).
How can I check Maven dependencies for CVE-2022-45868?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.h2database'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-22wj-vf5f-wrvj",
  "modified" : "2024-07-03T17:59:02Z",
  "published" : "2022-11-23T21:30:31Z",
  "aliases" : [ "CVE-2022-45868" ],
  "summary" : "Password exposure in H2 Database ",
  "details" : "The web-based admin console in H2 Database Engine through 2.1.214 can be started via the CLI with the argument -webAdminPassword, which allows the user to specify the password in cleartext for the web admin console. Consequently, a local user (or an attacker that has obtained local access through some means) would be able to discover the password by listing processes and their arguments. NOTE: the vendor states \"This is not a vulnerability of H2 Console ... Passwords should never be passed on the command line and every qualified DBA or system administrator is expected to know that.\"",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.h2database:h2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.198"
      }, {
        "fixed" : "2.2.220"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-45868"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/issues/3686"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/pull/3833"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/commit/581ed18ff9d6b3761d851620ed88a3994a351a0d"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-22wj-vf5f-wrvj"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/h2database/h2database"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/blob/96832bf5a97cdc0adc1f2066ed61c54990d66ab5/h2/src/main/org/h2/server/web/WebServer.java#L346-L347"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/releases/tag/version-2.2.220"
  }, {
    "type" : "WEB",
    "url" : "https://sites.google.com/sonatype.com/vulnerabilities/sonatype-2022-6243"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-312" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-23T22:31:05Z",
    "nvd_published_at" : "2022-11-23T21:15:00Z"
  }
}