In this section

0.7 Packets, Flows and Exposure

Module 0

Introduction

Networks record traffic in two very different ways. A packet capture keeps everything that crossed one point, header and content, for as long as someone is willing to store it. A flow record keeps one line per conversation: who talked to whom, on which ports, for how long, and how much. Most investigations have flows and wish they had captures. Knowing exactly what each can show is the difference between a network finding that holds up and one that claims more than the traffic recorded.

This lesson reads one real capture both ways. It's the capture from lesson 0.2, from the same public research dataset, covering about a hundred seconds of a workstation's traffic in a test domain. You'll see what a conversation looks like packet by packet, why "signed" isn't "encrypted", what a flow record would keep of the same traffic, and what the traffic says about which services are exposed to whom. Module 7 investigates network evidence and exposure, so this is the ground for it.

Nothing needs installing to follow along. Every output on this page is the real output of Wireshark's command-line tool, tshark, run on the capture, and the Practice section says where to get the file if you'd like to open it in Wireshark yourself.

1

What a Capture Holds

Its span, its packets and the protocols inside them

Before reading any packet, find out what the capture is: when it starts and ends, how many packets it holds and which protocols are in them. Wireshark's command-line tools answer that in two commands:

$ capinfos ldap-search.cap | head -12
File name:           ldap-search.cap
File type:           Wireshark/tcpdump/... - pcap
File encapsulation:  Ethernet
File timestamp precision:  microseconds (6)
Packet size limit:   file hdr: 65535 bytes
Number of packets:   462
File size:           463 kB
Data size:           456 kB
Capture duration:    103.912755 seconds
First packet time:   2020-09-22 19:09:33.792835
Last packet time:    2020-09-22 19:11:17.705590
Data byte rate:      4392 bytes/s
$ tshark -r ldap-search.cap -q -z io,phs | sed -n 5,22p
eth                                      frames:462 bytes:456460
  ip                                     frames:462 bytes:456460
    tcp                                  frames:456 bytes:455746
      nbss                               frames:16 bytes:6698
        smb                              frames:1 bytes:127
        smb2                             frames:15 bytes:6571
      http                               frames:43 bytes:15104
        data-text-lines                  frames:21 bytes:7645
          tcp.segments                   frames:2 bytes:691
        tcp.segments                     frames:1 bytes:2570
      ldap                               frames:23 bytes:9935
        tcp.segments                     frames:6 bytes:2743
          ldap                           frames:1 bytes:1389
      kerberos                           frames:2 bytes:2003
        tcp.segments                     frames:1 bytes:299
    udp                                  frames:6 bytes:714
      dns                                frames:6 bytes:714

The capture runs about 104 seconds and holds 462 packets. capinfos prints the first and last packet times in the machine's local time zone, which for this page's build machine is British Summer Time on that date. The file itself stores times in UTC, as lesson 0.2 showed when tshark was asked to print them that way.

The protocol hierarchy shows what's inside: mostly TCP, carrying a web protocol, the directory protocol LDAP, Windows file sharing over SMB, and Kerberos, plus a little DNS over UDP. Each is a conversation between the workstation and another machine, and the next sections read them.

A capture is a record of one point on the network. This one was taken where it could see the workstation's traffic. Traffic between two other machines, or traffic the workstation sent by another route, isn't in it. Before drawing conclusions from a capture, find out where it was taken, because everything it shows and everything it misses follows from that.

Note too what the hierarchy can't tell you: which of these protocols matter. Counts of frames and bytes say where the volume is, not where the interest is. The small LDAP section turns out to hold the most telling content in this capture, and the large web section the most telling pattern. Neither is obvious from the counts alone.

Captures also have a time limit. This one covers under two minutes. Anything the workstation did before the capture started or after it stopped isn't here, which is why a capture is usually paired with logs that cover a longer period, as lesson 0.2 paired this one with the event logs.

2

Reading a Conversation

A directory session: bind, then searches, packet by packet
THE SECOND DIRECTORY SESSION, FRAME BY FRAMEWORKSTATION5172.18.39.5, port 62322MORDORDC172.18.38.5, LDAP on 3891frame 160: SYN, opening the connection2frame 161: SYN, ACK, the controller accepts3frame 163: bind request, signed with Kerberos (SASL)4frame 165: bind response, success5frame 172: search the whole subtree for Domain Admins6frame 174: the result, CN=Domain AdminsEvery step is a frame in the capture, and the search and its answer are readable in plain text

The session as a numbered exchange: four frames to connect and bind, then the question and its answer

