QID 376244

Date Published: 2022-01-14

QID 376244: H2 Database Console Remote Code Execution (RCE) Vulnerability (CVE-2021-42392)

H2 is an open-source Java SQL database offering a lightweight in-memory solution that doesn't require data to be stored on disk.

CVE-2021-42392: H2 Console in versions since 1.1.100 (2008-10-14) to 2.0.204 (2021-12-21) inclusive allows loading of custom classes from remote servers through JNDI. The org.h2.util.JdbcUtils.getConnection method of the H2 database takes as parameters the class name of the driver and URL of the database. An attacker may pass a JNDI driver name and a URL leading to a LDAP or RMI servers, causing remote code execution.

Affected versions:
1.1.100 (2008-10-14) to 2.0.204 (2021-12-21)

H2 Console doesn't accept remote connections by default. If remote access was enabled explicitly and some protection method (such as security constraint) wasn't set, an intruder can load own custom class and execute its code in a process with H2 Console (H2 Server process or a web server with H2 Console servlet).

  • CVSS V3 rated as Critical - 9.8 severity.
  • CVSS V2 rated as Critical - 10 severity.
  • Solution
    It is recommend all users of the H2 database to upgrade to version 2.0.206

    Since version 2.0.206 H2 Console and linked tables explicitly forbid attempts to specify LDAP URLs for JNDI. Only local data sources can be used.

    CVEs related to QID 376244

    Software Advisories
    Advisory ID Software Component Link
    h2 DB URL Logo github.com/h2database/h2database/security/advisories/GHSA-h376-j262-vhq6