9.8critical
RCE in H2 Console
- Severity
- 9.8critical CVSS:3.1 by NVD
- Exploit likelihood
- 83.2% (higher than 99% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- JFROG
- Also known as
- GHSA-h376-j262-vhq6
Description
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. This can be exploited through various attack vectors, most notably through the H2 Console which leads to unauthenticated remote code execution.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| h2database h2 | from 1.1.000 before *, from 1.1.000 up to 2.0.204 | CVE List, NVD |
| com.h2database:h2 (Maven) | from 1.1.100 before 2.0.206 | GitHub Advisory Database |
| debian debian_linux | 9.0, 10.0, 11.0 | NVD |
| oracle communications_cloud_native_core_policy | 1.15.0 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 10.0high CVSS:2.0 | AV:N/AC:L/Au:N/C:C/I:C/A:C |
Classification
What each source says
CVE List
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. This can be exploited through various attack vectors, most notably through the H2 Console which leads to unauthenticated remote code execution.
GitHub Advisory Database
Impact
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.
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).
It is also possible to load them by creation a linked table in these versions, but it requires ADMIN privileges and user with ADMIN privileges has full access to the Java process by design. These privileges should never be granted to untrusted users.
Patches
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.
Workarounds
H2 Console should never be available to untrusted users.
-webAllowOthers is a dangerous setting that should be avoided.
H2 Console Servlet deployed on a web server can be protected with a security constraint:
https://h2database.com/html/tutorial.html#usingH2ConsoleServlet
If webAllowOthers is specified, you need to uncomment and edit <security-role> and <security-constraint> as necessary. See documentation of your web server for more details.
References
This issue was found and privately reported to H2 team by JFrog Security's vulnerability research team with detailed information.
NVD (es)
El método org.h2.util.JdbcUtils.getConnection de la base de datos H2 toma como parámetros el nombre de la clase del controlador y la URL de la base de datos. Un atacante puede pasar un nombre de controlador JNDI y una URL que conlleve a un servidor LDAP o RMI, causando una ejecución de código remota. Esto puede ser explotado mediante varios vectores de ataque, sobre todo mediante la Consola H2 que conlleva a una ejecución de código remoto no autenticado
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-42392 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-h376-j262-vhq6 changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-42392 changed 2026-06-17 | Public domain |