A user agent is a computer program representing a person, for example, a browser in a Web context.
Besides a browser, a user agent could be a bot scraping webpages, a download manager, or another app accessing the Web. Along with each request they make to the server, browsers include a self-identifying User-Agent HTTP header called a user agent (UA) string. This string often identifies the browser, its version number, and its host operating system.
Spam bots, download managers, and some browsers often send a fake UA string to announce themselves as a different client. This is known as user agent spoofing.
A typical user agent string looks like this: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0".
When a host is infected or otherwise compromised, security professionals need to quickly review packet captures (caps) of suspicious network traffic to identify affected hosts and users. This tutorial offers tips on how to gather that cap data using Wireshark, the widely used network protocol analysis tool.
In most cases, alerts for suspicious activity are based on IP addresses. If you have access to full packet capture of your network traffic, a cap retrieved on an internal IP address should reveal an associated MAC address and hostname.
DHCP traffic can help identify hosts for almost any type of computer connected to your network. Open the cap in Wireshark and filter on boot pas shown in Figure 1.
Note : With Wireshark 3.0, you must use the search term DHCP instead of boot. Select one of the frames that shows DHCP Request in the info column.
Go to the frame details section and expand the line for Bootstrap Protocol (Request) as shown in Figure 2. Expand the lines for Client Identifier and Host Name as indicated in Figure 3.
Figure 7: Following the TCP stream for an HTTP request in the third cap This TCP stream has HTTP request headers as shown in Figure 8.
Figure 11: Following the TCP stream for an HTTP request in the fifth cap Since more websites are using HTTPS, this method of host identification can be difficult.
However, for those lucky enough to find HTTP web-browsing traffic during their investigation, this method can provide more information about a host. For Windows hosts in an Active Directory (AD) environment, we can find user account names in from Kerberos traffic.
This cap is from a Windows host in the following AD environment: Go to the frame details section and expand lines as shown in Figure 13.
You should find a user account name for Theresa.Johnson in traffic between the domain controller at 172.16.8[. Hamstring values for hostnames always end with a $ (dollar sign), while user account names do not.
To filter on user account names, use the following Wireshark expression to eliminate Hamstring results with a dollar sign: Using the methods from this tutorial, we can better utilize Wireshark to help us identify affected hosts and users.
Most of the computer security white papers in the Reading Room have been written by students seeking GMAC certification to fulfill part of their certification requirements and are provided by SANS as a resource to benefit the security community at large. SANS attempts to ensure the accuracy of information, but papers are published “as is”.
Errors or inconsistencies may exist or may be introduced over time as material becomes dated. Making statements based on opinion; back them up with references or personal experience.
Note: If this program is run against a cap file that is open in a hex editor in read/write mode then it will fail to open the file for reading. This view highlights several of the errors I encountered while making this tool.
Using the offset of “0×3E4B59” given in my search tool we can jump to that point in the hex editor and see what was going on there. From this we see that there appears to be some garbage mixed in with the useragentstring, which caused my program to calculate the wrong length, so I just output those frames in hex for further investigation.
The answer, after pouring over the file format spec was to use the timestamp. First we find an interesting UA string we want to investigate, so we use the UA tool to find the offset and jump to it in a hex editor.
So we jump to that location and search “Up” for the 2 bytes “0×54 0×56 that will help us find the timestamp, “BF8C545617920A00”. Update: as December rolled around the bytes to search for changed to 0×60 0×54.
Now I build another tool to convert the timestamp from hex to decimal Epoch time. Next we go to Wireshark Edit –> Find Packet (CTV + F) –> In the popup box set the radio buttons to String and “Packet Details” and insert the decimal Epoch string into the search box.
Depending on where you are in the capture file you may need to change the search direction up or down. We just take the Epoch time stamp from Wireshark run it through our handy dandy time converter and get the hex bytes out to search for them in the hex editor.
This solution still gave me a random user agent however there is the possibility that the data structure at the endpoint could change. You need to create a header with a proper formatted UseragentString, it server to communicate client-server.
Detect mobile browsers without user agent string parsing: Client Hints | by omrilotan | Fiverr Engineering | Medium The Client Hints proposal is already available in Google Chrome and makes for a very cost-effective way to detect (among other things) mobile devices.
Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface.