Skip to main content

Wireshark cheat sheet for malware analysis, CTF and so on

http.request or dns or tls.handshake.type= =1 

From the above filter result, we can select host and server name and apply as column. or we can do the following. 

Making custom column for malware analysis:

edit menu > preference > appearance > columns > +

Title: Host    Type: Custom    Fields: http.host

Title: Server Name    Type: Custom    Fields: tls.handshake.extensions_server_name


Changing time display:

View>Time Display Format>UTC Date and Time of Day (1970-01-01 01:02:03.123456) Ctrl+Alt+7

then View>Time Display Format>Seconds


Customize filter: As per brad duncan paloalto unit 42 lession

Type this filter keyword:

(http.request or tls.handshake.type eq1) and !(ssdp) in the display filter then save it by clicking the right most + sign. Then give a simple label name as basic. 

or old wireshark packet, you need to use ssl instead of tls.

(http.request or ssl.handshake.type eq1) and !(ssdp) in the display filter then save it by clicking the right most + sign. Then give a simple label name as basic.  

(http.request or tls.handshake.type eq1 or tcp.flags eq 0x0002) and !(ssdp) in the display filter then save it by clicking the right most + sign. Then give a simple label name as basic+. 

(http.request or tls.handshake.type eq1 or tcp.flags eq 0x0002 or dns) and !(ssdp) in the display filter then save it by clicking the right most + sign. Then give a simple label name as basic+dns.


For Adding host or server name column:

Go to column preference. Add the column. Give it a name as host. Then from the drop down select custom. Then type the below keyword:

http.host or tls.handshake.extensions_server_name

or

http.host or ssl.handshake.extensions_server_name


Adding TLS Pre-Master secret key:

Edit>Preferences>Protocol>TLS


ICMP data tunneling:

Statistics>Protocol Hierarchy   (observer percent packet column)

Check file menu>export objects > http to see, any icmpsh.exe tool is downloaded or not. 

During data exfiltration via icmp, the data size will be higher than the usual. so apply filter as,

icmp and data.len>60

frame contains "gmail.com"

strings icmp_tunneling.pcapng | grep -i gmail

strings -n 8 icmp_tunneling.pcapng | grep -i gmail


Detecting port scan, brute force and flooding attack using wireshark:

capinfo capture.pcapng (giving some important info about the pcap)

Brute force:

ftp (type ftp in display filter in order to detect ftp brute force)

Search for packets where info column is written as Login Successful

frame contains "incorrect"

frame contains "successful"

strings -n 8 filtered.pcapng | grep -i "successful"

So we come to an conclusion that, 192.168.6.2 our ftp server and malicious user from source ip 10.99.99.99 tried to ftp brute force. 

Port scan detection:

Nmap is a most popular tool for enumerating ip and port numbers along with other informations. The main characteristics of nmap is, attacker will start scanning the target network or server to see how many ports are open in the remote server. 

If you see in any packet that majority of the traffic are coming from different public ip to port 80 on the web server of 192.168.6.2 then this is not nmap behavior. Also this server 192.168.6.2 will give reply as source to those http request. Also previously we found that 10.99.99.99 was the brute force attacker ip. so we can filter out all of this. Then we can catch the nmap port scanner culprit.

! ip.addr = = 10.99.99.99 && ! tcp.port = = 80 && ! ip.src = = 192.168.6.2


Flooding detection:

The motive of flooding attack is make the server unresponsive. How you can make sure some flooding or ddos attack is happening in your network? Destination will be same and source will be multiple. They randomize source ip using a tool hping3. We can filter out our last two attackers ip address and we know our web server is at 192.168.6.2 so we can filter this ip as source as well because this ip will reply in response with those web request at port 80. We dont need to see those reply packet as source. We can not filter tcp.port = = 80 because the hit is coming at 80 port. If we filter that then we can not detect the actual one.

! ip.addr = = 10.99.99.99 && ! ip.addr = = 10.66.66.66 && ! ip.src = = 192.168.6.2

 

Finding username and password in http POST request:

When you need to find password in http 80 plain text protocol, then http POST method would help in wireshark packet capture. 

http.request.method = = POST && frame contains "Mozellobel-EiZ"

or 

