CVE-2021-42392 — h2
CRITICALCVE-2021-42392 is a critical-severity (CVSS 9.8) Deserialization of Untrusted Data vulnerability in com.h2database:h2. 3 public exploit or proof-of-concept references are indexed, so weaponization risk is real. A fix is available for com.h2database:h2 — see the affected versions and patch details below.
RCE in H2 Console
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
com.h2database:h2Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.
Description
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| ☕Maven | com.h2database:h2 | ≥ 1.1.100&&< 2.0.206 | 2.0.206com.h2database:h2:2.0.206 |
Affected Products
debian linuxdebianh2h2databasecommunications cloud native core policyoracleResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for com.h2database:h2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update com.h2database:h2 to 2.0.206 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-42392 is resolved across your whole dependency graph.
Workarounds
Do not deserialise data from untrusted sources: where the format allows it, restrict deserialisation to an explicit allowlist of expected types, and prefer a data-only format (JSON, Protobuf) over one that can reconstruct arbitrary objects until you can upgrade.
How to detect CVE-2021-42392
A community-maintained Nuclei template exists for this CVE. You can scan for it directly:
nuclei -id cve-2021-42392 -u https://target- Template
- H2 Database Console - JNDI Injection RCE
- Severity
- critical
- Impact
- An unauthenticated attacker can trigger an outbound JNDI lookup to a server they control, leading to remote code execution on the host running the H2 web console.
- Remediation
- Upgrade H2 database to version 2.0.206 or later, and disable the web console (spring.h2.console.enabled=false) or restrict access to it.
Template by ProjectDiscovery nuclei-templates (i-am-paradox), MIT licensed. View the full template. Scan only systems you are authorised to test.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
In OpenShift Container Platform (OCP) the openshift4/ose-metering-presto container image ships the vulnerable version of h2, but as it uses default configuration the impact by this vulnerability is LOW. Additionally, the Presto component is part of the OCP Metering stack and since the release of OCP 4.6, the Metering…
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat JBoss Enterprise Application Platform | com.h2database/h2:1.4.197.redhat-00004 | RHSA-2022:4922 |
| Red Hat JBoss Enterprise Application Platform 7.3 EUS for RHEL 7 | eap7-hal-console-0:3.2.17-1.Final_redhat_00001.1.el7eap | RHSA-2025:1747 |
| Red Hat JBoss Enterprise Application Platform 7.4 for RHEL 8 | eap7-h2database-0:1.4.197-2.redhat_00004.1.el8eap | RHSA-2022:4919 |
| Red Hat JBoss Enterprise Application Platform 7.4 on RHEL 7 | eap7-h2database-0:1.4.197-2.redhat_00004.1.el7eap | RHSA-2022:4918 |
| Red Hat Single Sign-On 7 | h2 | RHSA-2022:6787 |
| Red Hat Single Sign-On 7.5 for RHEL 7 | rh-sso7-keycloak-0:15.0.8-1.redhat_00001.1.el7sso | RHSA-2022:6782 |
| Red Hat Single Sign-On 7.5 for RHEL 8 | rh-sso7-keycloak-0:15.0.8-1.redhat_00001.1.el8sso | RHSA-2022:6783 |
| Red Hat Single Sign-On 7.6.1 | h2 | RHSA-2022:7417 |
Frequently Asked Questions
Is CVE-2021-42392 in your dependencies?
Find it across Maven, including transitive dependencies.