You will explore network analysis tools, commonly referred to as packet sniffers. In particular, you’ll sniff the network and analyze packets for malicious threats. You’ll also craft filtering commands to analyze the contents of captured packets.
Learning Objectives
- Describe how network traffic analysis can help to detect, prevent, and respond to security incidents.
- Use packet sniffing tools to capture and view network communications.
- Analyze packets to interpret network communications.
Understand network traffic
Video: Welcome to module 2
This section builds on your existing knowledge of networking and attacks to delve deeper into network analysis for security purposes. You’ll:
- Explore network traffic flows: Analyze how devices communicate.
- Use packet sniffers: Capture and view network traffic in real-time.
- Perform packet analysis: Dissect packet data to understand communication details.
- Develop your skills: Master practical tools and techniques for network and packet analysis.
This hands-on section will equip you with the skills to monitor networks effectively and detect malicious activities, essential for any security professional.
Ready to take your network analysis to the next level? Dive in!
Welcome back! I’m so
glad you’re joining us. Previously, you
were introduced to incident detection and response. You may also remember
learning about networking from a
previous course. To recap, you learned about how devices talk to each other using network protocols and the different types
of network attacks. You also examined some network
security best practices. Here, we’ll expand
on networking and shift our focus to
network analysis. First, you’ll examine network communications by exploring network traffic flows. Next, you’ll learn
about viewing and capturing network traffic
using packet sniffers. Then, you’ll be introduced
to packet analysis, where you’ll examine
packet fields and decode communication between
devices and networks. As a security professional, you’ll be tasked with
monitoring networks and system infrastructure to
detect malicious activities. And this section will provide
you with the opportunity to develop your network and
packet analysis skills. Are you ready to begin?
Let’s get started!
Video: Casey: Apply soft skills in cybersecurity
- Join the team! Cybersecurity needs diverse perspectives and welcomes everyone.
- Soft skills matter: Clear communication and an open mindset are crucial for success.
- Embrace continuous learning: The threat landscape evolves constantly, demanding curiosity and adaptability.
- Investigate thoroughly: Leave no stone unturned in your cybersecurity approach.
- Start now: You already possess the basic soft skills needed for a cybersecurity career.
Key Message: Cybersecurity is a dynamic field needing diverse talent. Hone your communication, adapt to the changing landscape, and unleash your curiosity to contribute effectively.
Bonus: Everyone already has a head start with their existing soft skills!
Hi, my name is Casey
and I’m part of the Google Cloud Enterprise
Security sales team. First of all, the biggest piece of advice I can give is: do it. I want you to be here. We need all the people. It’s a non-stop, ever-changing world
in cybersecurity, which is why it’s such
a fun place to be. We need more diversity
in security. We need everybody participating. We need people with
diversity of thought, diversity of backgrounds,
diversity of perspectives. I think some of the most
important soft skills in cybersecurity are, number 1, being able to clearly summarize what you’re trying
to say, massively important. One of the other
soft skills that I think could even be more important than
clear communication is working with an open mindset. The threat landscape is
continuously changing. The threat actors,
the bad actors, they never sleep,
and so neither can we. One of the things that
makes cybersecurity so fun, in my opinion, is because
it changes constantly. And if we have a fixed
mindset going in, and what I mean by
a fixed mindset is, I think I know the
answer to this, I think I understand
exactly what’s going on, we are absolutely going
to miss the boat. We need to be able to
always stay curious. And from a cybersecurity
point of view, it’s very important to
leave no stone unturned. One of the best things about soft skills is that we all have them and we’re already using
them every single day. So every one of you that’s watching this already has a head
start in cybersecurity.
Video: The importance of network traffic flows
Key Points:
- Data Security Concerns:
- Data travels across multiple networks, devices, and sometimes ends up in insecure locations.
- Users trust security professionals to protect data during transmission and storage.
- Network Traffic Analysis (NTA):
- Monitors network activity and identifies potential malicious activity.
- Helps understand normal and abnormal data flow patterns.
- Detects inconsistencies through observation of Indicators of Compromise (IoCs).
- Data Exfiltration Example:
- Large volume of outbound traffic from a host might indicate unauthorized data transmission. *NTA assists in identifying such potential security incidents.
Overall Message:
Understanding and monitoring network traffic is crucial for security professionals to detect and prevent data breaches and other threats. NTA tools and understanding normal traffic patterns play a key role in maintaining a secure digital environment.
Imagine a bustling city with a vibrant network of rivers and canals. Just as these waterways carry the lifeblood of commerce and communication, your network’s traffic flows carry the lifeblood of your digital world. In the realm of cybersecurity, understanding and analyzing these flows is not just valuable; it’s essential. This tutorial unlocks the secrets of network traffic analysis (NTA), revealing its immense importance in protecting your digital domain.
I. Unpacking the Importance:
- Early Threat Detection: NTA acts as a vigilant sentinel, constantly monitoring the ebb and flow of data to identify suspicious patterns. Think of it as a net that snags unusual fish before they can disrupt the river’s ecosystem.
- Combating Data Exfiltration: Malicious actors often lurk in the shadows, siphoning sensitive data through hidden channels. NTA sheds light on these clandestine operations, revealing unauthorized data transmissions before they cause irreparable harm.
- Understanding Network Behavior: Just like we learn about an unfamiliar city by observing its traffic patterns, NTA helps us understand the normal flow of data within our network. This baseline is crucial for identifying sudden surges, anomalies, and deviations that might signal threats.
- Forensics and Incident Response: When an attack occurs, tracing the footprints of the attackers is vital. NTA provides a detailed map of the data movements preceding and during the incident, aiding in forensics investigations and swift response measures.
- Optimizing Network Performance: NTA isn’t just about security; it also sheds light on network inefficiencies. By analyzing traffic patterns, we can identify bottlenecks, optimize resource allocation, and ensure smooth data flow for critical operations.
II. Diving Deeper: Techniques and Tools
- Flow analysis: Tracks aggregated data packets without delving into individual content, providing a high-level overview of traffic patterns.
- Deep packet inspection: Analyzes the actual content of data packets, enabling deeper insights into applications, protocols, and potential threats.
- Statistical analysis: Identifies anomalies by comparing current traffic patterns to historical baselines, highlighting deviations that might signal malicious activity.
- Machine learning: Leverages powerful algorithms to detect subtle patterns and potential threats that might escape traditional rules-based analysis.
III. Choosing the Right Tools for the Flow:
- Network size and complexity: Consider the volume and type of traffic your network handles to choose tools with the appropriate processing power and analytical capabilities.
- Budget and resources: NTA solutions range in cost and complexity; choose one that aligns with your financial and technical resources.
- Detection capabilities: Select tools with techniques suited to your specific threat landscape and desired level of granularity.
- Integration capabilities: Ensure the chosen solution seamlessly integrates with your existing security infrastructure for comprehensive threat detection and response.
IV. Mastering the Currents: Continuous Improvement
- Update rules and signatures: Stay ahead of evolving threats by regularly updating detection patterns and algorithms.
- Refine baselines and thresholds: As network usage changes, continuously adjust baselines and thresholds to avoid false positives and missed threats.
- Analyze past incidents: Learn from past attacks to improve future detection capabilities and refine your overall security posture.
V. Conclusion: Embracing the Power of NTA
By harnessing the power of network traffic analysis, you transform your digital domain from a vulnerable ocean into a well-charted river, navigated with confidence and protected from unseen dangers. Remember, NTA is not a silver bullet, but a vital tool in your cybersecurity arsenal. Embrace its power, analyze the currents, and watch as your network flows with the assurance of unwavering security.
So, captain your digital vessel, unfurl the sails of understanding, and navigate the digital rivers with the wisdom of network traffic analysis. May your data journey be ever secure and your digital domain forever protected!
In many organizations, network
communication travels over multiple networks in different countries and
across different devices. Data can get unintentionally sent and
stored in insecure places, like personal email inboxes or
cloud storage platforms. Users trust that their data is safely and
securely sent and stored. And it’s the job of security professionals
like you to help protect these communications in transit and at rest. Previously, you may recall learning how
to identify and secure critical assets through security controls like data
classification and encryption. Coming up, we’ll expand on this topic and
examine how network traffic analysis can be used to monitor network activity and
identify potential malicious activity. So what is network traffic? Network traffic is the amount of
data that moves across a network. While network data is the data that’s
transmitted between devices on a network. Depending on the size of a network, there can be a huge volume of
network traffic at any given moment. For example, in a large,
multinational organization, there may be thousands of employees sending and
receiving emails at any given time. That’s a lot of network traffic. With such large volumes of
traffic being produced, how do you know what’s normal behavior,
or what’s unusual and requires investigation as
a potential security incident? Imagine being stuck in unexpected traffic
during your regular drive to work. And, as you move along, you realize
something unusual caused the traffic, like a minor vehicle collision which
slowed down the expected flow. On the road, we have certain expectations about traffic
flows based on our commuting experience. Peak traffic patterns like morning and
evening rush are normal and expected, while abnormal traffic during
off-peak times reveals that something unexpected has happened,
like a vehicle collision. Network traffic works in the same way. By understanding how data should
be flowing across the network, you can develop an understanding
of expected network traffic flow. By knowing what’s normal,
you can easily spot what’s abnormal. We can detect traffic abnormalities
through observation to spot indicators of compromise, also known as IoC,
which are observable evidence that suggests signs of a potential
security incident. Take, for instance, data exfiltration, which is the unauthorized
transmission of data from a system. Attackers use data exfiltration to
steal or leak data such as user names, passwords, or intellectual property. By observing network traffic, we can
determine if there’s any indicators of compromise, such as large volumes
of outbound traffic leaving a host. This is a sign of possible
data exfiltration which can be further investigated. Understanding and
monitoring network traffic for inconsistencies is an important aspect
of a security professional’s job. Coming up, we’ll explore what a data exfiltration
attack looks like in real-time. Meet you there.
Reading: Maintain awareness with network monitoring
Reading
Network communication can be noisy! Events like sending an email, streaming a video, or visiting a website all produce network communications in the form of network traffic and network data. As a reminder, network traffic is the amount of data that moves across a network. It can also include the type of data that is transferred, such as HTTP. Network data is the data that’s transmitted between devices on a network.
Network monitoring is essential in maintaining situational awareness of any activity on a network. By collecting and analyzing network traffic, organizations can detect suspicious network activity. But before networks can be monitored, you must know exactly what to monitor. In this reading, you’ll learn more about the importance of network monitoring, ways to monitor your network, and network monitoring tools.
Know your network
As you’ve learned, networks connect devices, and devices then communicate and exchange data using network protocols. Network communications provide information about connections such as source and destination IP addresses, amount of data transferred, date and time, and more. This information can be valuable for security professionals when developing a baseline of normal or expected behavior.
A baseline is a reference point that’s used for comparison. You’ve probably encountered or used baselines at some point. For example, a grocery amount for a personal budget is an example of a baseline that can be used to help identify any patterns or changes in spending habits. In security, baselines help establish a standard of expected or normal behavior for systems, devices, and networks. Essentially, by knowing the baseline of normal network behavior, you’ll be better able to identify abnormal network behavior.
Monitor your network
Once you’ve determined a baseline, you can monitor a network to identify any deviations from that baseline. Monitoring involves examining network components to detect unusual activities, such as large and unusual data transfers. Here are examples of network components that can be monitored to detect malicious activity:
Flow analysis
Flow refers to the movement of network communications and includes information related to packets, protocols, and ports. Packets can travel to ports, which receive and transmit communications. Ports are often, but not always, associated with network protocols. For example, port 443 is commonly used by HTTPS which is a protocol that provides website traffic encryption.
However, malicious actors can use protocols and ports that are not commonly associated to maintain communications between the compromised system and their own machine. These communications are what’s known as command and control (C2), which are the techniques used by malicious actors to maintain communications with compromised systems.
For example, malicious actors can use HTTPS protocol over port 8088 as opposed to its commonly associated port 443 to communicate with compromised systems. Organizations must know which ports should be open and approved for connections, and watch out for any mismatches between ports and their associated protocols.
Packet payload information
Network packets contain components related to the transmission of the packet. This includes details like source and destination IP address, and the packet payload information, which is the actual data that’s transmitted. Often, this data is encrypted and requires decryption for it to be readable. Organizations can monitor the payload information of packets to uncover unusual activity, such as sensitive data transmitting outside of the network, which could indicate a possible data exfiltration attack.
Temporal patterns
Network packets contain information relating to time. This information is useful in understanding time patterns. For example, a company operating in North America experiences bulk traffic flows between 9 a.m. to 5 p.m., which is the baseline of normal network activity. If large volumes of traffic are suddenly outside of the normal hours of network activity, then this is considered off baseline and should be investigated.
Through network monitoring, organizations can promptly detect network intrusions and work to prevent them from happening by securing network components.
Protect your network
In this program, you’ve learned about security operations centers (SOC) and their role in monitoring systems against security threats and attacks. Organizations may deploy a network operations center (NOC), which is an organizational unit that monitors the performance of a network and responds to any network disruption, such as a network outage. While a SOC is focused on maintaining the security of an organization through detection and response, a NOC is responsible for maintaining network performance, availability, and uptime.
Security analysts monitor networks to identify any signs of potential security incidents known as indicators of compromise (IoC) and protect networks from threats or attacks. To do this, they must understand the environment that network communications travel through so that they can identify deviations in network traffic.
Network monitoring tools
Network monitoring can be automated or performed manually. Some common network monitoring tools can include:
- Intrusion detection systems (IDS) monitor system activity and alert on possible intrusions. An IDS will detect and alert on the deviations you’ve configured it to detect. Most commonly, IDS tools will monitor the content of packet payload to detect patterns associated with threats such as malware or phishing attempts.
- Network protocol analyzers, also known as packet sniffers, are tools designed to capture and analyze data traffic within a network. They can be used to analyze network communications manually in detail. Examples include tools such as tcpdump and Wireshark, which can be used by security professionals to record network communications through packet captures. Packet captures can then be investigated to identify potentially malicious activity.
Key takeaways
Monitoring and protecting networks from intrusions and attacks are key responsibilities of security professionals. You can’t protect what you don’t know. As a security analyst, you’ll need to know the components of a network and the communications that happen on it, so you can better protect it. Baselines provide a way to understand network traffic by uncovering common patterns which help in identifying any deviations from the expected traffic patterns. Tools like intrusion detection systems and network protocol analyzers support efforts in monitoring network activities.
Resources
- If you would like to learn more about network components organizations can monitor, check out network traffic – MITRE ATT&CK®
- Attackers can leverage different techniques to exfiltrate data, should you like to learn more, check out data exfiltration techniques – MITRE ATT&CK®
Video: Data exfiltration attacks
Attacker’s Steps:
- Gain Initial Access: Through phishing, malware, or other methods.
- Lateral Movement: Explore and expand access within the network.
- Identify Valuable Assets: Locate sensitive data like code, PII, or financial records.
- Package & Exfiltrate Data: Compress or disguise data for stealthy transfer.
- Send Data Out: Use email, file shares, or other avenues to exfiltrate stolen data.
Defense Strategies:
- Prevent Access: Use multi-factor authentication and other security measures.
- Monitor Network Activity: Look for suspicious behavior like unusual file transfers.
- Protect Assets: Catalog and apply security controls to sensitive data.
- Detect & Stop Exfiltration: Identify anomalies (large uploads, unexpected writes) with SIEM tools.
- Respond & Block: Block attacker IP addresses and stop data exfiltration.
Overall Message:
Network monitoring allows security professionals to detect, prevent, and respond to data exfiltration attacks. Understanding the attacker’s process and implementing strong defense measures are crucial for protecting your organization’s valuable assets.
Additional Note:
This summary focuses on the key points of the provided text. If you need a more detailed summary or would like me to focus on specific aspects, please let me know.
Imagine your digital domain – a treasure trove of confidential data. In the shadows, lurks a cunning thief, seeking to pilfer your precious information. This thief is a data exfiltration attacker, and their weapon of choice is stealth. This tutorial equips you with the knowledge and tools to outsmart these digital bandits and keep your data safe.
I. The Hunt Begins: Understanding Data Exfiltration
- What is it? Data exfiltration is the unauthorized transfer of sensitive data outside an organization’s network. Think of it as the thief slipping out with your jewels hidden under their cloak.
- Why do they do it? Attackers exfiltrate data for various reasons, from financial gain (selling stolen data) to espionage (gaining a competitive edge).
- How do they get in? The doorway for exfiltration can be a phishing email, a malware infection, or even a compromised employee account.
II. Following the Trail: The Attacker’s Journey
- Initial Access: The attacker gains a foothold in your network, like picking a lock on your vault.
- Lateral Movement: They slither through your system, searching for the hidden riches (sensitive data).
- Data Exfiltration: The attacker packages the loot, compressing or disguising it to avoid detection, like a thief shrinking down to squeeze through a ventilation shaft.
- Escape Through the Backdoor: Finally, the attacker transmits the stolen data out of your network, like sending the jewels through a secret tunnel.
III. Building the Wall: Defending Against Data Exfiltration
- Fortress of Awareness: Train employees to spot phishing attempts and social engineering schemes that grant attackers access.
- Cyber Defenders Patrol: Implement network monitoring tools to identify suspicious activity like unusual data transfers.
- Securing the Jewels: Encrypt sensitive data and restrict access to authorized personnel.
- Building High Walls and Watchtowers: Utilize firewalls and intrusion detection systems to block unauthorized access attempts.
- Constant Vigilance: Regularly update security software and patch vulnerabilities to keep your defenses strong.
IV. Tracking the Footprints: Detecting and Responding to Exfiltration
- Unusual Traffic Patterns: Large data uploads or downloads outside business hours might signal exfiltration.
- Unfamiliar Destinations: Data sent to unknown IPs or suspicious domains could be a red flag.
- Alerts from Your Sentinels: SIEM tools can analyze network activity and trigger alerts for suspicious behavior.
- Swift Response: Upon detection, isolate the infected system, block the attacker’s IP, and investigate further.
- Learning from the Breach: Analyze the incident, identify vulnerabilities, and update your defenses to prevent future attacks.
V. Conclusion: Securing Your Digital Legacy
Data exfiltration can be a daunting threat, but with knowledge and vigilance, you can become the master of your digital domain. By understanding the attacker’s tactics, implementing robust defenses, and responding swiftly to threats, you can ensure your data remains safe and secure, forever protected from the clutches of digital thieves.
Remember, cybersecurity is a constant journey, not a destination. Stay informed, adapt your defenses, and keep a watchful eye on your digital horizon. With commitment and awareness, you can transform your network from a vulnerable vault into an impregnable fortress, safeguarding your data for generations to come.
So, sharpen your wits, deploy your digital guard dogs, and embark on this adventure of keeping your information safe. May your data forever remain secure, and your digital kingdom forever stand strong against the forces of cyberthievery!
Monitoring network traffic helps security
professionals detect, prevent, and respond
to attacks. In my experience as a
security professional, monitoring for deviations from typical network traffic patterns
has yielded big results. Even if information
is encrypted, monitoring network
traffic is still important for security purposes. Let’s discuss how the
detection and response process might work in a
data exfiltration attack. First, we’ll outline the
attacker’s perspective. Before attackers can
perform data exfiltration, they’ll need to
gain initial access into a network and
computer system. This can be done
through a social engineering attack
like phishing, which tricks people into
disclosing sensitive data. Attackers can send phishing
emails with attachments or links that trick their target into entering their credentials. Now, an attacker has successfully gained
access to their device. After gaining their
initial position into the system, an attacker
won’t stop there. The goal for attackers
is to maintain access in the environment and avoid being detected for as
long as possible. To do this, they’ll perform a tactic known as lateral
movement, or pivoting. This is when they’ll spend time exploring the network
with the goal of expanding and
maintaining their access to other systems on the network. As an attacker pivots
in the network, they’ll scope out
the environment to identify valuable assets, such as sensitive data
like proprietary code, personally identifiable
information like names and addresses,
or financial records. They’ll do this by searching locations such as
network file shares, intranet sites, code
repositories, and more. After the attacker identifies
the assets of value, they’ll need to
collect, package, and prepare the data for
exfiltration outside of the organization’s network and
into the attacker’s hands. One way they may do this is
by reducing the data size. This helps attackers hide the stolen data and
bypass security controls. Finally, the attacker
will exfiltrate the data to their
destination of choice. There are many ways to
do this. For example, attackers can email
the stolen data to themselves using the
compromised email account. Now that you’ve tapped into
the attacker’s perspective, let’s explore how organizations can defend against
this type of attack. First, security teams must
prevent attacker access. There are many methods
you can use to protect your network
from phishing attempts. For example, requiring users to use multi-factor
authentication. Attackers that gain
access to a network can remain unnoticed
for a while. It’s important that
security teams monitor network activity to identify any suspicious activity that can indicate a compromise. For example, multiple
user logins coming from IP addresses outside of the network should
be investigated. Earlier, you examined how
to identify, classify, and protect assets using asset inventories and
security controls. As part of an organization’s
security policy, all assets should be cataloged
in an asset inventory. The appropriate security
controls should also be applied to protect these assets
from unauthorized access. Lastly, if a data exfiltration
attack is successful, security teams must detect
and stop the exfiltration. To detect the attack, indicators of unusual
data collection can be identified through
network monitoring. These include: large
internal file transfers, large external uploads, and unexpected file writes. SIEM tools can detect an
alert on these activities. Once an alert has been sent out, security teams investigate and stop the attack from continuing. There are many ways to
stop an attack like this. For instance, once the unusual
activity is identified, you can block the IP addresses associated with the attacker
using firewall rules. Data exfiltration
attacks are just one of many attacks that can be detected through
network monitoring. Coming up, you’ll learn
how to monitor and analyze network communications
using packet sniffers.
Practice Quiz: Test your knowledge: Understand network traffic
How do indicators of compromise (IoCs) help security analysts detect network traffic abnormalities?
They provide a way to identify an attack.
IoCs help security analysts detect network traffic abnormalities by providing a way to identify an attack. IoCs provide analysts with specific evidence associated with an attack, such as a known malicious IP address, which can help quickly identify and respond to a potential security incident.
Fill in the blank: Data _____ is the term for unauthorized transmission of data from a system.
exfiltration
Data exfiltration is the unauthorized transmission of data from a system.
An attacker has infiltrated a network. Next, they spend time exploring it in order to expand and maintain their access. They look for valuable assets such as proprietary code and financial records. What does this scenario describe?
Lateral movement
This scenario describes lateral movement. Lateral movement, also called pivoting, describes an attacker exploring a network with the goal of expanding and maintaining their access.
What can security professionals use network traffic analysis for? Select three answers.
- To understand network traffic patterns
- To monitor network activity
- To identify malicious activity
Network traffic analysis provides security professionals with a way to monitor network activity, identify malicious activity, and understand network traffic patterns.
Capture and view network traffic
Video: Packets and packet captures
- Network traffic analysis: Examining network communications for insights into network activity and potential threats.
- Packets: Units of data sent over networks, containing source/destination addresses, packet type, and data payload.
- Packet sniffing: Capturing network packets using tools like “packet sniffers” to analyze network activity.
- Packet capture (P-cap): Recorded file containing intercepted network packets, valuable for incident investigation.
- Benefits of packet captures:
- Observing network interactions.
- Building timelines and understanding event sequences during incident investigations.
Key Takeaway: Capturing and analyzing network traffic through packet captures provides valuable insight into network activity and enables security analysts to investigate potential threats and incidents.
Welcome to the world of packets and packet captures, a fundamental domain in cybersecurity! Understanding how data travels across networks and the ability to capture and analyze those packets is crucial for various security tasks, including:
- Network troubleshooting: Identify issues like slow speeds, connectivity problems, and malware infections.
- Security incident investigation: Analyze suspicious network activity to identify intrusions, data breaches, and attacker techniques.
- Threat hunting: Proactively search for vulnerabilities and potential threats by monitoring network traffic.
- Vulnerability assessment: Test network security controls and identify weaknesses that attackers might exploit.
What are Packets?
Imagine information traveling across the internet like letters sent through the mail. Each letter is an individual packet, containing a specific piece of data (the content) and addressing information (sender and recipient). Packets travel through networks in layers, following protocols like TCP/IP to ensure orderly delivery.
Here’s the anatomy of a typical packet:
What is Packet Capture?
Packet capture refers to the process of intercepting and recording these data packets as they travel through a network. It’s like eavesdropping on a conversation happening on a phone line, but instead of voices, you’re capturing digital data.
Tools for Packet Capture:
Several tools can capture network traffic, each with its strengths and weaknesses. Some popular options include:
- Wireshark: A free and open-source network traffic analyzer widely used for its user-friendly interface and powerful filtering capabilities.
- tcpdump: A command-line tool favored by experienced users for its flexibility and efficiency.
- Tshark: A command-line tool from the Wireshark suite offering advanced filtering and analysis options.
Capturing Packets:
The specific steps for capturing packets will vary depending on the tool you choose and your network setup. However, the general process involves:
- Selecting the network interface: Choose the network adapter where you want to capture traffic (e.g., your Wi-Fi adapter or Ethernet port).
- Setting capture filters: You can filter the captured packets based on various criteria like IP addresses, protocols, or keywords to focus on specific traffic.
- Starting the capture: Begin recording the network traffic.
- Stopping the capture: Once you have enough data, stop the capture and save the results as a file (typically in PCAP format).
Analyzing Packet Captures:
Once you have captured some packets, the real fun begins! Analyzing the captured data involves examining the various fields within each packet to understand what information it contains. Tools like Wireshark provide various features to help you dissect packets, including:
- Packet details: View the source and destination IP addresses, protocols used, packet size, and timestamps.
- Content inspection: Decode the actual data payload within the packet, potentially revealing usernames, passwords, or other sensitive information.
- Filters and coloring: Apply filters to focus on specific types of traffic and use color-coding to highlight important events.
Learning Resources:
To deepen your understanding of packets and packet captures, check out these resources:
- Wireshark Tutorials: https://wiki.wireshark.org/
- NetworkProtocolGuide.org: https://www.oreilly.com/library/view/networking-all-in-one-for/9781118381007/06_9781118381007-bk01ch02.html
- Cybrary’s Packet Capture Fundamentals course: https://www.cybrary.it/course/sniffing
Remember, mastering packet capture takes time and practice. Don’t be discouraged if you don’t understand everything at first. Keep exploring, experiment with different tools and filters, and soon you’ll be dissecting network traffic like a pro!
Which of the following are components of a packet? Select three answers.
Footer, Header, Payload
A packet contains a header, payload, and footer. The header includes information like the type of protocol and port being used. The payload is the actual data being delivered. The footer signifies the end of the packet.
Whether it’s an employee
sending an email or a malicious actor attempting to exfiltrate confidential data, actions that are performed
on a network can be identified through examining
network traffic flows. Understanding these network
communications provides valuable insight
into the activities happening in a network. This way, you can better
understand what’s going on in an environment and defend
against potential threats. With this in mind,
let’s examine how to record network traffic
through packet captures. Previously in the program, you learned that
when data is sent, it’s divided into packets. Just like an addressed
envelope in the mail, packets contain delivery
information which is used to route it
to its destination. This information
includes a sender and receiver’s IP address, the type of packet that’s
being sent, and more. Packets can provide lots
of information about the communications
happening between devices over a network. You may also recall that a packet has
multiple components. There’s the header, which
includes information like the type of network protocol
and port being used. Imagine this as
being the name and mailing address located
on an envelope. Network protocols are a set
of rules that determine the transmission of data
between devices on a network. Ports are non-physical
locations on a computer that organize data transmission between devices on a network. The header also contains the packet’s source and
destination IP address. We’ll explore more information contained in the header
in a later section. Next, there’s the payload, which contains the actual data
that’s being delivered. This is like the content of a letter inside of an envelope. And there’s the footer, which signifies the
end of the packet. So how exactly can you
observe a network packet? Just like scents are invisible
but can be smelled, packets are invisible but can be captured using tools
called packet sniffers. You may remember packet sniffers
from a previous section. A network protocol analyzer,
or packet sniffer, is a tool designed
to capture and analyze data traffic
within a network. As a security analyst, you’ll use packet
sniffers to inspect packets for indicators
of compromise. Through packet sniffing, we can grab
a detailed snapshot of packets that travel over a network in the form
of a packet capture. A packet capture,
or P-cap, is a file containing data
packets intercepted from an interface or network. It’s sort of like intercepting
an envelope in the mail. Packet captures are
incredibly useful during incident investigation. By having access to
the communications happening between
devices over a network, you can observe network
interactions and start to build a storyline to determine
what exactly happened. Coming up, we’ll
discuss the importance of packet analysis.
Meet you there.
Reading: Learn more about packet captures
Reading
The role of security analysts involves monitoring and analyzing network traffic flows. One way to do this is by generating packet captures and then analyzing the captured traffic to identify unusual activity on a network.
Previously, you explored the fundamentals of networks. Throughout this section, you’ll refer to your foundation in networking to better understand network traffic flows. In this reading, you’ll learn about the three main aspects of network analysis: packets, network protocol analyzers, and packet captures.
Packets
Previously in the program, you learned that a data packet is a basic unit of information that travels from one device to another within a network. Detecting network intrusions begins at the packet level. That’s because packets form the basis of information exchange over a network. Each time you perform an activity on the internet—like visiting a website—packets are sent and received between your computer and the website’s server. These packets are what help transmit information through a network. For example, when uploading an image to a website, the data gets broken up into multiple packets, which then get routed to the intended destination and reassembled upon delivery.
In cybersecurity, packets provide valuable information that helps add context to events during investigations. Understanding the transfer of information through packets will not only help you develop insight on network activity, it will also help you identify abnormalities and better defend networks from attacks.
Packets contain three components: the header, the payload, and the footer. Here’s a description of each of these components.
Header
Packets begin with the most essential component: the header. Packets can have several headers depending on the protocols used such as an Ethernet header, an IP header, a TCP header, and more. Headers provide information that’s used to route packets to their destination. This includes information about the source and destination IP addresses, packet length, protocol, packet identification numbers, and more.
Here is an IPv4 header with the information it provides:
Payload
The payload component directly follows the header and contains the actual data being delivered. Think back to the example of uploading an image to a website; the payload of this packet would be the image itself.
Footer
The footer, also known as the trailer, is located at the end of a packet. The Ethernet protocol uses footers to provide error-checking information to determine if data has been corrupted. In addition, Ethernet network packets that are analyzed might not display footer information due to network configurations.
Note: Most protocols, such as the Internet Protocol (IP), do not use footers.
Network protocol analyzers
Network protocol analyzers (packet sniffers) are tools designed to capture and analyze data traffic within a network. Examples of network protocol analyzers include tcpdump, Wireshark, and TShark.
Beyond their use in security as an investigative tool used to monitor networks and identify suspicious activity, network protocol analyzers can be used to collect network statistics, such as bandwidth or speed, and troubleshoot network performance issues, like slowdowns.
Network protocol analyzers can also be used for malicious purposes. For example, malicious actors can use network protocol analyzers to capture packets containing sensitive data, such as account login information.
Here’s a network diagram illustrating how packets get transmitted from a sender to the receiver. A network protocol analyzer is placed in the middle of the communications to capture the data packets that travel over the wire.
How network protocol analyzers work
Network protocol analyzers use both software and hardware capabilities to capture network traffic and display it for security analysts to examine and analyze. Here’s how:
- First, packets must be collected from the network via the Network Interface Card (NIC), which is hardware that connects computers to a network, like a router. NICs receive and transmit network traffic, but by default they only listen to network traffic that’s addressed to them. To capture all network traffic that is sent over the network, a NIC must be switched to a mode that has access to all visible network data packets. In wireless interfaces this is often referred to as monitoring mode, and in other systems it may be called promiscuous mode. This mode enables the NIC to have access to all visible network data packets, but it won’t help analysts access all packets across a network. A network protocol analyzer must be positioned in an appropriate network segment to access all traffic between different hosts.
- The network protocol analyzer collects the network traffic in raw binary format. Binary format consists of 0s and 1s and is not as easy for humans to interpret. The network protocol analyzer takes the binary and converts it so that it’s displayed in a human-readable format, so analysts can easily read and understand the information.
Capturing packets
Packet sniffing is the practice of capturing and inspecting data packets across a network. A packet capture (p-cap) is a file containing data packets intercepted from an interface or network. Packet captures can be viewed and further analyzed using network protocol analyzers. For example, you can filter packet captures to only display information that’s most relevant to your investigation, such as packets sent from a specific IP address.
Note: Using network protocol analyzers to intercept and examine private network communications without permission is considered illegal in many places.
P-cap files can come in many formats depending on the packet capture library that’s used. Each format has different uses and network tools may use or support specific packet capture file formats by default. You should be familiar with the following libraries and formats:
- Libpcap is a packet capture library designed to be used by Unix-like systems, like Linux and MacOS®. Tools like tcpdump use Libpcap as the default packet capture file format.
- WinPcap is an open-source packet capture library designed for devices running Windows operating systems. It’s considered an older file format and isn’t predominantly used.
- Npcap is a library designed by the port scanning tool Nmap that is commonly used in Windows operating systems.
- PCAPng is a modern file format that can simultaneously capture packets and store data. Its ability to do both explains the “ng,” which stands for “next generation.”
Pro tip: Analyzing your home network can be a good way to practice using these tools.
Key takeaways
Network protocol analyzers are helpful investigative tools that provide you with insight into the activity happening on a network. As an analyst, you’ll use network protocol analyzer tools to view and analyze packet capture files to better understand network communications and defend against intrusions.
Resources for more information
This Infosec article describes the risks of packet crafting, a technique used to test a network’s structure.
Video: Interpret network communications with packets
- Analogy: Comparing packet capture to intercepting an envelope and packet analysis to reading the letter inside.
- Challenge: Large volumes of network traffic make analyzing packet captures time-consuming.
- Security application: Identifying indicators of compromise (IOCs) in network evidence (packet captures).
- Essential skill: Filtering network traffic with packet sniffers for relevant information.
- Example: Using filters to find data exfiltration (large data transfers) in a packet capture.
- Network analyzer tools: tcpdump (command-line) and Wireshark (GUI).
- Next step: Deep dive into packet fields, specifically IP headers.
Essentially, you’ve described the challenges and importance of analyzing packet captures in cybersecurity investigations, highlighting essential skills and tools like filters and network analyzers. You’ve also teased the upcoming lesson on packet fields, leaving everyone eager to learn more.
The digital world hums with data, flowing like messages in a bustling marketplace. As cybersecurity professionals, understanding these exchanges is key. That’s where packets, the tiny information carriers, and your detective skills come in! This tutorial will equip you to interpret network communications by analyzing these captured packets.
Unpacking the Clues:
- Headers: Think of this as the envelope, revealing vital information like:
- Source and Destination IP addresses: Who’s talking to whom?
- Protocol: TCP for reliable connections, UDP for fast but less secure ones.
- Ports: Think door numbers, directing data to specific applications.
- Packet type: Is it a data packet, an acknowledgment, or something else?
- Payload: The hidden message – the actual data being sent, encrypted or not. Analyzing it can reveal:
- URLs and website content: What resources are being accessed?
- Login credentials: Are sensitive details being transmitted in plain text?
- File transfers: Who’s sending or receiving what files?
- Malicious signatures: Can you spot patterns indicative of malware or exploits?
Tools for the Trade:
- Packet Capture Tools: Wireshark, Tshark, tcpdump – capture network traffic flowing through an interface.
- Packet Analyzers: These software programs dissect captured packets, allowing you to filter, search, and visualize the data.
Stepping into the Detective Role:
- Gather Evidence: Capture network traffic relevant to your investigation or security monitoring.
- Filter the Clues: Focus on specific protocols, ports, IP addresses, or keywords to zero in on relevant packets.
- Inspect the Headers: Identify source and destination, protocol used, and potential red flags like unusual ports.
- Decode the Payload: If unencrypted, analyze the content for sensitive information, suspicious URLs, or malware indicators.
- Connect the Dots: Piece together the information from multiple packets to understand the bigger picture of the communication.
Remember:
- Context is Key: Don’t jump to conclusions based on individual packets. Consider the bigger network context and user activity.
- Knowledge is Power: Deepen your understanding of network protocols, packet structures, and common threats to interpret effectively.
- Continuous Learning: Stay updated on emerging threats and attack vectors to sharpen your detective skills.
By dissecting packets and piecing together the digital puzzle, you’ll gain invaluable insights into the hidden conversations happening on your network. So, sharpen your observation skills, grab your packet analysis tools, and become a master interpreter of network communications – a true cybersecurity detective!
Bonus Tip: Practice makes perfect! Start with analyzing captured traffic from your own device or controlled environments to familiarize yourself with common communication patterns. Gradually progress to more complex scenarios to hone your analysis skills.
If a packet capture is like
intercepting an envelope in the mail, then packet analysis is like reading
the letter inside of the envelope. Let’s discuss how analyzing
packets can help us interpret and understand network communications. As you may know, networks are noisy. There’s an enormous volume of
communications happening between devices at any given time. And because of this, packet captures
can contain large amounts of network communications, making analysis
challenging and time-consuming. As a security professional, you’ll be
working against the clock to protect networks and
computer systems from potential attacks. You may analyze network evidence in
the form of packet captures to identify indicators of compromise. Having the ability to filter network
traffic using packet sniffers to gather relevant information
is an essential skill to have. For example, let’s say that you were
tasked with analyzing a packet capture to find any indication
of data exfiltration. How would you go about this? Using a network analyzer tool, you can
filter the packet capture to sort packets. This can help you quickly identify an
event associated with data exfiltration, like large amounts of
data leaving a database. There are many other filters you can apply
to packet captures to find the information you need to support
an investigation efficiently. Examples of network analyzer tools
include tcpdump and Wireshark. tcpdump is accessed through a command
line while Wireshark has a graphical user interface, or GUI. Both tools are useful for
security analysts, and soon you’ll have
the opportunity to explore both. Before we begin using these tools,
let’s explore packet fields in detail, specifically, IP headers. Meet you there.
Video: Reexamine the fields of a packet header
This passage dives deep into the crucial component of understanding network communication – IP headers. Think of them as the information cards attached to data packets, guiding them through the vast network like mail deliveries.
Key takeaways:
- TCP/IP Model: Packets travel through layers following this framework, with the Internet layer handling delivery through IP.
- IP Headers: These contain essential data fields for routing and delivering packets to their destinations.
- IPv4 vs. IPv6: Both versions exist, but we’ll focus on the more prevalent IPv4 here.
Exploring IPv4 Header Fields:
- Version: Identifies the IP version (IPv4 or IPv6).
- IHL: Specifies the length of the header and any options.
- ToS: Indicates if the packet needs special handling (e.g., priority).
- Total Length: Shows the entire packet size (header + data).
- Identification, Flags, Fragment Offset: Manage fragmentation, where larger packets split and reassemble at the destination.
- TTL: Determines how long a packet can travel before being discarded.
- Protocol: Specifies the protocol used (e.g., TCP for reliable data transfer).
- Header Checksum: Verifies if errors occurred during transmission.
- Source & Destination Address: Similar to sender and recipient information on an envelope.
- Options: Additional information for troubleshooting (not always used).
- Data: The actual content of the packet (e.g., email message).
Remember:
- IP headers are like detailed roadmaps for data packets, ensuring they reach their intended destinations.
- Analyzing these fields is crucial for network security professionals to understand and troubleshoot communication issues.
Stay tuned! The next step involves examining these packet fields in detail, putting your newfound knowledge into practice.
Bonus Analogy: Think of packets as self-driving cars navigating a complex road network. IP headers are their GPS systems, guiding them with precise instructions to reach their final stop.
I hope this summary clarifies the key points and makes the intricacies of IP headers less daunting!
Welcome back, network detectives! We’ve explored the essential fields of an IPv4 header, but now it’s time to dissect them like never before. This is where your cybersecurity instincts truly kick in!
Let’s get granular:
- Version (4 bits): Not just a simple identifier, versions can reveal vulnerabilities. Older versions like IPv4 might be targeted by attackers due to known security flaws.
- IHL (4 bits): This seemingly innocent field dictates the header length and presence of optional fields. A longer header could indicate complex routing paths or malicious attempts to obfuscate traffic.
- ToS (8 bits): Beyond just “priority,” specific bits within ToS represent different service types. Analyzing these can unveil hidden network traffic patterns or Quality of Service (QoS) manipulation attempts.
- Total Length (16 bits): Not just size, but potential fragmentation clues! Large packet sizes could be indicative of malware downloads or botnet communication.
- Identification (16 bits): This unique identifier helps reassemble fragmented packets. Look for duplicate IDs or unusual patterns that might suggest packet manipulation or spoofing attacks.
- Flags (3 bits): These are like traffic signals for your packets! “Don’t Fragment” flag, for example, could point to attempts to bypass security filters that rely on fragmentation analysis.
- Fragment Offset (13 bits): This tells you where a fragment fits within the original packet. Look for inconsistencies or overlapping offsets that might indicate tampering or denial-of-service attacks.
- TTL (8 bits): Not just a timer, but a potential red flag! Extremely low TTLs could indicate malicious packets trying to avoid detection by expiring quickly.
- Protocol (8 bits): This reveals the communication protocol used (e.g., TCP, UDP). Unexpected protocols might signify unauthorized applications or hidden communication channels.
- Header Checksum (16 bits): This ensures data integrity, but attackers can manipulate it to mask errors or inject malicious code. Be wary of checksum inconsistencies!
- Source & Destination Address (32 bits each): These are the cornerstones of network communication, but also potential masks for deception. Spoofed IP addresses can hide attacker origins, so scrutinize them closely.
- Options (variable length): While often unused, these optional fields can carry additional information. Be alert for unusual options that might be used for malicious purposes.
Remember: Analyzing packet headers is not just about understanding basic fields; it’s about piecing together the story they tell. Look for anomalies, inconsistencies, and patterns that deviate from normal network behavior. By honing your analytical skills, you’ll become a master decoder of the hidden language of packets, ready to thwart any cyber threats lurking in the network shadows.
Bonus Tip: Practice makes perfect! Grab your favorite network analyzer tool and start dissecting real-time traffic. The more you analyze, the sharper your eye will become for suspicious activity.
Next up, we’ll explore advanced techniques for dissecting packets and utilizing them for real-world cybersecurity investigations. Stay tuned!
Fill in the blank: The _____ accepts and delivers packets for the network.
Internet Layer
The Internet Layer accepts and delivers packets for the network.
While there are many different
tools available to use, it’s important as a security
analyst that you learn how to read and analyze
packets manually. To do so, let’s examine an important packet
component: IP headers. Previously, you learned about the four layers of
the TCP/IP model. Remember, the TCP/IP model is
a framework that is used to visualize how data is organized and transmitted
across a network. The internet layer accepts and delivers packets
for the network. It’s also the layer where the
Internet Protocol operates as the foundation for all
communications on the internet. It’s responsible for making sure packets reach
their destinations. The Internet Protocol
operates like a mail courier
delivering an envelope. Instead of using the
delivery information found on the envelope, the Internet Protocol
uses the information found in a packet header,
like IP addresses. It then determines the
best available route for packets to take, so that data can be sent
and received between hosts. As you may already know, IP packets contain headers. Headers contain the data
fields essential to the transfer of data to
its intended destination. Different protocols
use different headers. There are two
different versions of the Internet Protocol: IPv4, which is considered to be the foundation of
internet communications, and IPv6, which is the most recent version
of the Internet Protocol. Remember, different protocols
use different headers. So IPv4 and IPv6 headers differ, but they contain similar
fields with different names. IPv4 is still the
most widely used, so we’ll focus on examining
the fields of an IPv4 header. Let’s start with the
Version field, which specifies which version
of IP is being used, either IPv4 or IPv6. Referring back to
our mail analogy, the Version field is like the
different classes of mail, like priority,
express, or regular. Next, IHL stands for
Internet Header Length. This field specifies
the length of the IP header plus any options. The next field, ToS stands
for Type of Service. This field tells us if certain packets should be
treated with different care. For example, think of ToS like a fragile sticker on
a mailed package. Next is the Total Length field, which identifies the length
of the entire packet, including the headers
and the data. This can be compared
to the dimensions and weight of an envelope. The next three fields, Identification, Flags, and Fragment Offset, deal with information
related to fragmentation. Fragmentation is
when an IP packet gets broken up into chunks, which then get transmitted
over the wire and reassembled when they arrive
at their destination. These three fields specify
if fragmentation has been used and how to reassemble the broken packets in
the correct order. This is similar to
how mail can travel through multiple
routes like mailboxes, processing facilities,
airplanes, and mail trucks before it
reaches its destination. The TTL field stands
for Time to Live. Like its name suggests, this field determines how long a packet can live
before it gets dropped. Without this field,
packets could loop through routers endlessly. TTL is similar to how
tracking information provides details about an envelope’s expected
delivery date. The Protocol field specifies
the protocol used by providing a value which
corresponds to a protocol. For example, TCP is
represented by 6. This is similar to
including the number of a house in a postal address. The Header Checksum stores
a value called a checksum, which is used to determine if any errors have
occurred in the header. The Source Address specifies
the source IP address and the Destination
Address specifies the destination IP address. This is just like the sender and receiver’s contact information
found on an envelope. The Options field is not
required and is commonly used for network troubleshooting rather than common traffic. If it’s used, the header
length increases. It’s like purchasing postal
insurance for an envelope. Finally, at the end
of the packet header is where the packet’s
data resides, like the text in
an email message. Who knew that the
packets of data we send across networks contain
so much information? Coming up soon, you’ll
have the opportunity to examine these packet
fields in detail.
Reading: Investigate packet details
Practice Quiz: Test your knowledge: Capture and view network traffic
Which component of a packet contains the actual data that is intended to be sent to its destination?
Payload
The payload is the component of a packet that contains the actual data that is intended to be sent to its destination, such as the body of an email.
Fill in the blank: A _____ is a file that contains data packets that have been intercepted from an interface or a network.
packet capture
A packet capture is a file that contains data packets that have been intercepted from an interface or a network.
Which field of an IP header is used to identify whether IPv4 or IPv6 is used?
Version
The Version field of an IP header identifies whether IPv4 or IPv6 is used.
Which network protocol analyzer is accessed through a graphical user interface?
Wireshark
Wireshark is a network protocol analyzer that is accessed through a graphical user interface.
Packet inspection
Video: Packet captures with tcpdump
Summary:
- Tcpdump is a powerful command-line tool for capturing and analyzing network traffic on Linux and Unix-like systems.
- We practiced using tcpdump to capture one packet and analyzed its output line by line.
- The output includes various fields like timestamps, IP addresses, protocols, ports, flags, and checksums, revealing detailed information about the packet’s journey.
- Analyzing these fields helps understand network communication, troubleshoot issues, and even investigate security incidents.
Key takeaways:
- Tcpdump is versatile, offering options to filter and capture different types of traffic.
- The verbose mode provides in-depth packet information for deep analysis.
- Understanding timestamps, flags, and protocols allows for interpreting traffic flow and data exchange.
- Tcpdump empowers network professionals to monitor, analyze, and optimize network behavior.
Further exploration:
- This is just a basic example. You can try various tcpdump commands with different options and filters.
- Network analyzer tools like Wireshark offer graphical interfaces for more user-friendly exploration.
Overall, this passage highlights the power of tcpdump for delving into the invisible world of network communication.
Mastering the Network Microscope: Capturing and Analyzing Traffic with tcpdump
Introduction:
In the world of cybersecurity, understanding network traffic is crucial for troubleshooting, identifying threats, and conducting investigations. Tcpdump is a powerful command-line tool that acts as your network microscope, allowing you to capture and analyze packets flowing through your system.
Getting Started:
- Availability: Tcpdump is often pre-installed on Linux and Unix-like systems. If not, you can install it using your system’s package manager.
- Basic Syntax:
sudo tcpdump [options] [expression]
sudo
grants the necessary permissions.[options]
customize the capture (e.g., interface, output format, filtering).[expression]
specifies which traffic to capture (e.g., IP addresses, protocols, ports).
Common Options:
-i interface
: Specify the network interface to capture on (e.g.,eth0
,wlan0
).-v
: Verbose mode, displays more detailed packet information.-c count
: Capture a specific number of packets.-w file
: Write captured packets to a file for later analysis.
Filtering Traffic:
- Capture only specific traffic using expressions:
host 192.168.1.100
: Traffic to or from a specific IP address.tcp port 80
: Traffic using the TCP protocol on port 80.icmp
: Only ICMP (ping) traffic.- Combine expressions with logical operators (and, or, not).
Example Capture and Analysis:
- Timestamp: The exact time the packet was captured.
- IP Version: IPv4 or IPv6.
- IP Header Fields: TTL, protocol, source/destination IP addresses, etc.
- Protocol-Specific Fields: TCP flags, checksums, etc.
Advanced Usage:
- Save captures to files for analysis with tools like Wireshark.
- Use tcpdump in scripts for automated monitoring and analysis.
- Integrate with intrusion detection systems (IDS) and security incident response workflows.
Security Considerations:
- Capture only necessary traffic to respect privacy and avoid performance impacts.
- Secure captured files appropriately to protect sensitive information.
Conclusion:
Tcpdump is an invaluable tool for network professionals and cybersecurity practitioners. By understanding its capabilities and mastering its syntax, you can unveil the hidden details of network communication, troubleshoot issues, detect anomalies, and gather evidence for security investigations.
Tcpdump is a popular
network analyzer. It’s pre-installed on many
Linux distributions and can be installed on most Unix-like
operating systems, like macOS. You can easily
capture and monitor network traffic such as TCP, IP, ICMP, and many more. Tcpdump is a command line tool. This means that it does not have a graphical user interface. Earlier in the program, you learned that
the command line is a very powerful
and efficient tool, and we’ll practice
using it together. With tcpdump, you can apply options and flags
to your commands to easily filter network
traffic so that you can find exactly
what you’re looking for. You can filter for a
specific IP address, protocol, or port number. Let’s examine a simple
tcpdump command used to capture packets. Keep in mind that your
computer’s traffic may appear different when
you use this command. At first glance, this looks
like a lot of information. Let’s examine it line by line. The command we ran
is: sudo tcpdump -i any -v -c 1. We’re using sudo because the
Linux account we’re logged in on doesn’t have the
permission to run tcpdump. Then, we specify tcpdump
to start tcpdump and -i to specify which interface we want to
sniff traffic on. The -v stands for verbose, which displays detailed
packet information. The -c stands for count, which specifies how many
packets tcpdump will capture. Here we’ve specified one. Now let’s examine the output. Tcpdump has told us
that it’s listening on any available network
interfaces, and it’s also given us additional information,
like the capture size. The first field is the
packet’s timestamp, which details the specific
time of the packet travel. It begins with hours, minutes, seconds, and fractions
of a second. Timestamps are especially
helpful during an incident investigation
when you want to determine timelines
and correlate traffic. Next, IP is listed as
the Version field. It’s listed as IP, which means it’s IPv4. The verbose option has given us more details about
the IP packet fields, such as protocol type and the length of the packet.
Let’s check it out. The first field, ToS stands
for Type of Service. Recall that this tells us if certain packets should be
treated with different care. This is represented by
a value in hexadecimal. The TTL field is Time to Live, which tells us how
long a packet can travel across a network
before it gets dropped. The next three fields are Identification,
Offset, and Flags, which provide three fields with information relating
to fragmentation. These fields provide
instructions on how to reassemble packets
in the correct order. For example the DF, beside flags stands
for Don’t Fragment. Next, the proto is
the Protocol field. It specifies the
protocol in use and also provides us with the value that corresponds to the protocol. Here the protocol is tcp, which is represented
by the number 6. The last field, length, is the
Total Length of the packet, including the IP header. Next, we can observe the IP addresses that are
communicating with each other. The direction of the arrow indicates the direction
of the traffic flow. The last piece of the IP address indicates the port
number or name. Next, the cksum or checksum
field corresponds to the Header Checksum, which
stores a value that’s used to determine if any errors have
occurred in the header. Here, it’s telling us it’s
correct with no errors. The remaining fields
are related to TCP. For example, Flags
indicate TCP flags. The P is the push flag, and the period indicates
it’s an ACK flag. This means that the packet
is pushing out data. This is just one of many
commands you can use in tcpdump to capture
network traffic. Isn’t it fascinating to observe all the information contained within these invisible packets? Go ahead and try it
out for yourself!
Reading: Overview of tcpdump
Reading
As a security analyst, you’ll use network protocol analyzers to help defend against any network intrusions. Previously, you learned the following terms related to network monitoring and analysis:
- A network protocol analyzer (packet sniffer) is a tool designed to capture and analyze data traffic within a network.
- Packet sniffing is the practice of capturing and inspecting data packets across a network.
In this reading, you’ll learn more about tcpdump, a network protocol analyzer that can be used to capture and view network communications.
What is tcpdump?
Tcpdump is a command-line network protocol analyzer. Recall that a command-line interface (CLI) is a text-based user interface that uses commands to interact with the computer.
Tcpdump is used to capture network traffic. This traffic can be saved to a packet capture (p-cap), which is a file containing data packets intercepted from an interface or network. The p-cap file can be accessed, analyzed, or shared at a later time. Analysts use tcpdump for a variety of reasons, from troubleshooting network issues to identifying malicious activity. Tcpdump comes pre-installed in many Linux distributions and can also be installed on other Unix-based operating systems such as macOS®.
Note: It’s common for network traffic to be encrypted, which means data is encoded and unreadable. Inspecting the network packets might require decrypting the data using the appropriate private keys.
Capturing packets with tcpdump
Previously in this program, you learned that a Linux root user (or superuser) has elevated privileges to modify the system. You also learned that the sudo command temporarily grants elevated permissions to specific users in Linux. Like many other packet sniffing tools, you’ll need to have administrator-level privileges to capture network traffic using tcpdump. This means you will need to either be logged in as the root user or have the ability to use the sudo command. Here is a breakdown of the tcpdump syntax for capturing packets:
sudo tcpdump [-i interface] [option(s)] [expression(s)]
- The sudo tcpdump command begins running tcpdump using elevated permissions as sudo.
- The -i parameter specifies the network interface to capture network traffic. You must specify a network interface to capture from to begin capturing packets. For example, if you specify -i any you’ll sniff traffic from all network interfaces on the system.
- The option(s) are optional and provide you with the ability to alter the execution of the command. The expression(s) are a way to further filter network traffic packets so that you can isolate network traffic. You’ll learn more about option(s) and expression(s) in the next section.
Note: Before you can begin capturing network traffic, you must identify which network interface you’ll want to use to capture packets from. You can use the -D flag to list the network interfaces available on a system.
Options
With tcpdump, you can apply options, also known as flags, to the end of commands to filter network traffic. Short options are abbreviated and represented by a hyphen and a single character like -i. Long options are spelled out using a double hyphen like –interface. Tcpdump has over fifty options that you can explore using the manual page. Here, you’ll examine a couple of essential tcpdump options including how to write and read packet capture files.
Note: Options are case sensitive. For example, a lowercase -w is a separate option with a different use than the option with an uppercase -W.
Note: tcpdump options that are written using short options can be written with or without a space between the option and its value. For example, sudo tcpdump -i any -c 3 and sudo tcpdump -iany -c3 are equivalent commands.
-w
Using the -w flag, you can write or save the sniffed network packets to a packet capture file instead of just printing it out in the terminal. This is very useful because you can refer to this saved file for later analysis. In this command, tcpdump is capturing network traffic from all network interfaces and saving it to a packet capture file named packetcapture.pcap:
sudo tcpdump -i any -w packetcapture.pcap
-r
Using the -r flag, you can read a packet capture file by specifying the file name as a parameter. Here is an example of a tcpdump command that reads a file called packetcapture.pcap:
sudo tcpdump -r packetcapture.pcap
-v
As you’ve learned, packets contain a lot of information. By default, tcpdump will not print out all of a packet’s information. This option, which stands for verbose, lets you control how much packet information you want tcpdump to print out.
There are three levels of verbosity you can use depending on how much packet information you want tcpdump to print out. The levels are -v, -vv, and -vvv. The level of verbosity increases with each added v. The verbose option can be helpful if you’re looking for packet information like the details of a packet’s IP header fields. Here’s an example of a tcpdump command that reads the packetcapture.pcap file with verbosity:
sudo tcpdump -r packetcapture.pcap -v
-c
The -c option stands for count. This option lets you control how many packets tcpdump will capture. For example, specifying -c 1 will only print out one single packet, whereas -c 10 prints out 10 packets. This example is telling tcpdump to only capture the first three packets it sniffs from any network interface:
sudo tcpdump -i any -c 3
-n
By default, tcpdump will perform name resolution. This means that tcpdump automatically converts IP addresses to names. It will also resolve ports to commonly associated services that use these ports. This can be problematic because tcpdump isn’t always accurate in name resolution. For example, tcpdump can capture traffic from port 80 and automatically translates port 80 to HTTP in the output. However, this is misleading because port 80 isn’t always going to be using HTTP; it could be using a different protocol.
Additionally, name resolution uses what’s known as a reverse DNS lookup. A reverse DNS lookup is a query that looks for the domain name associated with an IP address. If you perform a reverse DNS lookup on an attacker’s system, they might be alerted that you are investigating them through their DNS records.
Using the -n flag disables this automatic mapping of numbers to names and is considered to be best practice when sniffing or analyzing traffic. Using -n will not resolve hostnames, whereas -nn will not resolve both hostnames or ports. Here’s an example of a tcpdump command that reads the packetcapture.pcap file with verbosity and disables name resolution:
sudo tcpdump -r packetcapture.pcap -v -n
Pro tip: You can combine options together. For example, -v and -n can be combined as -vn. But, if an option accepts a parameter right after it like -c 1 or -r capture.pcap then you can’t combine other options to it.
Expressions
Using filter expressions in tcpdump commands is also optional, but knowing how and when to use filter expressions can be helpful during packet analysis. There are many ways to use filter expressions.
If you want to specifically search for network traffic by protocol, you can use filter expressions to isolate network packets. For example, you can filter to find only IPv6 traffic using the filter expression ip6.
You can also use boolean operators like and, or, or not to further filter network traffic for specific IP addresses, ports, and more. The example below reads the packetcapture.pcap file and combines two expressions ip and port 80 using the and boolean operator:
sudo tcpdump -r packetcapture.pcap -n ‘ip and port 80’
Pro tip: You can use single or double quotes to ensure that tcpdump executes all of the expressions. You can also use parentheses to group and prioritize different expressions. Grouping expressions is helpful for complex or lengthy commands. For example, the command ip and (port 80 or port 443) tells tcpdump to prioritize executing the filters enclosed in the parentheses before filtering for IPv4.
Interpreting output
Once you run a command to capture packets, tcpdump will print the output of the command as the sniffed packets. In the output, tcpdump prints one line of text for each packet with each line beginning with a timestamp. Here’s an example of a command and output for a single TCP packet:
sudo tcpdump -i any -v -c 1
This command tells tcpdump to capture packets on -i any network interface. The option -v prints out the packet with detailed information and the option -c 1 prints out only one packet. Here is the output of this command:
- Timestamp: The output begins with the timestamp, which starts with hours, minutes, seconds, and fractions of a second.
- Source IP: The packet’s origin is provided by its source IP address.
- Source port: This port number is where the packet originated.
- Destination IP: The destination IP address is where the packet is being transmitted to.
- Destination port: This port number is where the packet is being transmitted to.
The remaining output contains details of the TCP connection including flags and sequence number. The options information is additional packet information that the -v option has provided.
Key takeaways
In security, you’ll likely encounter using network protocol analyzer tools like tcpdump. It’s important to be equipped with the knowledge of capturing, filtering, and interpreting network packets on the command line.
Resources for more information
- Learn more with tcpdump’s tutorials and guides, which includes additional educational resources.
- Learn more about using expressions to filter traffic with this tcpdump tutorial by Daniel Miessler
Practice Quiz: Test your knowledge: Packet inspection
Which tcpdump option is used to specify the network interface?
-i
The -i option is used to specify the network interface; -i stands for interface.
What is needed to access the tcpdump network protocol analyzer?
Command-line interface
tcpdump is a network protocol analyzer that is accessed through a command-line interface (CLI).
What is the first field found in the output of a tcpdump command?
Timestamp
The first field found in the output of a tcpdump command is the packet’s timestamp.
You are using tcpdump to capture network traffic on your local computer. You would like to save the network traffic to a packet capture file for later analysis. Which tcpdump option should you use?
-w
You should use the -w option. The -w option lets you save the network packets to a packet capture file for later analysis.
Practice Quiz: Activity: Research network protocol analyzers
Reading: Activity Exemplar: Research network protocol analyzers
Reading
Completed Exemplar
To review the exemplar for this course item, click the link and select Use Template.
Link to exemplar: Completed diagram
Assessment of Exemplar
Compare the exemplar to your completed activity. Review your work using each of the criteria in the exemplar. What did you do well? Where can you improve? Use your answers to these questions to guide you as you continue to progress through the course.
Note: The exemplar represents one possible way to complete the activity. Yours will likely differ in certain ways. What’s important is that your activity provides your research findings about Wireshark and tcpdump.
The exemplar provides at least two contrasting differences between Wireshark and tcpdump. It also includes three similarities between Wireshark and tcpdump.
Review: Network monitoring and analysis
Video: Wrap-up
- Network traffic analysis is crucial for identifying threats and understanding communication patterns.
- We learned to recognize unusual activity like data exfiltration by monitoring for indicators of compromise.
- Packet sniffers like tcpdump were introduced as tools for capturing network traffic data.
- Finally, we delved into packet analysis, dissecting header fields and inspecting captured packets in detail.
Next, we’ll explore the thrilling world of incident investigation, where we’ll learn the strategies and techniques for detecting, containing, and mitigating security breaches.
Nice work so far! Congratulations on capturing and analyzing your first packet. Let’s review what
we’ve covered so far. First, you learned how
network traffic flows provide valuable
communications insight. Through monitoring
network activity for indicators of compromise, you learned how to spot unusual network activity,
like data exfiltration. Then, you learned how
to view and capture network traffic using
packet sniffers. Finally, you learned
how to inspect packets through packet analysis. You dissected packet
header data fields and analyzed packet
captures in detail. You’ve made a lot of progress in developing the skills you’ll need to prepare for an
entry-level role in security. Coming up, you’ll
be immersed into the exciting world of
incident investigation, where you’ll examine the
processes behind detecting and containing an incident.
I’ll meet you there.
Reading: Glossary terms from module 2
Terms and definitions from Course 6, Module 2
Command and control (C2): The techniques used by malicious actors to maintain communications with compromised systems
Command-line interface (CLI): A text-based user interface that uses commands to interact with the computer
Data exfiltration: Unauthorized transmission of data from a system
Data packet: A basic unit of information that travels from one device to another within a network
Indicators of compromise (IoC): Observable evidence that suggests signs of a potential security incident
Internet Protocol (IP): A set of standards used for routing and addressing data packets as they travel between devices on a network
Intrusion detection systems (IDS): An application that monitors system activity and alerts on possible intrusions
Media Access Control (MAC) Address: A unique alphanumeric identifier that is assigned to each physical device on a network
National Institute of Standards and Technology (NIST) Incident Response Lifecycle: A framework for incident response consisting of four phases: Preparation; Detection and Analysis; Containment, Eradication and Recovery; and Post-incident activity
Network data: The data that’s transmitted between devices on a network
Network protocol analyzer (packet sniffer): A tool designed to capture and analyze data traffic within a network
Network traffic: The amount of data that moves across a network
Network Interface Card (NIC): Hardware that connects computers to a network
Packet capture (p-cap): A file containing data packets intercepted from an interface or network
Packet sniffing: The practice of capturing and inspecting data packets across a network
Playbook: A manual that provides details about any operational action
Root user (or superuser): A user with elevated privileges to modify the system
Sudo: A command that temporarily grants elevated permissions to specific users
tcpdump: A command-line network protocol analyzer
Wireshark: An open-source network protocol analyzer
Quiz: Module 2 challenge
Fill in the blank: _____ describes the amount of data that moves across a network.
Network traffic
AI
The correct answer is: Network traffic
- “Network data” describes the data itself that exists on a network, not the movement of that data.
- “Data exfiltration” is a specific type of network traffic where data is illegally transferred out of a network.
- “Traffic flow” is a broader term that can refer to the movement of any type of data, not just network data.
Therefore, network traffic is the most precise and general term for the amount of data moving across a network.
What are some defensive measures that can be used to protect against data exfiltration? Select two answers.
Deploy multi-factor authentication, Monitor network activity
AI
The correct answers are:
- Monitor network activity: This involves actively watching for unusual patterns or large data transfers that could indicate data exfiltration attempts.
- Deploy multi-factor authentication: This adds an extra layer of security to user accounts, making it more difficult for unauthorized individuals to access sensitive data.
The other options are not effective defensive measures against data exfiltration:
- Reduce file sizes: This might make data exfiltration less efficient, but it doesn’t prevent it from happening.
- Utilize lateral movement: This is a technique used by attackers to navigate within a compromised network, not a defensive measure.
Which packet component contains protocol information?
Header
AI
The correct answer is Header.
Here’s a breakdown of packet components and their roles:
- Header: Contains essential information for routing and processing, including:
- Source and destination IP addresses
- Protocol type (e.g., TCP, UDP, ICMP)
- Port numbers
- Packet sequence number
- Other control information
- Payload: Carries the actual data being transmitted (e.g., email content, website code, file data).
- Footer: Not a standard component in most network protocols. Some protocols might have a trailer for error checking or additional metadata, but it’s not the primary location for protocol information.
- Route: Not a physical part of a packet. It’s the path a packet takes through the network, determined by routers based on header information.
The practice of capturing and inspecting network data packets that are transmitted across a network is known as _____.
packet sniffing
AI
The correct answer is packet sniffing.
- Packet sniffing is the general term for capturing and analyzing network traffic, often for troubleshooting, monitoring, or security purposes.
- Packet capture is a more specific term referring to the actual process of collecting packets using tools like Wireshark or tcpdump.
- Port sniffing is a subset of packet sniffing that focuses on capturing traffic for specific ports, often used to identify vulnerabilities or unauthorized access attempts.
- Protocol capture is not a commonly used term in networking. It could potentially refer to capturing only packets of a specific protocol, but packet sniffing encompasses that as well.
Network protocol analyzer tools are available to be used with which of the following? Select two answers.
Command-line interface, Graphical user interface
AI
The correct answers are:
- Command-line interface (CLI): Many powerful network protocol analyzers, like tcpdump and Wireshark, offer a CLI for efficient interaction and scripting capabilities.
- Graphical user interface (GUI): Visual tools like Wireshark provide a user-friendly interface with interactive features like filtering, sorting, and analysis tools, making them accessible to users of varying technical expertise.
The other options are not interfaces for directly interacting with network protocol analyzers:
- Network interface card (NIC): This hardware component connects a device to a network, but it’s not an interface for tools like Wireshark.
- Internet protocol (IP): This is a set of rules for communication over a network, not an interface for interacting with software.
Which protocol version is considered the foundation for all internet communications?
IPv4
AI
The correct answer is IPv4.
Here’s why:
- HTTP: While crucial for web browsing, HTTP is an application-layer protocol that relies on lower-level protocols like TCP/IP for communication.
- UDP: While widely used for certain applications like voice and video streaming, UDP is not the foundation for all internet communications. Its connectionless nature makes it unsuitable for reliable data transfer that forms the backbone of the internet.
- ICMP: Although essential for network diagnostics and error reporting, ICMP is not the underlying protocol for data transmission.
- IPv4: This is the internet’s primary addressing and routing protocol that defines how devices across the internet communicate with each other. It assigns unique IP addresses and facilitates packet routing across networks.
While newer versions like IPv6 are gaining traction, IPv4 remains the dominant protocol responsible for enabling internet communication as we know it.
Which IPv4 field determines how long a packet can travel before it gets dropped?
Time to Live
AI
The correct answer is Time to Live (TTL).
Here’s a breakdown of the IPv4 fields you mentioned:
- Type of Service (TOS): Indicates the desired quality of service for a packet, such as priority or delay tolerance.
- Options: Contains optional fields for additional information or control, less commonly used in modern networks.
- Header Checksum: Used for error detection in the IPv4 header itself.
- Time to Live (TTL): Specifies the maximum number of hops (routers) a packet can traverse before being discarded. This prevents infinite loops in routing and helps identify unreachable destinations. Each router decrements the TTL by 1 as it forwards the packet. When TTL reaches 0, the packet is dropped, and an ICMP “Time Exceeded” message is sent back to the source.
Which IPv4 field uses a value to represent a standard, like TCP?
Protocol
AI
The correct answer is Protocol.
Here’s an explanation of the fields you mentioned:
- Type of Service (TOS): Specifies quality of service preferences for the packet, not the protocol itself.
- Version: Indicates the IP version (IPv4 or IPv6), not the higher-level protocol.
- Total Length: Specifies the overall packet size, not the protocol type.
- Protocol: This field identifies the specific protocol carried in the packet’s payload. Common values include:
- 6 for TCP (Transmission Control Protocol)
- 17 for UDP (User Datagram Protocol)
- 1 for ICMP (Internet Control Message Protocol)
- And others for various network protocols
The Protocol field is crucial for correct packet handling and routing, as it directs the packet to the appropriate protocol stack for further processing.
Which tcpdump option is used to specify the capture of 5 packets?
-c 5
AI
The correct answer is -c 5.
Here’s a breakdown of the tcpdump options you mentioned:
- -i 5: This option specifies the interface to capture from, not the number of packets. For example, “-i eth0” would capture from the network interface named “eth0”.
- -n 5: This option disables name resolution, but it doesn’t limit the number of packets captured.
- -v 5: This option increases the verbosity of output, providing more detailed packet information, but it doesn’t control the number of packets captured.
- -c 5: This option is specifically used to set a capture count. It tells tcpdump to capture only 5 packets and then stop.
Examine the following tcpdump output:
22:00:19.538395 IP (tos 0x10, ttl 64, id 33842, offset 0, flags [P], proto TCP (6), length 196) 198.168.105.1.41012 > 198.111.123.1.61012: Flags [P.], cksum 0x50af (correct), seq 169, ack 187, win 501, length 42
Which protocols are being used? Select two answers.
IP, TCP
AI
The correct answers are IP and TCP.
Here’s how to identify the protocols from the tcpdump output:
- IP: The output clearly states “IP” at the beginning, indicating that IP (Internet Protocol) is being used for network-layer communication.
- TCP: The “proto TCP (6)” part specifies that TCP (Transmission Control Protocol) is the transport-layer protocol, responsible for reliable data delivery.
The other options are not protocols in this context:
- TOS: Type of Service is a field within the IP header, not a separate protocol.
- UDP: User Datagram Protocol is another transport-layer protocol, but it’s not being used in this packet, as indicated by the “proto TCP (6)” specification.