/

CVE-2025-27511

Severity:

HIGH RISK

(7.2)

JNDI Injection (CWE-74) in GeoServer DB2 Extension

CVE-2025-27511

Analyzed

Vulnerability type

Category:

JNDI Injection

CWE:

CWE-74, CWE-502

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.2)

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

GeoServer's DB2 DataStore extension is vulnerable to JNDI-based injection in the JDBC connection URL, allowing attacker-controlled lookups to remote resources.

When an administrator configures a malicious DB2 JDBC URL, this can lead to remote code execution in the GeoServer process, especially in environments that resolve untrusted JNDI endpoints.

Affected context

The vulnerability occurs in GeoServer deployments that use the DB2 DataStore extension and allow administrators (or anyone with equivalent configuration privileges) to define or modify DB2 JDBC connection URLs.

It becomes risky when:

  • GeoServer runs on a JVM that performs JNDI lookups embedded in JDBC URLs, and
  • The environment can reach attacker-controlled JNDI endpoints (e.g., LDAP, RMI, or other directory services).

In such configurations, a crafted JDBC URL can cause GeoServer to resolve remote objects that execute code within the server's JVM.

Exploit preconditions

  • Attack surface: GeoServer administrative interface, configuration files, or APIs that set DB2 JDBC connection parameters.
  • Required access: Privileges to create or edit DB2 data stores (typically administrator or high-privilege user within GeoServer).
  • Trigger point: GeoServer initiating a DB2 connection using the supplied JDBC URL (e.g., on data store validation, startup, or query execution).
  • Why exploitation is possible: The DB2 JDBC URL is treated as trusted configuration and may be processed by JNDI-capable mechanisms without sanitization or restriction, enabling injection of attacker-controlled JNDI endpoints and subsequent loading of remote objects.

Why this happens

At its core, this issue stems from treating user-supplied or administratively-supplied connection strings as inherently trustworthy and passing them to components that support JNDI resolution.

This aligns with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because special JNDI-related elements in the JDBC URL are not neutralized or constrained before being used by the downstream JDBC/JNDI stack.

In some environments, this may also intersect with CWE-502: Deserialization of Untrusted Data, where remotely loaded objects or serialized payloads are instantiated or deserialized during the JNDI lookup lifecycle.

The insecure pattern is allowing configuration-driven URLs to control low-level naming or lookup mechanisms that can fetch and execute logic from remote locations.

Potential impact

  • Remote code execution within the GeoServer JVM process
  • Full compromise of the GeoServer instance and its configuration
  • Unauthorized access to geospatial data sources and sensitive connection credentials
  • Lateral movement to other systems reachable from the GeoServer host
  • Service disruption or data integrity loss through malicious server-side actions

General mitigation guidance

Effective mitigation focuses on limiting the power of connection URLs and blocking untrusted JNDI resolution pathways.

Common high-level defensive patterns include:

  • Constraining JDBC URL formats to a strict, validated set of patterns that do not permit arbitrary JNDI endpoints or protocol changes.
  • Normalizing and sanitizing configuration inputs before passing them to low-level JDBC/JNDI APIs, rejecting unexpected prefixes, tokens, or schemes.
  • Disabling or strictly limiting JNDI-based lookups for database connections, especially for protocols that can load remote code.
  • Running GeoServer under a security manager or equivalent sandboxing model (where available) and adhering to least-privilege principles for filesystem, network, and process capabilities.
  • Segregating administrative duties and restricting who can define or modify data store connection parameters, reducing the impact of credential or account compromise.

How teams detect issues like this

Detection generally involves both code-level and configuration-level scrutiny:

  • Static analysis: Look for code paths that:
  • Accept raw JDBC URLs and pass them directly to drivers or data source factories.
  • Allow dynamic protocol, host, or naming context configuration without validation.
  • Code review signals:
  • Use of generic JNDI APIs or URL-based data source factories where input comes from configuration screens or XML/JSON configs.
  • Lack of whitelisting or pattern checks around database connection strings.
  • Configuration and runtime monitoring:
  • Scanning GeoServer configuration (e.g., data store definitions) for suspicious JDBC URL patterns, such as embedded JNDI references or unexpected protocols.
  • Network monitoring for outbound connections from GeoServer to unknown directory services or unusual ports during data store initialization.
  • Policy enforcement:
  • Implement CI/CD checks and governance rules that block unsafe connection string patterns or configuration changes before deployment.

Sources

SourceLink
github.comgithub.com/geoserver/geoserver/releases/tag/2.27.0
github.comgithub.com/geoserver/geoserver/security/advisories/GHSA-g628-r368-6vh7
nvd.nist.govnvd.nist.gov/vuln/detail/cve-2023-27867
osgeo-org.atlassian.netosgeo-org.atlassian.net/browse/GEOT-7725

Frequently asked

questions

It depends on how administrative access is exposed. If GeoServer's admin interface or configuration APIs are reachable from the internet and an attacker can obtain those privileges, then the issue can be exploited remotely. Otherwise, it is typically limited to whoever can modify data store settings.

The attacker must be able to configure or modify DB2 data store connection settings, which usually requires administrator or equivalent high-privilege access to GeoServer. Compromised admin credentials or abused automation accounts are common practical paths.

The safest pattern is to restrict and validate JDBC URLs to a known-safe subset, and to decouple configuration-driven input from any JNDI-capable or code-loading mechanisms. Enforcing strict validation and disabling remote JNDI lookups where possible significantly reduces risk.

Treat all configuration values, including those entered by administrators, as potentially untrusted. Apply schema validation, whitelisting, and normalization for connection strings; avoid designs where configuration can influence class loading, naming lookups, or deserialization behavior; and incorporate security-focused reviews and automated checks around configuration-driven integration points.

Find out what's already
exploitable in your codebase.