Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2024-36401 PoC — Remote Code Execution (RCE) vulnerability in evaluating property name expressions in Geoserver

Source
Associated Vulnerability
Title:Remote Code Execution (RCE) vulnerability in evaluating property name expressions in Geoserver (CVE-2024-36401)
Description:GeoServer is an open source server that allows users to share and edit geospatial data. Prior to versions 2.22.6, 2.23.6, 2.24.4, and 2.25.2, multiple OGC request parameters allow Remote Code Execution (RCE) by unauthenticated users through specially crafted input against a default GeoServer installation due to unsafely evaluating property names as XPath expressions. The GeoTools library API that GeoServer calls evaluates property/attribute names for feature types in a way that unsafely passes them to the commons-jxpath library which can execute arbitrary code when evaluating XPath expressions. This XPath evaluation is intended to be used only by complex feature types (i.e., Application Schema data stores) but is incorrectly being applied to simple feature types as well which makes this vulnerability apply to **ALL** GeoServer instances. No public PoC is provided but this vulnerability has been confirmed to be exploitable through WFS GetFeature, WFS GetPropertyValue, WMS GetMap, WMS GetFeatureInfo, WMS GetLegendGraphic and WPS Execute requests. This vulnerability can lead to executing arbitrary code. Versions 2.22.6, 2.23.6, 2.24.4, and 2.25.2 contain a patch for the issue. A workaround exists by removing the `gt-complex-x.y.jar` file from the GeoServer where `x.y` is the GeoTools version (e.g., `gt-complex-31.1.jar` if running GeoServer 2.25.1). This will remove the vulnerable code from GeoServer but may break some GeoServer functionality or prevent GeoServer from deploying if the gt-complex module is needed.
Description
本脚本是针对 GeoServer 的远程代码执行漏洞(CVE-2024-36401)开发的 PoC(Proof of Concept)探测工具。该漏洞允许攻击者通过构造特定请求,在目标服务器上执行任意命令。
Readme
> ⚠️ **免责声明:** 此工具仅供安全研究与合法授权测试使用,请勿用于非法用途。使用者需自行承担法律责任。

README Version: \[[English](README_EN.md) | [中文](README.md)\]

## 漏洞描述

本脚本是针对 [GeoServer](https://geoserver.org/) 的远程代码执行漏洞(CVE-2024-36401)开发的 PoC(Proof of Concept)探测工具。该漏洞允许攻击者通过构造特定请求,在目标服务器上执行任意命令。

---

## 环境依赖

请确保你的运行环境已安装以下依赖项:

- Python 3.x
- 第三方库:
  - `requests`
  - `lxml`

可通过以下命令安装所需依赖:

```bash
pip install requests lxml
```

---

## 使用说明

### 单个目标检测

```bash
python poc.py -u http://target.com -d dnslog.example.com
```

或指定要执行的命令:

```bash
python poc.py -u http://target.com -c "touch /tmp/vulntest"
```

### 批量检测多个目标

准备一个包含多个目标 URL 的文本文件(每行一个):

```bash
python poc.py -uf targets.txt -d dnslog.example.com
```

或指定命令:

```bash
python poc.py -uf targets.txt -c "id"
```

详细使用说明:
[详细使用说明文档](漏洞探测脚本详细使用文档.pdf)


---

## 参数说明

| 参数                | 描述                                                         |
| ------------------- | ------------------------------------------------------------ |
| `-u`, `--url`       | 指定单个目标地址                                             |
| `-uf`, `--url-file` | 指定包含多个目标 URL 的文件路径                              |
| `-d`, `--dnslog`    | 指定 DNSLog 地址                                             |
| `-c`, `--command`   | 指定要在目标系统上执行的命令(如:`whoami`, `id`, `curl` 等) |

> ⚠️ 注意:`-d` 和 `-c` 参数不可同时使用。

---

## 输出示例

```text
[INFO] 爬取到3个有效的 Typenames,开始漏洞探测
[INFO] 目标: http://example.com
[INFO] 执行命令: whoami
[INFO] DNSLOG地址:

[INFO] 正在尝试 typeName: topp:states -> whoami
[+] 命令疑似成功执行!目标: http://example.com 命令: whoami
```

---

## 脚本特性

- 修复Nuclei POC中由于Typenames写死,造成漏洞验证失败的问题。
- 自动化的爬取所有Typenames信息,并循环测试可以利用的Typenames。
- 支持使用 -c 参数执行命令。
- 支持传入URL文件,批量测试漏洞是否存在。

---

## 安全建议

- 及时升级 GeoServer 至官方最新版本。
- 对公网暴露的 GeoServer 实例进行访问控制。
- 配置防火墙限制 `/geoserver/wfs` 接口的访问来源。

---

## 贡献

欢迎提交 Issue 或 Pull Request 来帮助改进此项目。

---

## 许可证

该项目采用 [MIT 许可证](LICENSE),你可以自由修改、分发、商业使用,但必须保留版权声明。

---

File Snapshot

[4.0K] /data/pocs/b71fb6032343068f91f774509ae5ec3b2795bea8 ├── [1.1K] LICENSE ├── [6.4K] poc_CN.py ├── [6.6K] poc_EN.py ├── [3.4K] README_EN.md ├── [2.9K] README.md └── [674K] 漏洞探测脚本详细使用文档.pdf 0 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →