> 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/web/host-header/bypass-of-connection-state-validation.md).

# Contorno da Validação do Estado da Conexão

### Bypass de Validação de Host por meio de Ataque de Estado da Conexão

**Descrição da vulnerabilidade**

Este laboratório tem uma **vulnerabilidade do tipo SSRF baseada em roteamento via Host** cabeçalho, ligado ao gerenciamento inadequado do estado da conexão no lado do servidor.

Embora o servidor frontal pareça validar corretamente o `Host` cabeçalho, ele faz uma \*\*hipótese\*\* perigosa:

> Todas as requisições enviadas na mesma conexão TCP são consideradas confiáveis se a **primeira requisição** for válida.

Isso permite injetar uma requisição maliciosa posterior na mesma conexão, contornando a validação inicial.

**Objetivo do laboratório**

* Acessar o painel de administração interno:/ `HTTP://192.168.0.1/admin`
* Excluir usuário **carlos**

**Observação inicial**

Uma requisição direta ao IP interno é bloqueada:

```http
GET / HTTP/1.1
Host: 192.168.0.1
```

O servidor rejeita esta requisição, o que confirma que uma `Host` validação está em vigor **na primeira requisição**.

<figure><img src="/files/4c1542f4ecc69e752e91cc30ecec763b0c1e79b9" alt=""><figcaption></figcaption></figure>

**Operação: ataque de estado da conexão**

A ideia é enviar \*\*várias requisições na mesma conexão TCP\*\*:

1. Uma primeira requisição legítima ao host público (aceita).
2. Uma segunda requisição maliciosa ao IP interno, enviada **na mesma conexão**.

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

No Burp Suite, isso é feito por meio de:

* Agrupar requisições
* Usando **Enviar grupo em uma única conexão**

<figure><img src="/files/58f8f50603036e2ddecde5b98f2e8b3533233de6" alt=""><figcaption></figcaption></figure>

**Acesso ao painel de administração**

Uma vez que a conexão é estabelecida com uma requisição válida, a requisição seguinte ao admin interno é aceita:

```http
GET /admin HTTP/1.1
Host: 192.168.0.1
```

O painel de administração interno então fica acessível.

<figure><img src="/files/3e6f707652f786ef695b1d7d85b4f9739e857fe8" alt=""><figcaption></figcaption></figure>

**Exclusão do usuário**

A remoção do usuário requer uma requisição POST:

```http
POST /admin/delete HTTP/1.1
Host: 192.168.0.1

csrf=ppBVKn8wVrgZifEETHsn48Hykwiq8yFO&username=carlos
```

Resposta do servidor:

<figure><img src="/files/9d4a26f837c74e8a9682a75ea5b93d879802406c" alt="" width="446"><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/web/host-header/bypass-of-connection-state-validation.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.