The workstation held two directory sessions with the domain controller. Lesson 0.2 looked at the first. The figure numbers the second, frame by frame, from the connection to the answer. Here it is in Wireshark, filtered to its LDAP messages:

Apply a display filtertcp.port==62322 && ldap
No.TimeSourceDestinationProtocolLengthInfo
16347.974135172.18.39.5172.18.38.5LDAP1938bindRequest(8) "<ROOT>" sasl
16547.975293172.18.38.5172.18.39.5LDAP265bindResponse(8) success
16647.975511172.18.39.5172.18.38.5LDAP171SASL GSS-API Integrity: searchRequest(9) "DC=theshire,DC=local" baseObject
16747.976310172.18.38.5172.18.39.5LDAP200SASL GSS-API Integrity: searchResEntry(9) "DC=theshire,DC=local" searchResDone(9) success [1 result]
16847.978168172.18.39.5172.18.38.5LDAP219SASL GSS-API Integrity: searchRequest(10) "<ROOT>" baseObject
17047.979046172.18.38.5172.18.39.5LDAP90SASL GSS-API Integrity: searchResEntry(10) "<ROOT>" searchResDone(10) success [2 results]
17247.987821172.18.39.5172.18.38.5LDAP275SASL GSS-API Integrity: searchRequest(12) "DC=theshire,DC=local" wholeSubtree
17447.988905172.18.38.5172.18.39.5LDAP268SASL GSS-API Integrity: searchResEntry(12) "CN=Domain Admins,CN=Users,DC=theshire,DC=local" searchResRef(12) searchResRef(12) searchResRef(12) searchResDone(12) success [3 results]
17647.989326172.18.39.5172.18.38.5LDAP219SASL GSS-API Integrity: searchRequest(13) "<ROOT>" baseObject
17847.990725172.18.38.5172.18.39.5LDAP90SASL GSS-API Integrity: searchResEntry(13) "<ROOT>" searchResDone(13) success [4 results]
›Frame 172: 275 bytes on wire (2200 bits), 275 bytes captured (2200 bits)
›Ethernet II, Src: Microsoft_54:2f:ab (00:0d:3a:54:2f:ab), Dst: 12:34:56:78:9a:bc (12:34:56:78:9a:bc)
›Internet Protocol Version 4, Src: 172.18.39.5, Dst: 172.18.38.5
›Transmission Control Protocol, Src Port: 62322, Dst Port: 389, Seq: 2167, Ack: 1812, Len: 221
▾Lightweight Directory Access Protocol
›SASL Buffer Length: 217
›SASL Buffer
Packets: 10 shown

The second directory session, read by tshark: a signed bind, then searches; the subtree search selected

The session begins with a bind: the workstation authenticates to the directory, here using Kerberos through a mechanism called SASL, and the server answers that the bind succeeded. Then come searches. Each request names a starting point in the directory, a scope and a filter, and each response returns matching entries.

The selected packet is a search starting at DC=theshire,DC=local, the top of the domain, with a whole-subtree scope: search everything beneath this point. The detail tree shows the layers, from the Ethernet frame through IP and TCP to the LDAP message inside the SASL wrapper.

Directory searches like this are an everyday part of a Windows network. Computers and applications query the directory constantly, for users, groups, policies and printers. What makes this session worth reading is its target, which the next section shows, and the fact that lesson 0.2 already tied it to a particular program on the workstation.

When you cite packets in a case, cite the capture file, the frame numbers and the display filter you used. "Frame 172 of the capture, the subtree search, found with the filter tcp.port==62322" lets anyone open the same file and see the same packet, and it says exactly which of the session's many searches you mean.

Reading a conversation this way is slow, and it's the only way to see exactly what was said. For a handful of packets that matter, it's worth it. For thousands, the summary views in the next sections are where to start, and the packet view is where you go once the summaries tell you which packets to read.

It also helps to read a conversation's opening and closing. The opening shows who started it and how it authenticated. The closing shows whether it ended cleanly or was cut off. A session that opens, authenticates, searches the whole directory for administrator groups and closes within a fraction of a second is behaving like a program, not a person clicking through a directory browser, and that observation is available from the packet list alone.

The packet list's colors are Wireshark's: they mark protocols and problems so you can scan a list quickly. They're a display convenience, not part of the capture, and different installations can color the same packets differently.

3

Signed Is Not Encrypted

What "Integrity" protects, and the search a reader can still see

Wireshark labels these LDAP messages "SASL GSS-API Integrity". That label is easy to misread as encryption. It isn't, and the capture shows why:

$ tshark -r ldap-search.cap -Y "frame.number == 172" -T fields -e ldap.baseObject \
    -e ldap.attributeDesc -e ldap.assertionValue
