CVE-2021-23463: H2 Security Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-7rpj-hg47-cx62
CVSS 8.1
CWE-611
Published
Advisory Summary

CVE-2021-23463 is a HIGH (CVSS 8.1) security vulnerability vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting H2 libraries in the Maven ecosystem. The issue involves h2.. Remediation is available by upgrading affected packages to version 2.0.202.

CVE-2021-23463 at a Glance

CVE Identifier CVE-2021-23463
GHSA Identifier GHSA-7rpj-hg47-cx62
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product H2
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix CVE-2021-23463

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.0.202
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>2.0.202</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-2021-23463, 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.0.202), 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-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. 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

H2 is an embeddable RDBMS written in Java. The package com.h2database:h2 from 1.4.198 and before 2.0.202 are vulnerable to XML External Entity (XXE) Injection via the org.h2.jdbc.JdbcSQLXML class object, when it receives parsed string data from org.h2.jdbc.JdbcResultSet.getSQLXML() method. If it executes the getSource() method when the parameter is DOMSource.class it will trigger the vulnerability.

CVE-2021-23463 Affected H2 Versions

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

References

Frequently Asked Questions

What is CVE-2021-23463?
CVE-2021-23463 is a security vulnerability in H2 involving h2. under CWE-611: Improper Restriction of XML External Entity Reference.
Which H2 versions are affected?
Affected versions include releases prior to 2.0.202 across affected packages: com.h2database:h2.
What version fixes CVE-2021-23463?
Upgrading to 2.0.202 (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.0.202. Upgrade your dependency to 2.0.202 or later.
What is the CVSS score of CVE-2021-23463?
CVE-2021-23463 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H.
What CWE is associated with CVE-2021-23463?
CVE-2021-23463 is classified under CWE-611: Improper Restriction of XML External Entity Reference (The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.).
How can I check Maven dependencies for CVE-2021-23463?
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-7rpj-hg47-cx62",
  "modified" : "2023-03-21T16:18:09Z",
  "published" : "2021-12-16T14:29:57Z",
  "aliases" : [ "CVE-2021-23463" ],
  "summary" : "Improper Restriction of XML External Entity Reference in com.h2database:h2.",
  "details" : "H2 is an embeddable RDBMS written in Java. The package com.h2database:h2 from 1.4.198 and before 2.0.202 are vulnerable to XML External Entity (XXE) Injection via the org.h2.jdbc.JdbcSQLXML class object, when it receives parsed string data from org.h2.jdbc.JdbcResultSet.getSQLXML() method. If it executes the getSource() method when the parameter is DOMSource.class it will trigger the vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.h2database:h2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.198"
      }, {
        "fixed" : "2.0.202"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23463"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/issues/3195"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/pull/3199"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/pull/3199#issuecomment-1002830390"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/boris-unckel/h2database/commit/f9ad6aef2bfa59eba2b4d3e7c4c32d2cce8e8b05"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database/commit/d83285fd2e48fb075780ee95badee6f5a15ea7f8%23diff-008c2e4462609982199cd83e7cf6f1d6b41296b516783f6752c44b9f15dc7bc3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/h2database/h2database"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20230818-0010"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-COMH2DATABASE-1769238"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-14T14:17:37Z",
    "nvd_published_at" : "2021-12-10T20:15:00Z"
  }
}