/

CVE-2026-27727

Severity:

CRITICAL RISK

(9.8)

Remote Code Execution via Unsafe Remote Class Loading

CVE-2026-27727

Modified

Vulnerability type

Category:

Remote Code Execution via Unsafe Remote Class Loading

CWE:

CWE-74, CWE-502

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

mchange-commons-java contains a JNDI-like reference resolution mechanism that can honor remote factoryClassLocation values, enabling code to be downloaded and executed inside a running Java application.

If an attacker can cause the application to process a malicious javax.naming.Reference or serialized object, they may trigger arbitrary code execution even when the JDK's own JNDI protections are enabled.

Affected context

This vulnerability affects Java applications that:

  • Include vulnerable versions of mchange-commons-java on the application CLASSPATH
  • Use its JNDI-like reference resolution paths directly or indirectly (for example via libraries such as c3p0)
  • Accept or process javax.naming.Reference instances or serialized objects that might originate from untrusted or partially trusted sources

The issue becomes relevant in environments where attackers can influence naming references, serialized payloads, or configuration/state passed into components that rely on mchange-commons-java's JNDI-like mechanisms.

Exploit preconditions

  • Attack surface: Any code path that:
  • Deserializes attacker-controlled objects that include javax.naming.Reference-like data, or
  • Passes attacker-influenced Reference objects into APIs backed by mchange-commons-java's JNDI-like implementation.
  • Required access: Ability to supply or manipulate naming references or serialized data consumed by the application (e.g., via network APIs, messaging systems, configuration channels, or persistence layers).
  • Trigger point: Resolution/dereferencing of the malicious reference, causing the library to honor a remote factoryClassLocation and attempt to load code from attacker-controlled URLs.
  • Why exploitation is possible: The independent JNDI-like implementation in mchange-commons-java performs remote codebase lookups and class loading by default in vulnerable versions, without deferring to the hardened JDK property com.sun.jndi.ldap.object.trustURLCodebase, thereby bypassing core JDK hardening.

Why this happens

The underlying issue is an unsafe design pattern where untrusted or loosely validated reference data is allowed to influence remote class loading behavior.

mchange-commons-java mirrors early JNDI behavior by supporting remote factoryClassLocation URLs that can specify where factory classes should be downloaded from and instantiated. When this behavior is applied to input that can be attacker-controlled (such as hostile javax.naming.Reference objects or deserialized payloads), it effectively enables remote codebase injection and execution. This maps conceptually to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because the library treats externalized reference values (including URLs and class identifiers) as trusted directives for a downstream component (the classloader and networking stack), without neutralizing or constraining them to safe, local codebases or vetted endpoints.

Potential impact

  • Remote execution of attacker-supplied code within the application's JVM
  • Full compromise of the affected application, including access to its data and secrets
  • Lateral movement within the hosting environment or container
  • Abuse of application identity to pivot to downstream services and databases
  • Establishment of persistent backdoors or malware within the application runtime

General mitigation guidance

Effective mitigation focuses on limiting or eliminating remote class loading based on untrusted reference data and constraining how naming references are resolved:

  • Prefer configurations and library choices where JNDI or JNDI-like functionality is disabled, especially for remote codebase resolution.
  • Restrict reference handling so that factoryClassLocation and similar parameters are either ignored or strictly limited to a known, local, and vetted set of classes or packages.
  • Treat all javax.naming.Reference inputs and serialized objects as untrusted; design APIs to avoid passing raw, externally sourced references into internal resolution mechanisms.
  • Adopt a strict class loading model that disallows dynamic loading from arbitrary URLs or codebases at runtime, especially in server-side applications.
  • Apply least-privilege to the runtime environment, limiting network egress, filesystem access, and permissions so that even if a dereference occurs, the ability to fetch and persist malicious code is constrained.
  • Centralize configuration for naming and connection management so that only trusted, statically defined references are used in production.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis: Search for usage of mchange-commons-java JNDI-like APIs, reference resolution utilities, or code paths that interpret factoryClassLocation or similar fields. Flag any code that passes external or deserialized reference data into these APIs.
  • Code review signals: Look for:
  • Custom integration code between c3p0/mchange-commons-java and naming services
  • Invocation of methods that resolve javax.naming.Reference objects
  • Dynamic URLs or external configuration values that influence class loading decisions
  • Policy enforcement: Define secure coding standards prohibiting remote class loading from arbitrary URLs and requiring that all JNDI or JNDI-like usage be reviewed and justified.
  • Runtime monitoring: Monitor for unusual outbound network connections originating from the JVM to unexpected hosts or protocols that coincide with reference resolution or connection pool initialization.

Sources

SourceLink
github.comgithub.com/swaldman/mchange-commons-java/security/advisories/GHSA-m2cm-222f-qw44
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:14873
access.redhat.comaccess.redhat.com/errata/RHSA-2026:14874
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:34365
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-27727
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2442671
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-27727.json

Frequently asked

questions

Yes, if an attacker can supply or influence javax.naming.Reference objects or serialized data consumed by the application, they may be able to trigger remote code loading and execution over the network.

An attacker needs a path to inject or control the reference or serialized objects that are ultimately processed by components relying on mchange-commons-java's JNDI-like implementation. This can be via remote APIs, messaging systems, compromised configuration channels, or any data flow that leads into reference resolution code.

The safest pattern is to disable or avoid JNDI-like remote codebase resolution entirely, ensure that mchange-commons-java (and dependent libraries such as c3p0) operate with restrictive defaults, and ensure that reference handling is limited to known, local classes rather than arbitrary remote URLs.

Avoid designs where external or serialized metadata can direct class loading or code execution, enforce strong restrictions on JNDI and remote class loading, and use code review and static analysis to identify any use of dynamic codebase URLs or reflection based on untrusted input.

Find out what's already
exploitable in your codebase.