Severity:

CRITICAL RISK

(9.8)

Remote Code Execution via Dynamic Code Loading

CVE-2026-3960

Analyzed

Vulnerability type

Category:

Remote Code Execution via Dynamic Code Loading

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An insecure handling of JDBC connection parameters in the unauthenticated /99/ImportSQLTable REST API in H2O-3 allows attackers to bypass a MySQL-focused blacklist by switching to PostgreSQL JDBC URLs and injecting driver-specific parameters.

By abusing options such as socketFactory and socketFactoryArg, an unauthenticated attacker can cause arbitrary code execution in the H2O-3 server process when the application establishes database connections.

Affected context

This vulnerability affects H2O-3 deployments that expose the /99/ImportSQLTable REST endpoint and allow users to supply arbitrary JDBC URLs and parameters.

The risk is present when:

  • The API is reachable over a network (e.g., internal or internet-facing deployments).
  • The server accepts JDBC URLs without strict allow-listing of drivers and parameters.
  • The environment includes PostgreSQL JDBC driver functionality or compatible classpaths that honor socketFactory and related parameters.

Under these conditions, user-controlled JDBC parameters can influence how the driver loads classes or network components during connection setup.

Exploit preconditions

  • Attack surface: Network-accessible /99/ImportSQLTable REST API endpoint on the H2O-3 server.
  • Required access: No authentication required; any party that can reach the endpoint can attempt exploitation.
  • Trigger point: Server-side processing of attacker-supplied JDBC URLs and parameters during import of an SQL table.
  • Why exploitation is possible: The blacklist-based validation only targets MySQL-specific "dangerous" parameters and does not constrain the JDBC protocol or the PostgreSQL-specific parameters, allowing attackers to:
  • Switch to jdbc:postgresql: URLs, and
  • Supply parameters like socketFactory and socketFactoryArg that can cause the loading of attacker-influenced classes or behaviors, leading to code execution.

Why this happens

The core issue stems from relying on a narrow, driver-specific blacklist to control powerful configuration parameters on a dynamic execution path.

Instead of enforcing strict validation over which JDBC drivers and parameters are permitted, the implementation:

  • Assumes MySQL as the primary threat and blocks only MySQL-specific parameters,
  • Leaves PostgreSQL and other driver-specific parameters unregulated,
  • Continues to execute driver logic that interprets user-controlled parameters such as socketFactory.

This maps to CWE-94: Improper Control of Generation of Code (Code Injection) because user-controlled configuration is allowed to influence code that is loaded or executed (directly or indirectly) by the runtime during JDBC driver initialization and connection setup, without strong constraints or isolation.

Potential impact

  • Remote execution of arbitrary code within the H2O-3 server process.
  • Full compromise of the H2O-3 instance, including access to model data, training datasets, and configuration.
  • Use of the compromised server as a pivot point for lateral movement within the network.
  • Exfiltration or tampering with data imported from connected databases.
  • Deployment of additional malicious tooling or backdoors under the H2O-3 process privileges.

General mitigation guidance

Effective mitigation focuses on reducing the power and flexibility of user-supplied JDBC configuration and strengthening trust boundaries:

  • Prefer allow-lists over blacklists:
  • Restrict JDBC URLs to a small set of approved protocols and hosts.
  • For each allowed driver, explicitly define the parameters that are permitted and reject all others by default.
  • Decouple user input from execution paths:
  • Avoid passing user-controlled values into parameters that control class names, factories, or other executable hooks (e.g., socket factories, custom handlers).
  • Harden the API surface:
  • Require authentication and authorization for endpoints that can initiate outbound database connections or handle advanced configuration.
  • Apply rate limiting and monitoring on such endpoints to reduce blind exploitation attempts.
  • Apply least privilege at runtime:
  • Run the H2O-3 process with minimal OS and network privileges to limit blast radius if exploitation occurs.
  • Segment network access so that H2O-3 cannot reach untrusted or attacker-controlled services unless explicitly required.
  • Validate configuration semantics:
  • Enforce strict schemas on incoming connection configuration, rejecting unknown or suspicious parameters and disallowing dynamic class loading settings.

How teams detect issues like this

Detection can blend static review of the codebase with runtime monitoring:

  • Static analysis and code review:
  • Flag endpoints that accept JDBC URLs, connection strings, or driver configuration as user input.
  • Identify use of blacklist-based parameter filtering and encourage migration to allow-list, schema-based validation.
  • Search for use of driver-specific hooks (e.g., socketFactory, custom factory classes) that can be influenced by external input.
  • Configuration and policy enforcement:
  • Apply centralized policies that restrict which JDBC drivers and parameters are allowed in production.
  • Use security gates in CI/CD to block deployments when new, unvetted driver configuration paths are introduced.
  • Runtime and log-based detection:
  • Monitor API logs for unusual JDBC URL schemes or unexpected parameters in /99/ImportSQLTable requests (e.g., jdbc:postgresql: with custom factory settings).
  • Alert on failed or anomalous database connection attempts with unusual driver configuration, especially originating from unauthenticated calls.
  • Automated tooling:
  • Integrate SAST tools that understand Java/JDBC patterns and can highlight untrusted input flowing into driver configuration.
  • Use API security testing tools or fuzzers to exercise configuration endpoints with varied JDBC protocols and parameters.

Sources

SourceLink
github.comgithub.com/h2oai/h2o-3/commit/b9ae2d3c5220db2dc53753357a783e590364d044
huntr.comhuntr.com/bounties/6954fe04-b905-453f-8c53-205ac8377e0d

Frequently asked

questions

Yes. Because the affected /99/ImportSQLTable endpoint is unauthenticated, any remote user who can reach the H2O-3 HTTP interface can attempt to exploit the issue, subject to network access controls.

No application-level credentials are required. However, the attacker must be able to send HTTP requests to the H2O-3 server and reach the vulnerable endpoint, so network-level restrictions and firewalls can reduce exposure.

Move away from driver-specific blacklists and implement strong, schema-based validation and allow-lists for JDBC drivers and parameters. Ensure that user input cannot directly control class names, factory parameters, or other execution hooks used by JDBC drivers.

Treat all configuration that influences code loading or connection behavior as high-risk. Only expose minimal, strictly-validated configuration options to users, enforce authentication for sensitive operations, and regularly review endpoints that trigger outbound connections or dynamic integrations for injection-style risks.

Find out what's already
exploitable in your codebase.