hacktricks/pentesting/pentesting-pop.md
CoolHandSquid f5e27e3c41
HAC POP
2021-09-13 11:39:29 -04:00

120 lines
3.5 KiB
Markdown

# 110,995 - Pentesting POP
## Basic Information
**Post Office Protocol** \(**POP**\) is a type of computer networking and Internet standard **protocol** that extracts and retrieves email from a remote mail server for access by the host machine. **POP** is an application layer **protocol** in the OSI model that provides end users the ability to fetch and receive email \(from [here](https://www.techopedia.com/definition/5383/post-office-protocol-pop)\).
The POP clients generally connect, retrieve all messages, store them on the client system, and delete them from the server. There are 3 versions of POP, but POP3 is the most used one.
**Default ports:** 110, 995\(ssl\)
```text
PORT STATE SERVICE
110/tcp open pop3
```
## Enumeration
### Banner Grabbing
```bash
nc -nv <IP> 110
openssl s_client -connect <IP>:995 -crlf -quiet
```
## Manual
You can use the command `CAPA` to obtain the capabilities of the POP3 server.
## Automated
```bash
nmap --script "pop3-capabilities or pop3-ntlm-info" -sV -port <PORT> <IP> #All are default scripts
```
The `pop3-ntlm-info` plugin will return some "**sensitive**" data \(Windows versions\).
### [POP3 bruteforce](../brute-force.md#pop)
## POP syntax
```bash
POP commands:
USER uid Log in as "uid"
PASS password Substitue "password" for your actual password
STAT List number of messages, total mailbox size
LIST List messages and sizes
RETR n Show message n
DELE n Mark message n for deletion
RSET Undo any changes
QUIT Logout (expunges messages if no RSET)
TOP msg n Show first n lines of message number msg
CAPA Get capabilities
```
From [here](http://sunnyoasis.com/services/emailviatelnet.html)
Example:
```text
root@kali:~# telnet $ip 110
+OK beta POP3 server (JAMES POP3 Server 2.3.2) ready
USER billydean
+OK
PASS password
+OK Welcome billydean
list
+OK 2 1807
1 786
2 1021
retr 1
+OK Message follows
From: jamesbrown@motown.com
Dear Billy Dean,
Here is your login for remote desktop ... try not to forget it this time!
username: billydean
password: PA$$W0RD!Z
```
## HackTricks Automatic Commands
```text
Protocol_Name: POP #Protocol Abbreviation if there is one.
Port_Number: 110 #Comma separated if there is more than one.
Protocol_Description: Post Office Protocol #Protocol Abbreviation Spelled out
Entry_1:
Name: Notes
Description: Notes for POP
Note: |
Post Office Protocol (POP) is a type of computer networking and Internet standard protocol that extracts and retrieves email from a remote mail server for access by the host machine. POP is an application layer protocol in the OSI model that provides end users the ability to fetch and receive email (from here).
The POP clients generally connect, retrieve all messages, store them on the client system, and delete them from the server. There are 3 versions of POP, but POP3 is the most used one.
https://book.hacktricks.xyz/pentesting/pentesting-whois
Entry_2:
Name: Banner Grab
Description: Banner Grab 110
Command: nc -nv {IP} 110
Entry_3:
Name: Banner Grab 995
Description: Grab Banner Secure
Command: openssl s_client -connect {IP}:995 -crlf -quiet
Entry_4:
Name: Nmap
Description: Scan for POP info
Command: nmap --scripts "pop3-capabilities or pop3-ntlm-info" -sV -port 110 {IP}
Entry_5:
Name: Hydra Brute Force
Description: Need User
Command: hydra -l {Username} -P {Big_Passwordlist} -f {IP} pop3 -V
```