Skip to main content
Vulnerability Database/CVE-2026-94114

CVE-2026-94114: Apache Commons BCEL Class Mapping Vulnerability

CVE-2026-94114 is a symbolic name mapping flaw in Apache Commons BCEL that allows attackers to manipulate class caching and verification. This post explains its technical details, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-94114 Overview

CVE-2026-94114 is a symbolic-name confusion vulnerability in Apache Commons Byte Code Engineering Library (BCEL) versions prior to 6.13.0. The library caches attacker-controlled classes under their self-declared this_class names without validating the originally requested name. Subsequent lookups and name-keyed verification results can then resolve to a different class than the caller expected. The flaw is tracked as CWE-386: Symbolic Name not Mapping to Correct Object. Apache fixed the issue in Commons BCEL 6.13.0.

Critical Impact

Applications that rely on BCEL repositories for bytecode analysis or verification may act on class metadata attributed to the wrong class, undermining downstream security checks that trust the repository mapping.

Affected Products

  • Apache Commons BCEL versions before 6.13.0
  • Java applications and frameworks embedding Commons BCEL for bytecode inspection or verification
  • Static analysis and classloading tools that depend on BCEL Repository lookups

Discovery Timeline

  • 2026-10-06 - CVE-2026-94114 published to NVD
  • 2026-10-07 - Last updated in NVD database

Technical Details for CVE-2026-94114

Vulnerability Analysis

Apache Commons BCEL provides repository classes that load and cache parsed JavaClass instances for later lookup by name. In AbstractClassPathRepository and ClassLoaderRepository, the repository parsed a class file requested under a given className and then stored it in the cache using the name declared inside the parsed bytes (the this_class field). Because the this_class field is attacker-controlled when the class file comes from an untrusted source, a class file retrieved under one name could overwrite or populate the repository entry for a completely different name.

Consumers that later ask the repository for a class by its symbolic name receive a class object whose actual contents and declared identity differ from the requested name. Any name-keyed verification result, such as hierarchy checks or type-safety verification, is then associated with the wrong class [CWE-386].

Root Cause

The root cause is missing validation between the requested class name and the parsed class's declared name before caching. The JDK's defineClass() rejects this exact mismatch, but BCEL's repository implementations did not. The patch adds an explicit equality check and throws ClassNotFoundException when the names differ.

Attack Vector

An attacker who can influence the class bytes returned for a lookup, for example through a crafted JAR on the classpath or a controlled input stream fed into a ClassParser, can supply a class whose this_class declares an arbitrary name. The repository caches the class under the declared name and returns it for later lookups keyed on that name. Downstream code that relies on the repository mapping for authorization or verification decisions operates on substituted class metadata.

java
// Patch excerpt: src/main/java/org/apache/bcel/util/AbstractClassPathRepository.java
if (inputStream != null) {
    final ClassParser parser = new ClassParser(inputStream, className);
    final JavaClass clazz = parser.parse();
    // The this_class name inside the parsed bytes is attacker-controlled: caching it under its own name
    // would let a class file found under one name poison the repository entry for another (the JDK's
    // defineClass() rejects the same mismatch). Refuse to cache or return it.
    if (!clazz.getClassName().equals(className)) {
        throw new ClassNotFoundException("Class name mismatch: requested " + className
            + " but the class file declares " + clazz.getClassName());
    }
    storeClass(clazz);
    return clazz;
}
// Source: https://github.com/apache/commons-bcel/commit/14890bf2b9014df25f9b4de86f29b5e917e5656b.patch

An equivalent fix was applied to ClassLoaderRepository. See the Apache Commons BCEL patch commit.

Detection Methods for CVE-2026-94114

Indicators of Compromise

  • Presence of commons-bcel JAR files with versions earlier than 6.13.0 in application dependencies or deployed artifacts.
  • ClassNotFoundException entries referencing a class-name mismatch after upgrading to 6.13.0, indicating a prior attempt to poison the repository.
  • Unexpected classes resolved through BCEL Repository.lookupClass() whose getClassName() differs from the requested symbolic name in application logs.

Detection Strategies

  • Inventory Java application dependencies using Software Composition Analysis (SCA) tools and flag org.apache.bcel:bcel or commons-bcel:commons-bcel versions below 6.13.0.
  • Review usages of AbstractClassPathRepository and ClassLoaderRepository in internal code to confirm whether untrusted class files can reach these repositories.
  • Audit build pipelines and classpath construction for JARs sourced from external or user-controlled locations.

Monitoring Recommendations

  • Monitor application logs for new ClassNotFoundException messages containing the text Class name mismatch after deploying BCEL 6.13.0.
  • Track process execution and file-write telemetry on application servers for unexpected JAR drops or classpath modifications.
  • Alert on anomalous class loading patterns from services that process user-submitted bytecode, archives, or plugins.

How to Mitigate CVE-2026-94114

Immediate Actions Required

  • Upgrade Apache Commons BCEL to version 6.13.0 or later across all applications and transitive dependencies.
  • Rebuild and redeploy any Java artifacts that bundle the vulnerable BCEL version as a shaded or relocated dependency.
  • Restrict the sources of class files passed to BCEL ClassParser and repository implementations to trusted inputs only.

Patch Information

The fix is included in Apache Commons BCEL 6.13.0. It adds a name validation step in both AbstractClassPathRepository.loadClass() and ClassLoaderRepository.loadClass() that throws ClassNotFoundException when the parsed class's this_class name does not match the requested className. See the Apache Commons BCEL patch commit and the Apache mailing list announcement for details. An advisory summary is also available on Openwall oss-security.

Workarounds

  • If upgrading immediately is not possible, wrap repository lookups with code that re-verifies JavaClass.getClassName() against the requested name and discards mismatches.
  • Disable or isolate code paths that feed untrusted class bytes into BCEL repositories, for example plugin loaders or archive scanners.
  • Run bytecode-processing services with least-privilege accounts and network egress restrictions to limit downstream impact of substituted class metadata.
bash
# Maven dependency update to the fixed version
mvn versions:use-dep-version -Dincludes=org.apache.bcel:bcel -DdepVersion=6.13.0 -DforceVersion=true

# Gradle dependency pin (build.gradle)
# implementation 'org.apache.bcel:bcel:6.13.0'

# Verify no vulnerable versions remain on the classpath
mvn dependency:tree | grep -i bcel

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.