# POP3

> *Source CTF and HTB Academy*

* Usually ports 110, 995

POP3 provides listing, retrieving, and deleting emails as functions at the email server.

## Commands

| Command         | Description                                                 |
| --------------- | ----------------------------------------------------------- |
| `USER username` | Identifies the user.                                        |
| `PASS password` | Authentication of the user using its password.              |
| `STAT`          | Requests the number of saved emails from the server.        |
| `LIST`          | Requests from the server the number and size of all emails. |
| `RETR id`       | Requests the server to deliver the requested email by ID.   |
| `DELE id`       | Requests the server to delete the requested email by ID.    |
| `CAPA`          | Requests the server to display the server capabilities.     |
| `RSET`          | Requests the server to reset the transmitted information.   |
| `QUIT`          | Closes the connection with the POP3 server.                 |

## Dangerous settings

Same as imap see [here](/pentips/networking-protocols-and-network-pentest/imap.md)

## Enumeration

* `openssl s_client -connect TARGET-IP:995 -crlf -quiet` (995 is the port)
* `sudo nmap 10.129.14.128 -sV -p110,995 -sC`
* `sudo nmap -p 110,995 --script=pop3-* TARGET-IP` will try different enumeration including username enumeration
* `openssl s_client -connect 10.129.14.128:pop3s`
* `curl -k 'pop3s://10.129.250.84' --user robin:robin -v`

## Password spray & bruteforce

* `hydra pop3://TARGET-IP/TLS -L users.txt -P passwords.txt`

## Connect to an email account with openssl

```bash
openssl s_client -connect TARGET-IP:995
USER username@domain.com
PASS password
```

## Resources

{% embed url="<https://book.hacktricks.xyz/network-services-pentesting/pentesting-pop>" %}
Pentesting POP - Hacktricks
{% endembed %}


---

# 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://csbygb.gitbook.io/pentips/networking-protocols-and-network-pentest/pop3.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.
