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 references exist, 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
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2021-42392 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE sits: patch-first territory.
Where this sits among everything scored
Of 378,156 CVEs with a current EPSS score, this one falls in the 50–90% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
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 |
Research 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
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2021-42392 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2021-42392. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
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 7 | h2 | 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?
O3 Security finds CVE-2021-42392 across Maven dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.