CVE-2021-42392 in h2database h2

LogPulse has a published detection rule for this CVE: it raises a notable when someone tries to exploit it.

What the vulnerability is

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 software: h2database h2, oracle communications cloud native core policy, debian linux

Scores

What LogPulse has for it

How to mitigate it

Upgrade H2 to 2.0.206 or later and turn off the web console

Patch or upgrade. H2 2.0.206 only accepts JNDI names inside the java naming scheme, which stops remote code loading through the console login (CVE-2021-42392); turning the console off removes the endpoint.

Applies to: H2 Database 1.1.100 to 2.0.204 with the web console reachable.

  1. Find the h2 jar version in the application's dependencies.
  2. Upgrade com.h2database:h2 to 2.0.206 or later.
  3. Turn off the H2 web console in production (for Spring Boot: spring.h2.console.enabled=false).
  4. If the console must stay, bind it to localhost and never set -webAllowOthers.

Sources:

Source data: NIST NVD, CISA KEV and FIRST EPSS. LogPulse processes new CVEs every hour.

We build every detection with great care, but no two environments are the same. Log sources, parsing and configuration differ, so test a detection in your own environment before you rely on it.

Start free with LogPulse