DC=theshire,DC=local	objectCategory,samAccountName	group,Domain Admins
$ tshark -r ldap-search.cap -Y "frame.number == 174" -T fields -e ldap.objectName
CN=Domain Admins,CN=Users,DC=theshire,DC=local

The workstation's search, and the directory's answer naming CN=Domain Admins, are readable in the capture. The messages are signed: each carries a signature the other side can check, so an attacker who changed a packet in transit would be detected. They aren't encrypted, so anyone who can see the traffic can read it.

Microsoft's guidance on LDAP signing describes it in exactly those terms. Signing is integrity verification for SASL binds, aimed at an intruder who captures packets, changes them and forwards them on. It doesn't describe signing as encryption. The same article notes that simple binds on a connection without SSL or TLS are sent in clear text, which is a separate and worse problem.

For an investigator, the distinction cuts both ways. Here it helps: the capture shows what was searched for, which an encrypted session wouldn't. On most networks today, much of the traffic is encrypted, and a capture of it shows the shape of a conversation and very little of its content. Module 7 deals with what can still be learned from encrypted traffic.

For a defender, it's a reminder to read protection labels precisely. Integrity, confidentiality and authentication are different properties, and a protocol can have one without the others. A finding that says "the traffic was protected" should say which.

Encryption on the wire also isn't the end of the story. A session encrypted between the workstation and the server still leaves records at both ends: the server's logs of what was asked, the client's logs of which program asked. When the capture can't show content, those logs often can, which is why lessons 0.2 and 0.5 matter to network investigations as much as to endpoint ones.

4

The Flow Record

One line per conversation: what it keeps and what it drops

A flow record keeps a summary of each conversation instead of its packets. Microsoft's documentation for Azure's virtual network flow logs lists what a typical one holds: a time stamp, source and destination addresses and ports, the protocol, the direction, the flow's state, whether it was encrypted, and packets and bytes in each direction. Firewalls, routers and cloud networks keep similar records.

Wireshark summarizes a capture's conversations in nearly the same terms, in its Conversations window:

ConversationsEthernetIPv4TCP · 5UDP
Address APort AAddress BPort BPacketsBytesRel StartDuration
172.18.39.562322172.18.38.5389251327 kB47.97240.0351
172.18.39.56228910.10.10.580153108 kB1.8956102.0171
172.18.38.5445172.18.39.562300227034 bytes0.000010.8925
172.18.39.562320172.18.38.5389199436 bytes47.94280.0269
172.18.39.562321172.18.38.588113931 bytes47.94740.0040

The capture's TCP conversations in Wireshark's Conversations window, filled by tshark; the long web conversation marked

Five conversations in total, in under two minutes. Each row has both ends with their ports, the packets and bytes in total, the start time relative to the capture, and the duration. The directory sessions, the Kerberos exchange and the SMB session are all short. One conversation stands out: 172.18.39.5:62289 to 10.10.10.5:80, a web connection lasting about a hundred seconds, the whole capture.

Compare a row with Azure's flow tuple from the documentation: time, both addresses and ports, protocol, direction, state, packets and bytes. The Conversations window has nearly all of it, computed from the packets. A flow record is the same summary computed by a network device as the traffic passes, without keeping the packets at all.

A packet captureeverything that crossed one point, for a whileHoldsheaders and content, every packetAnswerswhat was said, if unencryptedCostsstorage: kept for hours or daysCommonrarely, and only at chosen pointsA flow recordone line per conversationHoldsaddresses, ports, protocol, counts, timesAnswerswho talked to whom, how much, how longCostslittle: kept for monthsCommonoften: firewalls, routers, cloud networks

Two records of the same traffic, and why most investigations have the second

What a flow record drops is everything inside the conversation. It doesn't know a search for Domain Admins happened, only that the workstation talked to the domain controller on port 389 for a fraction of a second and exchanged about 327 kilobytes. It doesn't know what was fetched over the web connection. What it keeps is often enough to ask the right next question, and it's kept for months on networks where a capture would be kept for hours, if at all.

That's why most network investigations start with flows. They show which machines talked, when and how much, across a whole network and a long period. Captures, where they exist, answer the narrower question of what was said, once the flows have pointed at the conversation worth reading.

Flow records have their own quirks. A long conversation may be split into several records, one per reporting interval, with Azure's flow logs marking states such as begin, continuing and end. Two devices on the same path may each report the same conversation, doubling the apparent traffic. And address translation can mean the addresses in a flow aren't the ones the endpoints themselves used. Each is a reason to read a flow source's documentation before counting anything.

