Rapid7 Vulnerability & Exploit Database

H2 Web Interface Create Alias RCE

Back to Search

H2 Web Interface Create Alias RCE

Disclosed
04/09/2018
Created
08/16/2023

Description

The H2 database contains an alias function which allows for arbitrary Java code to be used. This functionality can be abused to create an exec functionality to pull our payload down and execute it. H2's web interface contains restricts MANY characters, so injecting a payload directly is not favorable. A valid database connection is required. If the database engine was configured to allow creation of databases, the module default can be used which utilizes an in memory database. Some Docker instances of H2 don't allow writing to folders such as /tmp, so we default to writing to the working directory of the software. This module was tested against H2 version 2.1.214, 2.0.204, 1.4.199 (version detection fails)

Author(s)

  • h00die
  • gambler
  • h4ckNinja
  • Nairuz Abulhul

Platform

Unix

Architectures

cmd

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/linux/http/h2_webinterface_rce
msf exploit(h2_webinterface_rce) > show targets
    ...targets...
msf exploit(h2_webinterface_rce) > set TARGET < target-id >
msf exploit(h2_webinterface_rce) > show options
    ...show and set options...
msf exploit(h2_webinterface_rce) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;