/

CVE-2026-27830

Severity:

HIGH RISK

(8.0)

Unsafe Java Deserialization (CWE-502) in c3p0 Pools

CVE-2026-27830

Deferred

Vulnerability type

Category:

Unsafe Deserialization and Code Injection

CWE:

CWE-94, CWE-502

Impact:

Remote Code Execution via unsafe deserialization and JNDI-based code loading

Severity:

HIGH RISK

(8.0)

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

c3p0 ConnectionPoolDataSource implementations prior to 0.12.0 unsafely deserialize hex-encoded Java objects stored in the userOverridesAsString property, and can follow embedded JNDI Reference values to remote locations.

Under conditions where an attacker can reset this property or supply malicious serialized objects or JNDI references, the application's CLASSPATH may be abused to load and execute arbitrary code from local or remote sources.

Affected context

The vulnerability appears in Java applications that:

  • Use c3p0 ConnectionPoolDataSource implementations prior to version 0.12.0
  • Rely on the userOverridesAsString JavaBean property to configure user-specific overrides
  • Expose these DataSource instances or their configuration across JNDI, serialized objects, or other dynamic configuration channels

In such environments, hex-encoded serialized Java objects and embedded javax.naming.Reference values can be processed without sufficient validation or restrictions, creating an unsafe bridge between configuration data and executable code.

Exploit preconditions

  • Attack surface: Application components that consume or expose c3p0 ConnectionPoolDataSource objects, including:
  • JNDI-based DataSource lookups
  • Serialized configuration or object streams
  • Bean property setters for userOverridesAsString
  • Required access: Ability to influence or reset the userOverridesAsString property, or inject malicious serialized objects / JNDI Reference instances that will be processed by c3p0 and mchange-commons-java code.
  • Trigger point: Deserialization of the hex-encoded userOverridesAsString content and dereferencing of embedded javax.naming.Reference objects, which may include remote factoryClassLocation values.
  • Why exploitation is possible: The property is backed by generic Java serialization and early-style JNDI logic. Deserialization trusts attacker-controlled object graphs, and JNDI references can dynamically resolve classes from remote locations without gating or strict policy checks, mapping directly to CWE-502 (unsafe deserialization) and CWE-94 (code injection).

Why this happens

At its core, the bug stems from using Java serialization as the backing format for a writable configuration property that can be exposed and mutated over JNDI and other remote interfaces. The userOverridesAsString property stores a conceptual Map<String, Map<String, String>> as hex-encoded serialized objects, and c3p0 implicitly trusts this serialized data.

When deserialized, the object graph may contain javax.naming.Reference instances that leverage legacy JNDI behavior in mchange-commons-java. Those references can specify remote factoryClassLocation values, which are resolved and used to instantiate classes, effectively turning configuration data into executable code. This pattern aligns with CWE-502: Deserialization of Untrusted Data because untrusted, attacker-controlled serialized objects are treated as authoritative, and CWE-94: Code Injection because attackers can influence which code is loaded and executed via JNDI-based class resolution. The architectural assumption that serialized objects are benign configuration rather than untrusted input creates the systemic fragility.

Potential impact

  • Arbitrary code execution within the Java application process via malicious JNDI references and class loading
  • Download and execution of attacker-controlled code from remote locations referenced by factoryClassLocation
  • Compromise of database credentials and pooled connections managed by c3p0
  • Full application takeover and potential lateral movement in the hosting environment
  • Data corruption, exfiltration, or impersonation using compromised ConnectionPoolDataSource instances

General mitigation guidance

