Apache MINA acceptMatchers Deserialization Filter Bypass to RCE (CVE-2026-42779)
by Venkatraman Kumar (Securin); PoC by dinosn · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-42779
- Category
- network
- Affected product
- Apache MINA (mina-core)
- Affected versions
- 2.1.0 - 2.1.11 (fixed 2.1.12); 2.2.0 - 2.2.6 (fixed 2.2.7)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Tags
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-05 |
| Author / Researcher | Venkatraman Kumar (Securin); PoC by dinosn |
| CVE / Advisory | CVE-2026-42779 |
| Category | network |
| Severity | Critical |
| CVSS Score | 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Status | PoC |
| Tags | apache-mina, java, deserialization, cwe-502, gadget-chain, commons-collections, rce, filter-bypass |
| Related | CVE-2026-41635 (incomplete fix that this CVE re-opens) |
Affected Target
| Field | Value |
|---|---|
| Software / System | Apache MINA (mina-core) |
| Versions Affected | 2.1.0 - 2.1.11 (fixed 2.1.12); 2.2.0 - 2.2.6 (fixed 2.2.7) |
| Language / Platform | Java, network application framework using ObjectSerializationCodecFactory |
| Authentication Required | No (network-level access to a MINA endpoint that uses ObjectSerializationCodecFactory is sufficient) |
| Network Access Required | Yes (raw TCP access to the MINA-based service/protocol endpoint) |
Summary
CVE-2026-42779 is a deserialization filter bypass in Apache MINA’s AbstractIoBuffer.resolveClass(). Applications configure an acceptMatchers allowlist to restrict which Java classes ObjectSerializationCodecFactory may deserialize, but the allowlist check is only reached when ObjectStreamClass.forClass() returns non-null; when it returns null (as it does for “type-0” class descriptors covering non-Serializable classes, primitives, and arrays), resolveClass() calls Class.forName() directly with no filter check at all. By crafting a payload that uses type-0 descriptors for classes that are actually Serializable gadget-chain classes, an attacker bypasses the allowlist entirely and achieves full RCE via standard Java deserialization gadget chains (e.g. Commons Collections). This is an incomplete-fix re-opening of CVE-2026-41635 that was never backported to the 2.1.x/2.2.x branches. The PoC includes three escalating Java programs plus a Docker/Makefile harness and before/after screenshots.
Vulnerability Details
Root Cause
AbstractIoBuffer.resolveClass() calls desc.forClass() first; if it returns a non-null Class, the acceptMatchers filter is applied. If it returns null (the “type-0” branch used for non-Serializable classes, primitives, and arrays in MINA’s custom serialization protocol), the method falls through to Class.forName(name, false, classLoader) with no filter check whatsoever. Because the attacker fully controls the serialized byte stream, they can encode Serializable gadget-chain classes using type-0 descriptors instead of the expected type-1 form, causing every class in the deserialization graph to bypass acceptMatchers regardless of the application’s configured allowlist. The 2.1.12/2.2.7 fix moves the filter check before the forClass() branch so it always applies.
Attack Vector
- Target application exposes a MINA-based network endpoint using
IoBuffer.getObject()/ObjectSerializationCodecFactory, with anacceptMatchersfilter configured (unfiltered apps were already exploitable via the earlier CVE-2026-41635). - A gadget-chain library (e.g. Commons Collections) is present on the target’s classpath.
- Attacker crafts a MINA protocol payload encoding gadget-chain classes with type-0 (non-Serializable-style) class descriptors instead of type-1.
readClassDescriptor()delegates to standard Java deserialization for the type-0 descriptor;resolveClass()seesforClass() == nulland callsClass.forName()without checkingacceptMatchers.- The full gadget chain (e.g. CC6:
HashSet->TiedMapEntry->LazyMap->ChainedTransformer->Runtime.exec()) is deserialized and triggered viareadObject(), achieving remote code execution.
Impact
Remote code execution on any network service built on Apache MINA 2.1.0-2.1.11 / 2.2.0-2.2.6 that uses ObjectSerializationCodecFactory with an acceptMatchers allowlist and has a usable gadget-chain library on the classpath — the allowlist provides no protection.
Environment / Lab Setup
Target: Apache MINA 2.2.6 (vulnerable, bundled as lib/mina-core-2.2.6.jar) vs. 2.2.7 (patched)
Attacker: JDK 11+, Maven (source build) or Docker; commons-collections-3.2.2.jar for the RCE gadget chain (bundled in lib/)
Proof of Concept
PoC Script
See
FilterBypassPoC.java,CraftedBypassPoC.java,RcePoC.java,Dockerfile,entrypoint.sh,Makefile,lib/(bundledmina-core-2.2.6.jarandcommons-collections-3.2.2.jar), andscreenshots/in this folder.
| |
FilterBypassPoC demonstrates the filter bypass for primitives, non-Serializable classes, and arrays; CraftedBypassPoC shows an attacker-crafted type-0 payload bypassing the filter for an arbitrary Serializable class; RcePoC chains a CC6 Commons Collections gadget through the bypass to achieve full command execution. Screenshots in screenshots/ show each test passing (bypassed) against vulnerable MINA 2.2.6 and being blocked against patched 2.2.7.
Detection & Indicators of Compromise
Signs of compromise:
- JVM crash dumps or logs referencing
ClassNotFoundException/gadget classes (e.g.TiedMapEntry,ChainedTransformer) around a MINA service - Anomalous outbound connections or spawned shell processes from a MINA-based server process
- Presence of unexpected classes on the classpath being exercised via deserialization (Commons Collections, Spring beans, etc.)
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade Apache MINA to 2.1.12 or 2.2.7, which apply the acceptMatchers filter before the forClass() branch check |
| Interim mitigation | Avoid using IoBuffer.getObject() / ObjectSerializationCodecFactory with untrusted input; add a JEP 290 (ObjectInputFilter) serialization filter as a defense-in-depth layer; remove unnecessary gadget-chain libraries (Commons Collections, etc.) from the classpath |
References
Notes
Mirrored from https://github.com/dinosn/CVE-2026-42779 on 2026-07-05.
| |