Latest / CyberCode Academy / Course 6 - Network Traffic Analysis for Incident Response | Episode 1: Fundamentals of Networking: The OSI Model and Essential Protocols
Transcript
- 0:00Speaker 1: Welcome to the deep dive where we crack open dense
- 0:03Speaker 1: technical topics so you can well walk away fluent in
- 0:06Speaker 1: the language of technology. Today we're getting into something really
- 0:10Speaker 1: foundational network traffic.
- 0:13Speaker 2: Right, and you really can't hunt for a thread actor,
- 0:16Speaker 2: you know, whether they're commanding a botnet or secretly pulling
- 0:19Speaker 2: data out of a network, until you get what normal
- 0:22Speaker 2: communication is supposed to look like.
- 0:23Speaker 1: So that's our mission today.
- 0:25Speaker 2: Exactly. We want to give you that fundamental roadmap of
- 0:27Speaker 2: the Internet, show you exactly where an analyst needs to
- 0:30Speaker 2: look to just spot the malicious stuff hiding and all
- 0:33Speaker 2: that noise.
- 0:34Speaker 1: Okay, So for any roadmap we need, well, we need
- 0:37Speaker 1: a map, and for this it's the OSI model. It's
- 0:40Speaker 1: this organizational breakdown of how networks function, right, moving from
- 0:44Speaker 1: the physical hardware all the way up to the apps
- 0:46Speaker 1: we use.
- 0:47Speaker 2: It's great mental model, less of a strict rulebook, more
- 0:49Speaker 2: of a guide for figuring out where problems are.
- 0:51Speaker 1: It starts at the very bottom layer one the physical layer.
- 0:54Speaker 2: The actual cables and electricity, the bits on the wire as.
- 0:59Speaker 1: They say, to the data link layer. It's still very local.
- 1:02Speaker 1: It's dealing with frames with hardware addresses like MC addresses the.
- 1:06Speaker 2: Stuff your Ethernet or Wi Fi card uses decisely. But
- 1:10Speaker 2: for a traffic analyst, these first two layers they handle
- 1:13Speaker 2: the delivery, sure, but it's not where we spend most
- 1:15Speaker 2: of our time. We need to go higher.
- 1:17Speaker 1: We need to get into the software and that starts
- 1:19Speaker 1: right at layer three, the network layer.
- 1:21Speaker 2: Okay, now we're talking.
- 1:22Speaker 1: This is where packets get introduced, and this layer is
- 1:25Speaker 1: all about routing across different networks. It's the home of
- 1:27Speaker 1: the Internet Protocol IP and it's a diagnostic cousin ICMP.
- 1:33Speaker 2: And one level up from that, layer four, the transport layer.
- 1:36Speaker 2: This one sort of defines the quality of the connection.
- 1:39Speaker 1: That's a great way to put it. Yeah, are we
- 1:41Speaker 1: going for speed or are we going for reliability? This
- 1:45Speaker 1: is where you find your core protocols TCP and UDP, and.
- 1:48Speaker 2: Then everything else is kind of lumped into the upper layers.
- 1:50Speaker 1: Layers five, six, and seven. Layer seven is the one
- 1:54Speaker 1: we all interact with. The application layer you know, HTTP
- 1:57Speaker 1: for the web, SMTP for email.
- 2:00Speaker 2: And layers five and six are doing things like managing
- 2:02Speaker 2: the connection and handling encryption like with TLS ex.
- 2:07Speaker 1: Okay, so we've got the seven layer cake But if
- 2:10Speaker 1: we want a shortcut to get to being well informed fast,
- 2:15Speaker 1: is it fair to say an analyst lives almost entirely
- 2:18Speaker 1: in layers three and four.
- 2:19Speaker 2: Oh? Absolutely, that is the critical shortcut. Layers one and
- 2:22Speaker 2: two are just hardware mechanics. Layer seven is the application's purpose.
- 2:26Speaker 1: But three and four that's the how.
- 2:28Speaker 2: How packets get routed, addressed, and delivered reliably or quickly.
- 2:32Speaker 2: If you master IP, PCP and UDP, you've mastered the
- 2:36Speaker 2: foundational language of the whole network.
- 2:38Speaker 1: So let's do that. Let's start with layer three with
- 2:41Speaker 1: the Internet Protocol IP. Why do we even need it?
- 2:43Speaker 1: Doesn't my computer have a MAC address already?
- 2:46Speaker 2: It does, And if every computer was on the same
- 2:48Speaker 2: little local network, that's all you'd need.
- 2:50Speaker 1: But they're not.
- 2:50Speaker 2: But they're not. IP is the basic requirement for a
- 2:53Speaker 2: packet to cross from one network to another. It defines
- 2:56Speaker 2: the addressing, the source and destination IP addresses, and it
- 3:00Speaker 2: wraps the data. It's like the standard mailing label that
- 3:03Speaker 2: every postal worker or router in the world knows how
- 3:06Speaker 2: to read.
- 3:06Speaker 1: We all know IPv four, those four sets of numbers,
- 3:09Speaker 1: but we also know we were running.
- 3:10Speaker 2: Out and along came IPv six to solve that with
- 3:13Speaker 2: a just a virtually inexhaustible supply of addresses.
- 3:17Speaker 1: But it's interesting IPv four has hung on for so long.
- 3:20Speaker 2: It has, and the reason is largely something called network
- 3:23Speaker 2: address translation or NAT. In NAT NAT, let's a whole
- 3:27Speaker 2: office building, for example, share one single public IP address.
- 3:31Speaker 2: That translation from all the internal machines to that one
- 3:34Speaker 2: external address. It just dramatically slowed down how fast we
- 3:38Speaker 2: were eating up public eyps.
- 3:39Speaker 1: Okay, so IP gets the packet routed, but it doesn't
- 3:43Speaker 1: actually guarantee you'll get there, not at all. That brings
- 3:46Speaker 1: us up to layer four. Let's start with the reliable one. TCP.
- 3:49Speaker 1: The Transmission Control Protocol PCP is.
- 3:52Speaker 2: The absolute workhourse of the Internet.
- 3:54Speaker 1: We know.
- 3:54Speaker 2: It builds on top of IP to make sure every
- 3:57Speaker 2: single piece of data is delivered and just as importantly
- 4:00Speaker 2: delivered in the right order.
- 4:01Speaker 1: How does it do that.
- 4:02Speaker 2: It uses sequence numbers and acknowledgment numbers. It keeps track,
- 4:05Speaker 2: and if something is missed it handles the retransmission.
- 4:07Speaker 1: But all that tracking creates overhead. It makes it slower.
- 4:10Speaker 2: It has to. Reliability comes at a price.
- 4:13Speaker 1: And a key concept here for analysis is ports.
- 4:16Speaker 2: Right think of ports as specific mailboxes inside a computer.
- 4:21Speaker 2: The IP address gets the letter to the right building,
- 4:24Speaker 2: but the port number gets it to the right apartment,
- 4:26Speaker 2: letting it handle hundreds of conversations at once.
- 4:29Speaker 1: And server ports are usually predictable. We know web servers
- 4:31Speaker 1: listen on port eighty, yes, but.
- 4:33Speaker 2: The client port, the one your computer uses to start
- 4:37Speaker 2: the conversation. That's usually a random, high numbered port.
- 4:40Speaker 1: And for an analyst, that's a huge clue.
- 4:43Speaker 2: A massive clo If you see traffic on port eighty,
- 4:45Speaker 2: you assume it's web traffic. But if you see what
- 4:47Speaker 2: looks like web traffic on say port fifty thousand something.
- 4:51Speaker 1: That's a red flag.
- 4:52Speaker 2: That port deviation is often a huge sign that malware
- 4:55Speaker 2: is trying to hide its communications.
- 4:57Speaker 1: And before any of this data flows, TCP have its
- 5:00Speaker 1: famous three way handshake s y N.
- 5:02Speaker 2: S yn ack. It's the digital equivalent of hey.
- 5:05Speaker 1: Are you there, yep, I'm here, are you listening.
- 5:07Speaker 2: Yes, I am. It establishes that trusted connection before anything
- 5:11Speaker 2: important is sent.
- 5:12Speaker 1: All right, now, for the complete opposite UDP User Datagram Protocol.
- 5:17Speaker 2: If TCP is the reliable registered mail service that requires
- 5:21Speaker 2: a signature, UDP is the express messenger who just throws
- 5:26Speaker 2: the package over the fence and runs. It's all about speed,
- 5:29Speaker 2: speed above all else. It's connectionless. It has minimal functionality,
- 5:33Speaker 2: just the source and destination ports.
- 5:35Speaker 1: Really, and the trade off is huge.
- 5:36Speaker 2: Oh yeah, there's no guarantee of delivery, no reordering of packets.
- 5:41Speaker 2: If one gets lost, it's just gone.
- 5:43Speaker 1: The application has to handle that.
- 5:45Speaker 2: The application has to be built to expect that. But
- 5:47Speaker 2: that lack of overhead makes it perfect for real time
- 5:50Speaker 2: things like voiceover IP or streaming video. Yeah, you'd rather
- 5:54Speaker 2: lose a few pixels than have the whole conversation pause
- 5:56Speaker 2: to wait for a retransmission.
- 5:58Speaker 1: That makes perfect sense. Okay, move on. Let's just quickly
- 6:00Speaker 1: circle back to layer three and talk about ICMP.
- 6:03Speaker 2: Right, the Internet Control Message Protocol.
- 6:05Speaker 1: This isn't for our data, is it?
- 6:06Speaker 2: No, not for application data. It's purely for diagnostics and
- 6:10Speaker 2: air handling. It's the network yelling hey, this link is
- 6:13Speaker 2: down or I can't reach that destination.
- 6:15Speaker 1: So this is what's behind tools like ping and trace route.
- 6:18Speaker 2: Exactly, ping to see if a host is online, trace
- 6:21Speaker 2: route to map the journey across the internet.
- 6:23Speaker 1: Though from a security point of.
- 6:24Speaker 2: View, most organizations block external ICMP at their firewall. Why
- 6:29Speaker 2: because if you allow it, you make it trivially easy
- 6:32Speaker 2: for an attacker to map out your internal network. And
- 6:35Speaker 2: that's information you just never want to give away.
- 6:37Speaker 1: Okay, that's a solid foundation, IP, TCP, UDP. Now let's
- 6:42Speaker 1: get to the protocols built on top of these, the
- 6:45Speaker 1: specialized operators that well, that give the network its purpose
- 6:49Speaker 1: and often hide the biggest threats.
- 6:51Speaker 2: Let's start local with ARP, the Adjuss Resolution protocol.
- 6:55Speaker 1: Okay.
- 6:56Speaker 2: Its whole job is to match an IP address to
- 6:59Speaker 2: a MACHI address, but only within your local network segment.
- 7:02Speaker 2: And crucially, it has to run unencrypted. Why unencrypted because
- 7:07Speaker 2: it's running before you can even establish any kind of
- 7:09Speaker 2: higher level secure connection.
- 7:11Speaker 1: It's a prerequisite, and that lack of encryption is the vulnerability.
- 7:14Speaker 1: That's why we have ARP poisoning.
- 7:15Speaker 2: Exactly, an attacker on the local network just shouts out
- 7:18Speaker 2: a fake ARP response. They claim that the router's IP
- 7:21Speaker 2: address now belongs to their MS address.
- 7:24Speaker 1: And just like that, all the traffic gets rerouted through
- 7:27Speaker 1: the attackers machine.
- 7:28Speaker 2: A classic man in the middle attack. It is pure
- 7:31Speaker 2: local subversion.
- 7:32Speaker 1: Okay. Let's move out from the local network DNS, the
- 7:35Speaker 1: domain name system on port fifty three. Computers only speak
- 7:39Speaker 1: IP addresses, so how doo we get to Google dot com.
- 7:42Speaker 2: DNS is literally the phone book of the Internet. It
- 7:45Speaker 2: translates those human friendly names into the machine readable IP addresses.
- 7:49Speaker 1: But traditionally DNS runs unencrypted.
- 7:52Speaker 2: Which is a huge privacy leak. Anyone watching your network
- 7:55Speaker 2: traffic can see every single website you look up.
- 7:57Speaker 1: We're seeing things like DNS over EACHTTPS. DH trying to
- 8:02Speaker 1: fix this, but it's a slow process.
- 8:04Speaker 2: It is, and in the meantime, DNS is an easy
- 8:06Speaker 2: weapon for attackers. Take a d DOS amplification attack.
- 8:09Speaker 1: How does that work?
- 8:10Speaker 2: An attacker sends a tiny request to an open DNS server,
- 8:13Speaker 2: but they fake the return address to be their victim's IP.
- 8:17Speaker 2: The DNS server replies with the response that can be
- 8:20Speaker 2: dozens of times larger than the request and sends that
- 8:22Speaker 2: huge payload straight to the victim.
- 8:24Speaker 1: So for an analyst, that size difference, that asymmetry between
- 8:28Speaker 1: the small request and the lard response on port fifty three,
- 8:32Speaker 1: that's a dead giveaway.
- 8:33Speaker 2: It's a massive indicator potential abuse, all right.
- 8:36Speaker 1: What about remote access SSH secure shell on port twenty two, it's.
- 8:41Speaker 2: The standard for encrypted terminal connections. System admins use it
- 8:44Speaker 2: every single day.
- 8:45Speaker 1: But it's usually for an admin to get into a server.
- 8:48Speaker 1: What's the biggest fear for an analyst when they see
- 8:50Speaker 1: SSAH traffic trying to get.
- 8:51Speaker 2: Out is the reverse shell and is a huge challenge.
- 8:54Speaker 2: Why Because most firewalls are configured to block unexpected inbound connections.
- 9:00Speaker 2: Malware on a compromise machine inside the network will call
- 9:03Speaker 2: out to the attacker. It establishes the connection from the inside.
- 9:06Speaker 1: Out, and most firewalls just let outbound.
- 9:09Speaker 2: Traffic go by default. Yes, so the attacker gets a
- 9:11Speaker 2: fully encrypted remote control session that just bypassed your main
- 9:14Speaker 2: perimeter defense.
- 9:15Speaker 1: That is brilliantly devious. Okay, Now for the protocol we
- 9:18Speaker 1: see more than any other HTTP and HTTPS.
- 9:23Speaker 2: Right pourt eighty for HTTP, four forty three for HGTPS.
- 9:26Speaker 2: That's how we get the web. And because every single
- 9:29Speaker 2: firewall has to allow this traffic for business to even.
- 9:31Speaker 1: Function, attackers hide everything in it, everything.
- 9:34Speaker 2: Command control traffic for their malware, sneaking data out of
- 9:37Speaker 2: the network. It all gets disguised to look like normal
- 9:40Speaker 2: web browsing because it's the path of least resistance.
- 9:42Speaker 1: We also still see older protocols being used for this,
- 9:45Speaker 1: right like IRC.
- 9:46Speaker 2: Oh yeah, Internet really chat well often on ports like
- 9:49Speaker 2: one ninety four six six sixty seven. It's simple structure
- 9:53Speaker 2: makes it perfect for botnet command and control. An attacker
- 9:57Speaker 2: can just hop in a channel and broadcast one command
- 9:59Speaker 2: to thousands of infected machines at once.
- 10:02Speaker 1: And sort of wrapping all of this protecting it is
- 10:04Speaker 1: TLS Transport Layer Security.
- 10:07Speaker 2: Yes TLS and its predecessor SSL. It's like a security wrapper.
- 10:11Speaker 2: HDTPS is really just a HTTP wrapped inside a TLS session.
- 10:15Speaker 2: It provides authentication and that critical.
- 10:17Speaker 1: Encryption through another handshake process.
- 10:19Speaker 2: Right, a handshake that uses public key cryptography to agree
- 10:22Speaker 2: on a shared secret key before the real data starts
- 10:24Speaker 2: to flow.
- 10:24Speaker 1: But here's the real analytical problem. The very security feature
- 10:28Speaker 1: designed to protect us is now the attacker's best friend.
- 10:32Speaker 2: It's the perfect paradox. Attackers use TLS to completely hide
- 10:36Speaker 2: their malicious traffic from most network monitoring tools.
- 10:39Speaker 1: Spotting badness inside encrypted traffic is the number one challenge
- 10:43Speaker 1: for a modern analyst.
- 10:44Speaker 2: It is the protocol that gives you privacy also gives
- 10:47Speaker 2: the attacker the perfect place to hide.
- 10:49Speaker 1: So a quick recap then we map the OSI layers,
- 10:52Speaker 1: but we focused on layer three IP and layer four
- 10:55Speaker 1: TCP and UDP as the analyst's home base.
- 10:58Speaker 2: We covered how TCP gives you liability, EDP gutsy speed,
- 11:01Speaker 2: and ICMP handles the diagnostics, and then.
- 11:04Speaker 1: We looked at the application protocols on top, from DNS
- 11:06Speaker 1: lookups and ARP poisoning to.
- 11:08Speaker 2: The way attackers use reverse shells with SSH and hide
- 11:11Speaker 2: their entire operation inside web traffic very often wrapped in TLS.
- 11:15Speaker 2: The protocol, the port, and the wrapper. Those three things
- 11:18Speaker 2: tell you its function and its potential for misuse.
- 11:21Speaker 1: Which leaves us with a final thought for you to
- 11:23Speaker 1: mull over tying a few of these concepts together.
- 11:25Speaker 2: Okay, here it is. If you're analyzing a network capture
- 11:29Speaker 2: and you see a lot of traffic on port fifty
- 11:31Speaker 2: three and it's all running over UDP, and you notice
- 11:34Speaker 2: that the response packets are consistently, say much much larger
- 11:38Speaker 2: than the request packets. What application protocol you're looking at
- 11:41Speaker 2: and what specific security threat might that asymmetry indicate?
- 11:44Speaker 1: Keep this fundamental shirt. We'll catch you on the next
- 11:46Speaker 1: deep dive.