5

A Conversation's Shape

Regular requests on a long connection, visible without reading a word of them
GruntHTTP.exeOTRF dataset: covenant_getdomaingroup
How it arriveda program file on the user's Desktoprun as THESHIRE\pgustavo
The payloadC:\Users\pgustavo\Desktop\GruntHTTP.exeThe capture cannot say which process made the web requests; the dataset records the tool as Covenant
What it did2 LDAP connections to MORDORDC, in Sysmon event 3a subtree search for Domain Admins, frame 172web requests to 10.10.10.5 from the same workstation
21web requests in the capture
17 of 20gaps of 5.1 seconds
102 sthe web conversation lasted
2LDAP connections by the program

The card gathers what the records hold about the program behind this lesson's traffic, and marks the one link they can't make. The long web conversation is worth a closer look, because its shape tells you something even without its content. Counting the seconds between one web request and the next:

$ tshark -r ldap-search.cap -Y http.request -T fields -e frame.time_relative \
    | awk 'NR>1 {printf "%.1f\n", $1 - p} {p = $1}' | sort -n | uniq -c
      1 0.1
     17 5.1
      1 5.3
      1 10.4

Of the gaps between requests, 17 are 5.1 seconds. The workstation asked the same server for something about every five seconds for the whole capture. A person browsing doesn't do that. Software checking in on a schedule does: update agents, monitoring tools, chat clients, and also the command-and-control programs attackers use to wait for instructions.

That regularity is visible in the flow data as well as the capture, if the flows are recorded finely enough: many short exchanges at a steady interval, or one long connection with a steady trickle of bytes. Detection tools look for exactly this pattern, often called beaconing. Module 7 shows how it's found in flows, and how often it turns out to be legitimate software doing what it was built to do.

The shape is evidence, and it's limited evidence. It tells you the communication was automated and regular. It doesn't tell you what was said or whether it was harmful. In this recording, the dataset's own description says which program was involved. In a real investigation, you'd find out by following the connection to the process that made it, as lesson 0.2 did with Sysmon's network event, and then asking what that program is.

Intervals also need care. Software that checks in every five seconds may add a little random variation, called jitter, to make the pattern less regular. Here one gap is 5.3 seconds and one is 10.4, perhaps a missed check-in. A detector that demanded exactly 5.0 seconds would miss it. Looking at the spread of gaps, as the count does, catches patterns that a search for one exact value would miss.

Notice how this connects the two kinds of record. The flow shows the pattern across the network. The endpoint's records name the program. Neither alone answers the question, which is why Module 7 and Module 5 lean on each other.

Write the pattern down as an observation, not a verdict: "requests to 10.10.10.5 on port 80 every 5.1 seconds for the whole capture". It's specific and checkable, and it leaves the question of what the software was to the records that can answer it.

6

What Is Exposed, and to Whom

Services the traffic shows to be reachable, and why reachability comes before severity
WHAT THE CAPTURE SHOWS REACHABLE FROM THE WORKSTATIONDOMAIN SERVICEStheshire.localMORDORDC172.18.38.5WORKSTATIONwhere the capture was takenWORKSTATION5172.18.39.5WEB SERVERoutside the lab's 172.18 range10.10.10.5HTTP on 80121WORKSTATION5 to MORDORDC: LDAP 389, Kerberos 88, SMB 445, DNS 532WORKSTATION5 to 10.10.10.5: HTTP 80, every 5.1 s●● the capture: everything the workstation sent and receivedSysmon on the workstation and the Security log on the controller kept records; the web server kept none we hold

What the capture shows reachable from the workstation, where it was taken, and which systems kept logs

Exposure is about what can be reached from where, and the figure draws it for this capture. The traffic answers part of that directly: any address that replied to a connection attempt on a port has a service reachable from the machine that asked. Asking the capture which address answered on which port:

$ tshark -r ldap-search.cap -Y "tcp.flags.syn == 1 && tcp.flags.ack == 1" \
    -T fields -e ip.src -e tcp.srcport | sort | uniq -c
      2 172.18.38.5	389
      1 172.18.38.5	445
      1 172.18.38.5	88
$ tshark -r ldap-search.cap -Y "dns.flags.response == 1" -T fields -e ip.src \
    -e udp.srcport | sort | uniq -c
      3 172.18.38.5	53

The domain controller answered on LDAP, Kerberos and SMB, and its DNS service replied too. Those are the services a workstation in a Windows domain is expected to reach. The web server's answer isn't in the capture, because its connection was already open when the capture started, but the conversation shows its port 80 was reachable as well.

