Why can't I filter http in Wireshark? - http

I am new to networking and Wireshark in general, but there's one thing I'm really stuck on.
I opened Wireshark, started sniffing, then I went to different websites both using HTTP and HTTPS.
I stopped the sniffing and tried to filter out "http" and "https" (different tries), but it shows nothing.
In the Protocol column I see only TCP, UPD, DNS, TLSv1 etc. But no HTTP and not HTTPS.
What may cause this?
Thanks

Wireshark cannot see application data because it is encrypted with TLS. That's why Wireshark use TLS and TLS version in protocol column instead of HTTPS.
Almost all big website are using HTTPS todays. When you try to use HTTP the connection will be redirected to HTTPS. There are different redirection methods and it is possible the Wireshark cannot get enough data to know the communication is HTTP or not. That's why you can see TCP in protocol column instead of HTTP.
So You can filter packets with TCP ports:
tcp.port == 80 or tcp.port==443

You can filter the HTTP traffic with the help of Wireshark easily.
Refer : How many http and https connections established in wireshark?
Even you can get the additional information , like source IP, destination IP, flags etc from hex format. Refer Link,
How to obtain the source IP from a Wireshark dump of an HTTP GET request

Related

How does Wireshark decrypt packets while connecting to wifi?

I'm learning about sniffing packets in Wireshark. When I enter the password of my wifi and I can start seeing a lot of traffics and I realize that they are all decrypted. But I don't know how these packets are decrypted because different clients have different PTKs and counter mode in ccmp.
For example, I perform a simple MITM between my phone and the router. I think that the HTTP packet that sending from my phone must be encrypted with its AES-CCMP(PTK) at the data link layer but somehow I can capture password from a simple HTTP authorization page through GET request. So how can Wireshark do that?
Sorry for late answer.
HTTP protocol by itself does not support encryption, this means content of the packet can be seen in plain text. For example, webpage http://icanhazip.com uses HTTP protocol, so if you run Wireshark and head over to this website, you can see IP responded by the webpage in the wireshark's "follow TCP stream" window. I run this scenario and posted its picture.
Not all of the pages are on HTTP, and the majority of the websites, nowadays, use HTTPS. HTTPS is HTTP which send its packets with TLS protocol. TLS is responsible for encrypting and sending the HTTP packet. So if you sniff traffic of a website that uses HTTPS, you can't see the content of the request and response. For example, run Wireshark and go to https://icanhazip.com. Here is a picture of it.
In your case, because web page you are visiting (I think you are visiting this page)
uses HTTP and not HTTPS, the content of the packets can be seen in the Wireshark, even vital things like authorization information.

Faking an HTTP request header

I have a general networking question but it's related with security aspect.
Here is my case: I have a host which is infected by a malware. The malware creates an http packet to communicate with it's command and control server. While constructing the packet, the IP layer contains the correct IP address of the command and control server. The tcp layer contains the correct port number 80.
Before sending the packet out, the malware modifies the http header to replace the host header with “google.com" instead of it's server address. It then attaches the stolen data with the packet and sends it out.
My understanding is that the packet will get delivered to the correct server because the routing will happen based on the IP.
But can I host a webserver on this IP that would receive all packets with header host google.com and parse it correctly?
Based on my reading on the internet, it is possible but if it is that easy then why have malware authors not adopted this technique to spoof the http headers and bypass traditional domain whitelisting engines.
When you make a request to let's say Apache2 server, what actually Apache does is match your "Host" header with any VirtualHost within server's configuration. Only if it cannot be found / is invalid, Apache will route the request to default virtualhost if it's defined. Basically nothing stops you from changing these headers.
You can simply test it by editing your hosts file and pointing google.com to any other IP - you will be able to handle the google.com domain on your server, but only you will be to use it this way - no one else.
Anything you send inside HTTP headers shouldn't be trusted - it just a guide for your server on how to actually handle the traffic.
The fake host header is just there to trick some deep-inspection firewalls ("it's for Google? you may pass..."). The server on that IP either doesn't care about the host header (default vhost) or is explicitly configured to accept it.
Passing the loot on by using fake headers or just as plain data behind the headers is another trick to fool data loss prevention.
These methods can mislead shallow application-layer inspection but won't pass a decent firewall.

Can I send carbon/graphite data to a url on port 80?

I work in an environment where ports are closed and difficult to get open.
I was thinking of sending my graphite data to localhost/graphitein rather than port 2003 and have nginx do the mapping.
Is there any reason not to do this?
According to the Wikipedia (bold is mine):
Nginx [...] can also act as a reverse proxy server for HTTP, HTTPS,
SMTP, POP3, and IMAP protocols, as well as a load balancer and an
HTTP cache.
I don't think you can use Nginx as a reverse proxy for the Graphite protocol.
Perhaps you can use an SSH Tunnel?
This tool could be a solution https://github.com/obfuscurity/backstop "Backstop is a simple endpoint for submitting metrics to Graphite. It accepts JSON data via HTTP POST and proxies the data to one or more Carbon/Graphite listeners."

Why Wireshark display filter does not show http packets?

When I use display filter for HTTP it shows only HTTP packets when HTTP message is on standard port i.e. on port 80. But, when message is not using standard port, then display filter not works for HTTP and I need to filter for TCP and then need to find out HTTP packets manually.
I want to know why this happen? Is it standard behavior or I am doing (or expecting) it wrongly.
Thanks.
I had to enable the HTTP protocol by doing the following:
"Analyze -> Enabled Protocols"
This solution was for version 1.12.2 (and disabled by default in
version 2.0.2) but should work for any variant of version 1 and 2.
If you have HTTP not on its usual port, you can use the "Analyze -> Decode As" tool in Wireshark to tell it to treat all traffic on this port as a certain protocol.
The well-known port for HTTP is port 80. If you're looking at traffic on a different port Wireshark would normally expect traffic to be in the form for whatever service normally uses that port (if any). It has no way to know that traffic on, say, port 1080 is actually HTTP. This is not a bug, but a limitation of the way you are trying to use TCP
I am using version 1.10.2 and it will classify any port as HTTP as long as it sees HTTP data in it.

What is the difference between HTTP and HTTPS headers?

Can you please explain the different between http header and https header. I need very brief explanation. What will we do using http/https header?.
Thanks
After the SSL negotiation, normal HTTP headers will travel inside the encrypted stream, so there is really no difference between the two.
http, https, ftp, etc are there to tell the server which protocol is being used, so it knows where to direct the request.
http is unencrypted, usually on port 80. https is encrypted with ssl, usually on port 443.

Resources