Hunting (Traffic)
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
TL;DR
Protocols without TLS send logins in cleartext. A capture file left on a box, or traffic you record on a host you control, can hold usernames, passwords, community strings, and NTLM hashes. Search it with Wireshark filters, or let Pcredz pull every credential at once.
Cleartext protocols
Each of these has an encrypted counterpart. Legacy systems and test services still run the cleartext one.
| Cleartext | Encrypted | Leaks |
|---|---|---|
| HTTP | HTTPS | Form logins, Basic auth headers |
| FTP | FTPS, SFTP | USER and PASS |
| SNMP v1, v2c | SNMPv3 | Community strings |
| POP3, IMAP | POP3S, IMAPS | Mail logins |
| SMTP | SMTPS, STARTTLS | AUTH logins |
| LDAP | LDAPS | Simple bind passwords |
| SMB, HTTP NTLM | SMB 3 encryption | NTLMv1 and NTLMv2 hashes |
| Telnet | SSH | Logins typed in the session |
Capture traffic
With root on a host that sees other traffic, record to a file and search it later:
sudo tcpdump -i eth0 -w capture.pcap # -w write raw packets to a filesudo tcpdump -i eth0 -w capture.pcap port 21 # capture only FTPLook for capture files already on the box, too: *.pcap, *.pcapng, *.cap.
Wireshark filters
Display filters that find credentials:
http.request.method == "POST" # form submissionshttp contains "passw" # HTTP packets with the stringframe contains "passw" # any packet with the string, any protocolhttp.authorization # HTTP Basic or NTLM headersftp.request.command == "PASS" # FTP passwordssnmp # SNMP, community string in each packetntlmssp # NTLM authentication in any protocolFilters that narrow a capture:
ip.addr == 10.10.10.5 # traffic to or from one hostip.src == 10.10.10.5 && ip.dst == 10.10.10.9 # one direction between two hoststcp.port == 80 # one porttcp.stream eq 53 # one TCP conversationRight-click a packet and pick Follow > TCP Stream to read the whole conversation as text. Edit > Find Packet searches for a string without a filter.
Pull everything with Pcredz
Pcredz parses a capture and prints every credential it recognizes: HTTP Basic and form fields,
FTP, POP3, IMAP, SMTP, LDAP simple bind, SNMP community strings, MSSQL, NTLMv1 and NTLMv2 hashes,
Kerberos AS-REQ hashes, and credit card numbers.
./Pcredz -f capture.pcapng -t -v # -f parse a file, -t print timestamps, -v show duplicates too./Pcredz -d ./pcaps/ # -d parse every capture in a directorysudo ./Pcredz -i eth0 # -i capture live from an interface./Pcredz -f capture.pcapng -c # -c skip credit card scanningPcredz writes each credential type to its own file under logs/. Crack the NTLMv2 hashes with
hashcat mode 5600 in Cracking, or test the cleartext logins with
Spraying and Defaults.