Skip to content

Commit 6e2ce60

Browse files
authored
Merge pull request #2199 from HackTricks-wiki/research_update_src_generic-methodologies-and-resources_basic-forensic-methodology_pcap-inspection_wireshark-tricks_20260503_132348
Research Update Enhanced src/generic-methodologies-and-resou...
2 parents 83dac3e + 07f62d6 commit 6e2ce60

1 file changed

Lines changed: 49 additions & 9 deletions

File tree

  • src/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection

src/generic-methodologies-and-resources/basic-forensic-methodology/pcap-inspection/wireshark-tricks.md

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,30 @@ Under _**Statistics --> I/O Graph**_ you can find a **graph of the communication
6060
### Filters
6161

6262
Here you can find wireshark filter depending on the protocol: [https://www.wireshark.org/docs/dfref/](https://www.wireshark.org/docs/dfref/)\
63+
In current Wireshark use `tls.*` instead of the old `ssl.*` filter names.\
6364
Other interesting filters:
6465

65-
- `(http.request or ssl.handshake.type == 1) and !(udp.port eq 1900)`
66+
- `(http.request or tls.handshake.type == 1) and !(udp.port eq 1900)`
6667
- HTTP and initial HTTPS traffic
67-
- `(http.request or ssl.handshake.type == 1 or tcp.flags eq 0x0002) and !(udp.port eq 1900)`
68+
- `(http.request or tls.handshake.type == 1 or tcp.flags eq 0x0002) and !(udp.port eq 1900)`
6869
- HTTP and initial HTTPS traffic + TCP SYN
69-
- `(http.request or ssl.handshake.type == 1 or tcp.flags eq 0x0002 or dns) and !(udp.port eq 1900)`
70+
- `(http.request or tls.handshake.type == 1 or tcp.flags eq 0x0002 or dns) and !(udp.port eq 1900)`
7071
- HTTP and initial HTTPS traffic + TCP SYN + DNS requests
72+
- `tls.handshake.extensions_server_name contains "example.com"`
73+
- Pivot on the SNI sent in the ClientHello even when you cannot decrypt the payload
74+
- `tls.handshake.extensions_alpn_str == "h2" or tls.handshake.extensions_alpn_str == "h3"`
75+
- Split classic HTTPS, HTTP/2 and HTTP/3 capable sessions quickly
76+
- `quic or http3`
77+
- Find modern UDP/443 traffic that will be missed if you only review TCP conversations
7178

7279
### Search
7380

7481
If you want to **search** for **content** inside the **packets** of the sessions press _CTRL+f_. You can add new layers to the main information bar (No., Time, Source, etc.) by pressing the right button and then the edit column.
7582

83+
### Following multiplexed streams
84+
85+
Recent Wireshark versions can follow `TLS`, `HTTP/2` and `QUIC` streams directly. On noisy captures this is usually faster than only using `Follow TCP Stream`, especially when several requests share the same connection.
86+
7687
### Free pcap labs
7788

7889
**Practice with the free challenges of:** [**https://www.malware-traffic-analysis.net/**](https://www.malware-traffic-analysis.net)
@@ -83,10 +94,27 @@ You can add a column that shows the Host HTTP header:
8394

8495
![](<../../../images/image (639).png>)
8596

86-
And a column that add the Server name from an initiating HTTPS connection (**ssl.handshake.type == 1**):
97+
And a column that add the Server name from an initiating HTTPS connection (**tls.handshake.type == 1**):
8798

8899
![](<../../../images/image (408) (1).png>)
89100

101+
If the capture is mostly encrypted, adding these fields as columns will speed up triage a lot:
102+
103+
- `tls.handshake.extensions_server_name`
104+
- `tls.handshake.extensions_alpn_str`
105+
- `tls.handshake.ja3`
106+
- `tls.handshake.ja4` (Wireshark 4.2+)
107+
108+
This lets you cluster sessions by hostname, ALPN (`http/1.1`, `h2`, `h3`, etc.) and client fingerprint even when the payload itself stays encrypted. For decrypted HTTP/2 and HTTP/3 captures, it is also useful to add `http2.header.value` or `http3.headers.header.value` as columns and pivot on paths, authorities and other interesting metadata.
109+
110+
```bash
111+
tshark -r capture.pcapng -Y "tls.handshake.type == 1" -T fields \
112+
-e frame.number -e ip.src -e ip.dst \
113+
-e tls.handshake.extensions_server_name \
114+
-e tls.handshake.extensions_alpn_str \
115+
-e tls.handshake.ja3 -e tls.handshake.ja4
116+
```
117+
90118
## Identifying local hostnames
91119

92120
### From DHCP
@@ -103,23 +131,31 @@ In current Wireshark instead of `bootp` you need to search for `DHCP`
103131

104132
### Decrypting https traffic with server private key
105133

106-
_edit>preference>protocol>ssl>_
134+
_edit > preferences > protocols > tls >_
107135

108136
![](<../../../images/image (1103).png>)
109137

110138
Press _Edit_ and add all the data of the server and the private key (_IP, Port, Protocol, Key file and password_)
111139

140+
This method only works in a limited number of cases. For current TLS 1.3 / ECDHE traffic, the session key log method below is usually the practical option.
141+
112142
### Decrypting https traffic with symmetric session keys
113143

114-
Both Firefox and Chrome have the capability to log TLS session keys, which can be used with Wireshark to decrypt TLS traffic. This allows for in-depth analysis of secure communications. More details on how to perform this decryption can be found in a guide at [Red Flag Security](https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/).
144+
Both Firefox and Chrome have the capability to log TLS session keys, which can be used with Wireshark to decrypt TLS traffic. This allows for in-depth analysis of secure communications. More details on how to perform this decryption can be found in a guide at [Red Flag Security](https://redflagsecurity.net/2019/03/10/decrypting-tls-wireshark/). This is also the normal route for decrypting modern TLS 1.3 and QUIC/HTTP/3 captures.
115145

116-
To detect this search inside the environment for to variable `SSLKEYLOGFILE`
146+
To detect this search inside the environment for the variable `SSLKEYLOGFILE`
117147

118148
A file of shared keys will look like this:
119149

120150
![](<../../../images/image (820).png>)
121151

122-
To import this in wireshark go to \_edit > preference > protocol > ssl > and import it in (Pre)-Master-Secret log filename:
152+
If the capture is `pcapng`, check whether it already contains embedded decryption secrets before hunting the host filesystem:
153+
154+
```bash
155+
editcap --extract-secrets capture.pcapng tls-secrets.txt
156+
```
157+
158+
To import this in wireshark go to \_edit > preferences > protocols > tls > and import it in (Pre)-Master-Secret log filename:
123159

124160
![](<../../../images/image (989).png>)
125161

@@ -154,7 +190,11 @@ f.write(all_bytes)
154190
f.close()
155191
```
156192

157-
{{#include ../../../banners/hacktricks-training.md}}
193+
## References
194+
195+
- [Wireshark TLS wiki](https://wiki.wireshark.org/TLS)
196+
- [Decrypting and parsing HTTP/3 traffic in Wireshark](https://blog.elmo.sg/posts/parsing-decrypted-quic-traffic-in-wireshark/)
158197

198+
{{#include ../../../banners/hacktricks-training.md}}
159199

160200

0 commit comments

Comments
 (0)