Latest / CyberCode Academy / Course 6 - Network Traffic Analysis for Incident Response | Episode 2: Wireshark Features and Comprehensive Protocol Dissection
Transcript
- 0:00Speaker 1: Today we are undertaking a deep dive that requires us
- 0:03Speaker 1: to look beneath the surface, way way beneath.
- 0:06Speaker 2: Yeah, we're moving past the abstract models.
- 0:08Speaker 1: We're moving beyond those concepts and putting on our analyst
- 0:11Speaker 1: hats to see the literal, raw data moving across the wire.
- 0:15Speaker 1: This is really where the rubber meets the road.
- 0:16Speaker 2: It is peeling back those layers of communication to find
- 0:19Speaker 2: the truth that's hiding in the packets.
- 0:21Speaker 1: Exactly, and in cybersecurity, if you don't know what a
- 0:24Speaker 1: protocol is supposed to look like, how can you ever
- 0:27Speaker 1: spot an anomaly? You can't.
- 0:29Speaker 2: It's the fundamental first step. And for that, our tool
- 0:32Speaker 2: of choice, the indispensable champion of network traffic analysis is
- 0:36Speaker 2: wire Shark.
- 0:37Speaker 1: Some of you might remember it as ethereal from years back.
- 0:40Speaker 2: That's right, but it remains the de facto standard, and importantly,
- 0:44Speaker 2: it's freely available, which is a huge plus.
- 0:47Speaker 1: It's incredibly powerful too. It doesn't just watch traffic in
- 0:50Speaker 1: real time, it's also the perfect instrument for dissecting captured
- 0:54Speaker 1: data files that those dot or dot pecat files.
- 0:57Speaker 2: So our mission for you today is to turn that
- 1:00Speaker 2: textbook knowledge of IP and TCP into immediate hands on insight.
- 1:05Speaker 1: So you can recognize malicious behavior almost instantly. Okay, let's
- 1:10Speaker 1: start with the toolkit itself. Wire Shark's biggest selling point,
- 1:14Speaker 1: especially for beginners.
- 1:15Speaker 2: It's the GUI. It's GUI base that makes the learning
- 1:18Speaker 2: curve so much more intuitive. You can click around, see
- 1:21Speaker 2: the breakdown, and really master the basics pretty quickly.
- 1:25Speaker 1: But the real power for let's say a seasoned analyst
- 1:29Speaker 1: comes when you move past just pointing and clicking. There's
- 1:33Speaker 1: a command line alternative T.
- 1:34Speaker 2: Shark terminal shark.
- 1:35Speaker 1: Yeah, why would a power user ever choose a command
- 1:38Speaker 1: line over a nice visual interface?
- 1:41Speaker 2: Scale? The network environment is just often too huge for
- 1:45Speaker 2: a manual review. T shark. Lets use script your analysis,
- 1:48Speaker 2: and you pipe the results into other programs.
- 1:51Speaker 1: So you could, for example, write a script to pull
- 1:53Speaker 1: all the HTTP user agents out of say fifty gigs
- 1:56Speaker 1: of traffic.
- 1:57Speaker 2: Exactly from a perimeter of firewall capture, send the list
- 2:00Speaker 2: to a file, and then compare it against known malicious indicators.
- 2:03Speaker 2: You just can't do that by hand. That scale requires automation.
- 2:06Speaker 1: Okay, So let's say you open a capture You're immediately
- 2:09Speaker 1: met with three distinct pains. What's the story they're telling.
- 2:12Speaker 2: The first one at the top is the packet list.
- 2:14Speaker 2: It shows every single packet and it's color coded.
- 2:17Speaker 1: An analyst learned to look for those colors.
- 2:19Speaker 2: Oh, absolutely, red for instance, often flags serious issues, things
- 2:24Speaker 2: like spurious retransmissions or duplicate ACKs. It signals a congested
- 2:30Speaker 2: or maybe even a manipulated connection.
- 2:32Speaker 1: Okay. Then below that is the dissection pain.
- 2:35Speaker 2: Which is basically your inverted OSI model. It's the protocol
- 2:38Speaker 2: stack view showing the data broken down from the lowest
- 2:41Speaker 2: layer frame ETHERNET, IP, TCP all the way up to
- 2:45Speaker 2: the application. And the third pain that's the HEXANNASKI pain
- 2:48Speaker 2: the raw bytes. And here's the really elegant feature. It's
- 2:52Speaker 2: dynamically linked.
- 2:53Speaker 1: What does that mean?
- 2:53Speaker 2: If you click on, say, the time to live field
- 2:56Speaker 2: in the dissection pain, the exact two bytes that represent
- 2:59Speaker 2: it are instantly highlighted in the hex pain below.
- 3:02Speaker 1: Ah. So that's how you connect the protocol theory directly
- 3:05Speaker 1: to the raw data on the wire.
- 3:06Speaker 2: That's it. Now, to manage these massive capture files, filtering
- 3:10Speaker 2: is everything.
- 3:11Speaker 1: You have to isolate what you're looking for fast, right.
- 3:15Speaker 2: So you use display filters like TCP DOT source port
- 3:18Speaker 2: equals eighty to start narrowing down potentially millions of packets
- 3:23Speaker 2: to just the ones you care about.
- 3:25Speaker 1: And once you find those needles in the haystack, maybe
- 3:28Speaker 1: twenty or thirty packets that show an intrusion, you don't
- 3:31Speaker 1: send the whole giant file to your team.
- 3:33Speaker 2: No, of course not. You mark those specific packets they'll
- 3:36Speaker 2: appear white on black. Then you just use the export
- 3:39Speaker 2: function to create a new file with only the evidence.
- 3:41Speaker 1: Which is critical for chain of custody and just effective reporting.
- 3:45Speaker 2: And speaking of files, you can also merge two different
- 3:48Speaker 2: dot p cap files. This is great if you're correlating
- 3:51Speaker 2: events from two different network locations.
- 3:54Speaker 1: But I imagine you have to be careful with the timestamps.
- 3:56Speaker 2: You have to be. If you don't synchronize them, your
- 3:59Speaker 2: entire chronological analysis is worthless.
- 4:01Speaker 1: Okay, let's talk about the capture itself. There's a difference
- 4:03Speaker 1: between standard capture and something called promiscuous mode.
- 4:07Speaker 2: Yeah, a big one. Standard capture only records traffic going
- 4:10Speaker 2: to or from your local machine, but in an organizational setting,
- 4:14Speaker 2: analysts usually enable promiscuous mode, which tells.
- 4:17Speaker 1: The network card to just grab any trafficant seas on
- 4:20Speaker 1: the wire regardless of who.
- 4:21Speaker 2: It's for exactly.
- 4:23Speaker 1: But I've heard that if you're analyzing a specific malware sample,
- 4:26Speaker 1: you should actually turn promiscuous mode off. Why is that?
- 4:29Speaker 2: Because you want total isolation. If you're watching a piece
- 4:32Speaker 2: of malware, you only want to see the traffic it generates.
- 4:35Speaker 2: With promiscuous mode on, you capture all the other network nors,
- 4:39Speaker 2: vyp calls, printer requests, and that clutter can easily hide
- 4:44Speaker 2: the malaur signals.
- 4:45Speaker 1: Got it. Now, let's talk about what sounds like an
- 4:48Speaker 1: analyst's life raft following streams.
- 4:50Speaker 2: Yeah, it really is.
- 4:51Speaker 1: Why do I even need a special feature for that?
- 4:53Speaker 1: If I make a web request, shouldn't the response packets
- 4:56Speaker 1: be right next to it in the list?
- 4:57Speaker 2: You'd think so, but no, networking is fundamentally concurrent. Your
- 5:01Speaker 2: conversation with a web server is constantly getting mixed in
- 5:04Speaker 2: with dozens of other conversations.
- 5:06Speaker 1: So my request packet might be followed by someone else's
- 5:09Speaker 1: DNS query and then a princher update, and then my
- 5:12Speaker 1: response comes.
- 5:12Speaker 2: Back precisely, it's a jumbled mess.
- 5:16Speaker 1: So follow stream is the magic button that tells wireshark
- 5:19Speaker 1: to untangle all of that for you.
- 5:21Speaker 2: It does all the heavy lifting. It reassembles that chaotic
- 5:24Speaker 2: traffic into a clean linear conversation, showing you the entire
- 5:29Speaker 2: request and response flow separate from all the noise. It's
- 5:32Speaker 2: an enormous timesaver.
- 5:34Speaker 1: All right, let's pivot from the tool to the protocols themselves,
- 5:37Speaker 1: the foundation starting with IP, the Internet protocol. Its job
- 5:41Speaker 1: is just routing, right.
- 5:42Speaker 2: That's its sole focus, getting the packet to the right machine.
- 5:46Speaker 2: And if you look at the IPv four header, which
- 5:49Speaker 2: is only twenty bytes long, you see the essentials like.
- 5:52Speaker 1: The time to live or TTL.
- 5:53Speaker 2: Right, which is basically a hop counter to prevent network loops.
- 5:56Speaker 2: But here's a little nugget for analysts. The starting TTL
- 6:00Speaker 2: value is a classic way to fingerprint and os really
- 6:03Speaker 2: how so well, Linux and Unix systems often start with
- 6:06Speaker 2: a TTL of sixty four. Windows systems usually start at
- 6:09Speaker 2: one twenty eight. So if you see a packet with
- 6:11Speaker 2: the TTL of say one point fifteen, you can infer
- 6:13Speaker 2: it came from a Windows box and has made thirteen hops.
- 6:16Speaker 1: That's a high impact piece of information from just one field.
- 6:18Speaker 2: Absolutely. And then you have the protocol field like six
- 6:21Speaker 2: for TCP, which tells the machine what's wrapped inside IPG
- 6:24Speaker 2: six is similar, just with much longer addresses.
- 6:28Speaker 1: Which uses that double colon to compress all the zeros.
- 6:31Speaker 2: And for the transition we had to rely on tunneling
- 6:33Speaker 2: protocols for a while, Like six to four they'd wrap
- 6:35Speaker 2: an IPv six packet inside an IPv four header to
- 6:38Speaker 2: get it across older networks. A dead giveaway is the
- 6:41Speaker 2: any cast address one ninety two point eight eight point
- 6:45Speaker 2: nine to one point one. If you see that, you're
- 6:47Speaker 2: looking at six to four traffic.
- 6:49Speaker 1: Okay, so IP gets the packet to the right computer.
- 6:51Speaker 1: Now we need reliability. That's TCP's job.
- 6:54Speaker 2: Correct Transmission Control Protocol handles reliability, ordering and error correction
- 6:59Speaker 2: after the packet right. It uses ports like mailboxes port
- 7:02Speaker 2: eighty four forty three to direct traffic to the right application,
- 7:05Speaker 2: and it.
- 7:06Speaker 1: Starts with the famous three way handshake. Sym s yn ack.
- 7:10Speaker 2: The formal introduction. But from a security standpoint, the really
- 7:14Speaker 2: crucial parts are the sequence and acknowledgment numbers. They look
- 7:17Speaker 2: like just confusing.
- 7:18Speaker 1: Math they do, what's their real significance?
- 7:19Speaker 2: They are the absolute guarantee of order. The acknowledgement number
- 7:22Speaker 2: is basically the last sequence number plus the amount of
- 7:25Speaker 2: data sent. Analysts care because if an attacker can predict
- 7:28Speaker 2: those sequence numbers, they can hijack the session.
- 7:30Speaker 1: And inject their own malicious packets into what looks like
- 7:33Speaker 1: a legitimate conversation.
- 7:35Speaker 2: Exactly, it's a classic man in the middle attack factor.
- 7:38Speaker 1: And what about ending a session. There's a proper way
- 7:40Speaker 1: and an abrupt way.
- 7:42Speaker 2: The proper way is a graceful close with the funny
- 7:44Speaker 2: ack handshake. The abrupt way is a reset packet. And
- 7:48Speaker 2: if you suddenly see a whole flurry of reset packets
- 7:51Speaker 2: in your capture, that's an immediate indicator of a port span.
- 7:54Speaker 1: An attacker testing the waters and quickly closing the connections. Okay,
- 7:58Speaker 1: so if TCP is all about guaranteed delivery, what happens
- 8:01Speaker 1: when you just want speed?
- 8:03Speaker 2: Then you use UDP, the User Data.
- 8:05Speaker 1: Gram Protocol, the speed demon.
- 8:06Speaker 2: It's the bare minimum, a tiny header with just ports
- 8:10Speaker 2: length and a checksum. It completely skips the handshake and acknowledgments.
- 8:14Speaker 2: It's fast, but if a packet gets dropped, it's just
- 8:17Speaker 2: gone perfect.
- 8:17Speaker 1: For things like video streaming or online gaming, where a
- 8:21Speaker 1: tiny glitch is better than a long delay.
- 8:23Speaker 2: Right, and our final foundational protocol is ICMP, the Internet
- 8:27Speaker 2: Control Message protocol.
- 8:28Speaker 1: The messenger used for diagnostics like paying and trace root
- 8:32Speaker 1: and for error handling.
- 8:33Speaker 2: It's like the famous destination unreachable message. A PING request
- 8:37Speaker 2: is type eight and the reply is type zero. But
- 8:40Speaker 2: as an error protocol, it's not designed to carry application data.
- 8:43Speaker 1: Which is exactly why attackers love to abuse it.
- 8:45Speaker 2: Precisely, a standard PING packet carries fifty six bytes of zeros.
- 8:50Speaker 2: If you ever see non zero data in an ICMP packet,
- 8:53Speaker 2: that is a huge red flag. It's a classic sign
- 8:56Speaker 2: of data exfiltration or command and control C two trying
- 9:00Speaker 2: to sneak past the firewall.
- 9:02Speaker 1: Okay, moving up the stack to the application layer. Let's
- 9:04Speaker 1: talk DNS. Why does it usually use UDP. It seems
- 9:08Speaker 1: risky to not guarantee delivery of a query.
- 9:10Speaker 2: Because the cost of reliability that TCP handshake is just
- 9:13Speaker 2: too high for something so frequent. If a UDP DNS
- 9:16Speaker 2: query gets lost, the client just resnds it.
- 9:18Speaker 1: It's faster, And if an attacker tries to hide their
- 9:21Speaker 1: DNS traffic on a non standard port, say port six
- 9:24Speaker 1: five three three three instead of fifty three.
- 9:26Speaker 2: We can still catch it. You just use wire sharks
- 9:29Speaker 2: decode a's feature. You basically tell it, I know this
- 9:31Speaker 2: looks like random data, but treat it as DNS, and poof.
- 9:33Speaker 2: It dissects the packet correctly and reveals the hidden communication.
- 9:36Speaker 1: Now we get to the really dangerous stuff, the clear
- 9:39Speaker 1: text protocols, the low hanging fruit for any analyst, FTP, SMTP,
- 9:45Speaker 1: things like that.
- 9:45Speaker 2: There's simplicity as their vulnerability. With STP, you follow the
- 9:49Speaker 2: stream and you can literally read everything. The USCR command,
- 9:52Speaker 2: the password, the file names, all in plan.
- 9:55Speaker 1: Text, and SMTP for email is just as bad. Yep.
- 9:58Speaker 2: You'll see credentials maybe basics for encoded, but that's not encryption.
- 10:01Speaker 2: The equals at the end is a giveaway. It's easily reversible.
- 10:04Speaker 2: Your password is just sitting there exposed.
- 10:06Speaker 1: Then you have things like TFTP, which is.
- 10:08Speaker 2: Even worse, trivial file Transfer protocol it runs over UDP,
- 10:11Speaker 2: has zero authentication. And then there's ARP, the Address Resolution Protocol.
- 10:15Speaker 2: It's completely stateless, meaning.
- 10:17Speaker 1: It just trusts any reply against.
- 10:19Speaker 2: It trusts any unsolicited reply, which makes it incredibly vulnerable
- 10:23Speaker 2: to ARQ poisoning, where an attacker can redirect all your
- 10:26Speaker 2: traffic through their machine. A classic man in the middle.
- 10:29Speaker 1: So all these risky protocols often blocked. Malware tends to
- 10:33Speaker 1: default to HTTP, the ultimate firewall hole Port eighty is
- 10:37Speaker 1: almost always open.
- 10:38Speaker 2: It is, and when you're analyzing suspicious HTTP, the user
- 10:42Speaker 2: agent field is a critical indicator of compromise. If you
- 10:46Speaker 2: see something that isn't a normal browser string, it's very
- 10:50Speaker 2: likely malware reporting Home.
- 10:52Speaker 1: Attackers can hide data anywhere there right, the URL, the
- 10:54Speaker 1: user agent.
- 10:55Speaker 2: Itself, anywhere there's a free form data spot. Now contrast
- 10:59Speaker 2: all of that exposed data with something like SSH secure shell.
- 11:02Speaker 1: Its whole purpose is the opposite, confidentiality through encryption.
- 11:07Speaker 2: Right, So when you look at an SSH session in
- 11:09Speaker 2: wire shark, what do you see?
- 11:12Speaker 1: Mostly gibberish?
- 11:13Speaker 2: I assume almost entirely. You can see the preamble, the
- 11:15Speaker 2: version exchange, the negotiation cipher suites. But after that initial setup,
- 11:19Speaker 2: the entire session is intentionally unreadable. It's designed to frustrate monitoring.
- 11:24Speaker 1: So if a session is totally encrypted, how does an
- 11:26Speaker 1: analyst ever figure out if malware is communicating over it?
- 11:29Speaker 1: Doesn't that make the job impossible?
- 11:31Speaker 2: It forces you to shift your focus. You can't see
- 11:33Speaker 2: the payload, so you analyze the metadata you look at
- 11:36Speaker 2: timing volume the destination IPS, so is this.
- 11:39Speaker 1: Server suddenly talking to a known malicious IP address? Is
- 11:44Speaker 1: the volume of traffic suggesting data being stolen exactly?
- 11:47Speaker 2: The encryption makes the what unreadable, but the metadata can
- 11:50Speaker 2: still reveal the who and the why.
- 11:53Speaker 1: Well that brings us to the end of our deep dive.
- 11:56Speaker 1: We've gone from the routing logic of IP all the
- 11:58Speaker 1: way up to the secure walls of SAP, focusing on
- 12:01Speaker 1: how to turn that raw data into real intelligence.
- 12:04Speaker 2: And the key takeaway here, I think is that knowing
- 12:06Speaker 2: these structures allows you to spot deviation. You know what
- 12:09Speaker 2: a TTL is supposed to look like, you know what
- 12:11Speaker 2: a user agent should be. This knowledge is what lets
- 12:14Speaker 2: you move from just passively collecting data to actively hunting
- 12:18Speaker 2: for threats.
- 12:19Speaker 1: So let's leave you with one final thought. We saw
- 12:22Speaker 1: that many protocols designed for simplicity and speed, like TFTP,
- 12:25Speaker 1: FTP and ARP ended up with these massive inherent security
- 12:29Speaker 1: flaws clear text credentials, no authentication. So the question is,
- 12:34Speaker 1: when you're designing a system, at what point does the
- 12:36Speaker 1: benefit of speed justify the effort needed to make up
- 12:39Speaker 1: for those security trade offs. Something to think about As
- 12:41Speaker 1: you continue exploring,