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

CVE-2026-105111: Apache Commons BCEL XSS Vulnerability

CVE-2026-105111 is a stored XSS flaw in Apache Commons BCEL affecting Class2HTML webpage generation. Attackers can inject malicious scripts through unescaped class file strings. This article covers technical details, affected versions, and mitigation.

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-105111 Overview

CVE-2026-105111 is a stored cross-site scripting (XSS) vulnerability in Apache Commons BCEL [CWE-79]. The flaw affects the Class2HTML utility, which generates HTML reports from Java class files. Emitters write attacker-controlled class-file strings into the HTML output without escaping, allowing script payloads from a malicious class file to persist in generated reports.

The vulnerability only manifests when an application uses Class2HTML to render reports for class files that may originate from untrusted sources. Apache Commons BCEL versions prior to 6.13.0 are affected. The project fixed the issue in 6.13.0.

Critical Impact

Attackers who supply crafted Java class files to a BCEL-based reporting pipeline can inject persistent JavaScript into HTML reports, executing in the browsers of analysts or users viewing those reports.

Affected Products

  • Apache Commons BCEL versions prior to 6.13.0
  • Applications and tools that invoke Class2HTML to render reports for externally supplied class files
  • Downstream Java tooling that embeds BCEL's AttributeHTML emitter output into web pages

Discovery Timeline

  • 2026-10-06 - CVE-2026-105111 published to the National Vulnerability Database (NVD)
  • 2026-10-07 - Advisory distributed via the OpenWall oss-security mailing list
  • 2026-10-07 - Last updated in NVD database

Technical Details for CVE-2026-105111

Vulnerability Analysis

Apache Commons BCEL (Byte Code Engineering Library) parses, analyzes, and manipulates Java .class files. The Class2HTML utility and its companion emitters, including AttributeHTML, write parsed class-file metadata directly into HTML reports.

Several emitter paths concatenate strings sourced from the parsed class file into HTML markup without applying HTML entity encoding. A Java class file can embed arbitrary strings in constant pool entries, attribute names, and anchor identifiers. When these values flow into the generated report, embedded <script> tags or event handler attributes render as live HTML in the viewer's browser.

The vulnerability is classified as stored XSS because the malicious payload persists in the generated HTML artifact and executes every time a user opens that report. Exploitation requires that a victim view a report rendered from an attacker-controlled class file, which maps to the user-interaction requirement in the CVSS vector.

Root Cause

The root cause is missing output encoding in Class2HTML emitters. The patch introduces calls to Class2HTML.toHTML(...) around attacker-reachable strings before they are written to the output stream, ensuring HTML-significant characters are escaped. One representative change in AttributeHTML.java wraps the anchor value, which is derived from parsed class data, with the HTML escaping helper.

Attack Vector

An attacker crafts a Java class file whose attribute names, anchors, or other parsed strings contain HTML or JavaScript payloads. The attacker then submits the class file to a service that uses BCEL Class2HTML to produce an HTML report, for example a code-analysis portal, a plugin marketplace scanner, or an internal bytecode inspection tool. When an analyst opens the generated report, the payload executes in the context of that web application.

java
// Patch excerpt: src/main/java/org/apache/bcel/util/AttributeHTML.java
// Before (vulnerable): anchor written to HTML unescaped
// printWriter.println("<H4><A NAME=\"" + anchor + "\">" + attrCount + " " + Const.getAttributeName(tag) + "</A></H4>");

// After (fixed): anchor is HTML-escaped via Class2HTML.toHTML
printWriter.println("<H4><A NAME=\"" + Class2HTML.toHTML(anchor) + "\">"
        + attrCount + " " + Const.getAttributeName(tag) + "</A></H4>");

Source: Apache Commons BCEL commit fb72c22

Detection Methods for CVE-2026-105111

Indicators of Compromise

  • HTML reports generated by Class2HTML that contain <script> tags, javascript: URIs, or inline event handlers such as onerror= or onload= inside anchor names or attribute labels.
  • Class files whose UTF-8 constant pool entries, attribute names, or anchor-eligible strings contain HTML metacharacters (<, >, ", ').
  • Unexpected outbound requests from analyst browsers that render BCEL-produced reports, especially to attacker-controlled domains.

Detection Strategies

  • Inventory build and analysis pipelines for Apache Commons BCEL versions and flag any dependency below 6.13.0 using mvn dependency:tree or equivalent SBOM tooling.
  • Scan stored HTML reports for script tags or inline event handlers within structural attributes that should contain only identifiers.
  • Add content security policy (CSP) violation monitoring on portals that display BCEL-generated HTML to surface unexpected script execution attempts.

Monitoring Recommendations

  • Alert on uploads of .class or .jar files to systems that invoke Class2HTML, correlating with subsequent report access events.
  • Monitor web application logs for anomalous script-tag content in cached or stored report bodies.
  • Track dependency updates in CI pipelines so downgrades of commons-bcel below 6.13.0 are flagged automatically.

How to Mitigate CVE-2026-105111

Immediate Actions Required

  • Upgrade Apache Commons BCEL to version 6.13.0 or later in all applications, build tools, and analysis services.
  • Review every call site of org.apache.bcel.util.Class2HTML and related emitters to confirm the input class files are trusted or that the upgrade is in effect.
  • Purge or regenerate previously produced HTML reports that may contain unescaped attacker-controlled strings.

Patch Information

The fix is tracked in Apache Commons BCEL commit fb72c22, which wraps attacker-reachable strings in emitters such as AttributeHTML with Class2HTML.toHTML(...) to perform HTML entity encoding. Upgrade coordinates: org.apache.commons:commons-bcel:6.13.0. Technical references: GitHub BCEL commit patch, Apache mailing list thread, and the OpenWall oss-security advisory.

Workarounds

  • Avoid generating Class2HTML reports from untrusted or externally supplied class files until the upgrade is deployed.
  • Serve generated reports with a strict Content Security Policy that forbids inline script execution, for example Content-Security-Policy: default-src 'self'; script-src 'none'.
  • Post-process emitted HTML through an HTML sanitizer such as OWASP Java HTML Sanitizer before storing or serving it.
bash
# Maven: upgrade Apache Commons BCEL to the fixed release
mvn versions:use-dep-version \
  -Dincludes=org.apache.commons:commons-bcel \
  -DdepVersion=6.13.0 \
  -DforceVersion=true

# Gradle (build.gradle): pin the fixed version
# implementation 'org.apache.commons:commons-bcel:6.13.0'

# Verify no vulnerable version remains on the classpath
mvn dependency:tree -Dincludes=org.apache.commons:commons-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.