http.request.method = = POST && http.file_data contains "Mozellobel-EiZ"

You should see some packets that contains password for Mozellobel-EiZ user. Now question is in which packet should i look for? Always look for last packet. 

We can also find password by leveraging strings and grep command. 

strings -n 9 capture3.pacpng | grep -i mozellobel-eiz

Check the last entry. 


In order to find hostname or computer name and username in wireshark:

filter with, kerberos.CNameString keyword. Then choose any packet>expand Kerberos>expand tgs-rep> expand cname>expand cname-string>right click on CNameString and select apply as column. 

NBNS and dhcp protocol filter will help sometimes when DC is not involved.

 

ssh private key finding:

filter with: frame contains "private" or "RSA"    filter with tcp protocol and see last packets as well.

take the key and save in a file say id. in this id file we saved the private key and we need to provide it id file during ssh connect using -i switch. 

ssh -i id username@servername


If told attacker or somebody search for some files in the web:

Then filter with http packets and GET request. http.request.method eq GET

Also keep an eye on the file name. Filter with that as well like frame contains "file name"


During extraction of files:

MZ --> for exe

ELF --> for Bin


For persistency establishment:

search with cron jobs in packet. 


QuickBot smtp packet:

(http.request or tls.handshake.type eq 1 or (tcp.port eq 65400 and tcp.flags eq 0x0002) or smtp or pop or imap) and !(ssdp) 


Finding the SYN packets with https requests:

tcp.flags == 0x0002 || tcp.flags == 0x00c2 || http.request || ssl.handshake.type == 1


Sometimes we need to examine wireshark in unintended way. Meaning use grep to find out the flag or export files or use binwalk -e pcapng or foremost command. Then examine the output files to get the flag. 



Avi






 

 



Comments

Popular posts from this blog

Install Nessus from docker

Docker installation. Give the below commands one by one. apt install docker-cli or apt install docker.io After the installation is complete, if you are inside wsl then give this command to start docker, because inside wsl systemd (systemctl) does not work: service docker start WSL troubleshooting : If the above command " service docker start " does not work then use below command: dockerd (It may not work if any previous docker process is running. It will show you pid of that process. Use this command to kill that process " kill -9 pid " and run dockerd command again) If " docker ps -a " giving error like " Cannot connect to the Docker daemon at unix:///run/podman/podman.sock. Is the docker daemon running? " This is because you may installed podman-docker package. If you remove the package still you will get this error but you should remove the package. Then issue this command: env | grep -i docker DOCKER_HOST=unix:///run/podman/podman.sock   --...

Installtion of SQLMutant tool

This tool is perfectly works on ubuntu 24 system. And I found it is not working properly in kali linux 24 version.   https://github.com/blackhatethicalhacking/SQLMutant/tree/main This tool need to use along with sqlmap tool. Showing this cheat sheet for kali or debian based system.  This tool actually analyze everything and give you the vulnerable url where sql injection is possible. You just need to use then sqlmap to exploit that.   Prerequisite: apt install pipx -y (for ubuntu) pip3 install uro or pipx install uro pipx ensurepath pipx completions  (not needed)  source ~/.bashrc   or restart system If go tool is not installed then run the below two commands first ( golang-go ) or follow this link to install go (https://mahimfiroj.blogspot.com/2024/12/installing-nuclei-in-kali.html) otherwise skip this step.   dpkg -l | grep packagename (Using this command you can check package is installed or not) apt install gccgo-go -y or apt install gol...

Installing nuclei and go tool in kali

 First you need to install go: https://go.dev/doc/install You need to download this go tool go1.23.4.linux-amd64.tar.gz by clicking the Download button.  Say you are root and download the tool in your Downloads directory. Now run the below command: tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz (if this cmd fails then you need to move this tool to /usr/local folder then run this cmd tar -xzf  go1.23.4.linux-amd64.tar.gz) Now add /usr/local/go/bin to the PATH environment variable. You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation): export PATH=$PATH:/usr/local/go/bin Now use the following command for immediate effect. Preventing you from log off then log back in: source $HOME/.profile go version (to check it is installed successfully) Install nuclei: go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest or apt install nuclei nuclei -update-templates nuclei -u https://www.domain....