Pattern-based mitigation for this class of issue focuses on eliminating unsafe serialization in configuration paths and hardening dynamic code loading mechanisms:

  • Prefer transparent, text-based configuration formats (such as CSV, JSON, or XML) over Java object serialization for properties that may be exposed through JNDI, configuration files, or remote beans.
  • Enforce strict separation between configuration data and executable behavior: configuration values should not be able to dictate class locations or object types beyond a controlled whitelist.
  • Gate all JNDI-based class resolution behind explicit policy, such as:
  • Restricting remote factoryClassLocation usage
  • Limiting allowed namespaces and class names to a curated set
  • Disallowing arbitrary remote endpoints from determining class loading behavior
  • Apply least-privilege principles to components that interact with JNDI and class loaders, reducing the blast radius if a misconfiguration is exploited.
  • Treat any serialized input (including hex-encoded blobs) as untrusted unless it is generated and consumed in a tightly controlled context; avoid deserializing attacker-controllable data with general-purpose serialization frameworks.

How teams detect issues like this

Detection commonly centers around identifying unsafe deserialization paths, configuration-driven class loading, and overly permissive JNDI usage:

  • Use static analysis to flag:
  • Deserialization of data from configuration properties, JNDI lookups, and other dynamic sources
  • Calls that instantiate or dereference javax.naming.Reference objects, especially where remote factoryClassLocation values are possible
  • Utility methods that wrap Java serialization or JNDI resolution without enforcing strict validation or whitelisting
  • Conduct focused code reviews on:
  • DataSource and connection pool configuration handling
  • JavaBean properties that store complex object graphs or encoded serialized content
  • Any glue code bridging JNDI, configuration storage, and class loading mechanisms
  • Apply policy-based enforcement in CI/CD pipelines:
  • Require justification and explicit patterns for JNDI usage and dynamic class loading
  • Prohibit custom serialization formats for configuration unless they are schema-validated and non-executable
  • Consider leveraging automated security tooling that can trace deserialization sinks and JNDI entry points, correlating them with attacker-controlled sources.

Sources

SourceLink
github.comgithub.com/swaldman/c3p0/commit/e14cbd8166e423e2e9a9d6f08b2add3433492d6e
github.comgithub.com/swaldman/c3p0/security/advisories/GHSA-5476-xc4j-rqcv
mogwailabs.demogwailabs.de/en/blog/2025/02/c3p0-you-little-rascal
mchange.commchange.com/projects/c3p0/#configuring_security
mchange.commchange.com/projects/c3p0/#security-note
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18054
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18055
access.redhat.comaccess.redhat.com/errata/RHSA-2026:18059
access.redhat.comaccess.redhat.com/errata/RHSA-2026:28385
access.redhat.comaccess.redhat.com/errata/RHSA-2026:3890
access.redhat.comaccess.redhat.com/errata/RHSA-2026:4285
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-27830
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2442908
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-27830.json

Frequently asked

questions

Exploitability depends on how c3p0 DataSource instances are exposed. If userOverridesAsString or related serialized objects can be influenced via JNDI, remote configuration, or untrusted input channels, the vulnerability can be broadly exploitable. In tightly controlled environments where those properties are never set from untrusted sources, risk is reduced but not entirely eliminated.

An attacker must be able to reset or supply malicious values for userOverridesAsString or craft serialized objects and JNDI Reference instances that the application will deserialize and process. This could arise from access to configuration endpoints, JNDI naming contexts, serialized object streams, or any integration that passes c3p0 DataSource objects through potentially untrusted layers.

The safest pattern is to remove Java serialization from configuration pathways and forbid configuration-driven dynamic class loading. Replace serialized-object formats with simple, text-based representations that are schema-validated, and ensure that any JNDI or class loading functionality operates on a strict whitelist of known-safe classes and locations rather than attacker-controlled values.

Treat deserialization and JNDI as high-risk primitives. During design and code review:

  • Avoid using object serialization for configuration or cross-boundary data exchange where untrusted input may appear.
  • Establish architectural policies that ban unchecked dynamic class loading and remote code resolution.
  • Integrate static analysis and security review practices that explicitly search for deserialization sinks and JNDI usage, requiring documented justification and protective controls whenever these features are used.
Find out what's already
exploitable in your codebase.