This is the first question in any exposure assessment: from this point, what can be reached? A domain controller reachable on LDAP from every workstation is normal and necessary. The same controller reachable on the same ports from the internet would be a serious exposure, whatever its software's condition. The service is identical. Its exposure depends entirely on who can reach it.

That's why Module 7 ranks exposure by what can actually be reached and exploited, not by a vulnerability's severity score alone. A severity score describes a flaw in the software. Whether the flaw matters in a particular network depends on whether anyone who'd misuse it can reach the service. A severe flaw on an unreachable service can wait behind a moderate flaw on a service facing the internet.

Reachability also changes over time. A firewall rule added for a project and never removed, a test server left running, a cloud storage account set to public for a day: each creates exposure that no vulnerability scan of the software would reveal. Network records, flows above all, are how an investigator finds out whether anyone actually used such an opening while it existed.

Traffic is one source for reachability, and an incomplete one: it shows what was reached during the capture, not everything that could have been. Firewall rules, network maps and scans fill in the rest, and Module 7 uses all of them.

When you write about exposure, be precise about the vantage point. "Port 389 on the domain controller was reachable from WORKSTATION5" is a fact this capture supports. "The domain controller exposes LDAP" leaves the reader to guess from where, and the answer changes the risk completely.

7

When an Assistant Reads a Protocol Label

Integrity read as encryption, and the capture that contradicts it

Assistants explain protocol labels fluently, and labels like this one invite a confident wrong answer. Here's one asked about the LDAP traffic.

AI assistantNew chat

Wireshark shows the LDAP traffic as "SASL GSS-API Integrity". So it's encrypted and the queries can't be read, right?

Correct. SASL with GSS-API means the LDAP session is protected by Kerberos, so the traffic is encrypted and the queries and results are not readable in the capture.

Reply to AI assistant...

Check before you use it

The capture contradicts it: tshark reads the search for the Domain Admins group in plain text. "Integrity" means the messages are signed so tampering can be detected, which is what Microsoft's guidance on LDAP signing describes. Signing protects against changes, not against reading. Encryption is a separate protection.

An illustrative exchange, written for this lesson: an assistant you ask will word it differently.

The assistant took "GSS-API" and "Kerberos" as signs of encryption, and concluded the content couldn't be read. Section 3's output shows otherwise: the search for Domain Admins is in the capture in plain text. "Integrity" in Wireshark's label is the important word, and it means signing.

The error matters in both directions. An analyst who believed it would skip the most useful part of this capture, the readable searches, assuming there was nothing to read. A defender who believed it would think their directory traffic was confidential when it isn't.

The check is cheap: look at the packets. If the content is readable in the capture, it isn't encrypted on the wire, whatever the label suggests. If it isn't readable, find out which protection is responsible before assuming which properties it provides.

Assistants are useful for the next step, though. Asked what LDAP signing protects against, or how LDAP traffic can be encrypted, they'll usually give a sound explanation and name the relevant settings. Check those names against Microsoft's documentation, as this lesson did, before putting them in a finding.

The general lesson is the one this module keeps returning to: when an assistant's explanation and the record disagree, the record wins. Here the record is a packet that anyone can open. Reading it took one command, and it settled the question in seconds.

The same applies when an assistant reads a flow record. Asked what a long connection with regular small exchanges means, it may say "command and control". It may be right, and it may be an update agent or a monitoring tool. The flow shows the pattern. The endpoint shows the program. The finding needs both.

Practice

Do

Practice

Describe one conversation as a capture and as a flow
the capture

Work from the outputs in sections 2 to 6, which were all produced from the same capture file. If you have Wireshark, you can open the capture yourself: it's published by the OTRF Security-Datasets project on GitHub under the MIT License.

All the numbers you need are in those outputs: the conversation summary in section 4 gives the flow fields, and the packet views in sections 2 and 3 show what only a capture holds.

Do this Describe one conversation as a capture and as a flow
  1. Pick the conversation. Use the long web conversation from section 4, or the directory session from section 2.
  2. Write the flow record. Addresses, ports, protocol, start, duration, packets and bytes each way, from the conversation summary.
  3. Write what only the capture adds. From the packets shown, list what someone with only the flow record could not know.
  4. Say what is exposed. Name the services reachable from the workstation, and which of them you would ask about first, and why.
You will have described the same traffic at both levels Module 7 works at, and said what each can and cannot show.

Lesson 0.8 turns to a newer kind of actor, one that appears in more and more records, on the network and in the cloud: AI assistants and agents, what they do when asked, and the records that show it.