Skip to content
Tutorials Center
My learning

Topics

Lesson 37 of 37 ยท Projects and Practice

Practice: Network Security Scenarios

Practice network security with realistic defensive scenarios: reading alerts, choosing controls, hardening reviews, interview-style questions and coding exercises with solutions.

Reading about security is not the same as making decisions under uncertainty. This lesson gives you scenarios in the style of real work and job interviews: look at the evidence, decide what is happening and choose a proportionate response. Try each answer yourself before opening the explanation in your head; the programs and quiz at the end let you check your reasoning.

The scenarios use ideas from this chapter: detection, signatures, anomalies, Wi-Fi, zero trust, secure protocols, architecture and incident response.

Scenario 1: the quiet workstation

The SIEM shows that workstation PC-31 contacted 198.51.100.44 on port 443 every 300 seconds, 24 hours a day for three days. Each request sends about 400 bytes and receives about 150. The user says they were on holiday.

Think about: What pattern is this? Is it necessarily malicious? What would you check first and what would you do?

A good analysis notes the extreme regularity (beaconing, low jitter), small constant sizes, and activity while the user was away, which makes human browsing unlikely. It might still be a legitimate agent (backup, monitoring), so you check the process on the host and the destination's reputation and ownership. If unexplained, isolate the host, preserve evidence and look for other hosts talking to the same destination. The next program quantifies the regularity.

Python Is this traffic a timer?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Scenario 2: the new firewall rule request

A developer asks for a rule "allow any to database on port 5432" because their application cannot connect. They say it is temporary.

Think about: Why is this dangerous? What do you ask first? What is a better solution?

Allowing any source to the database violates least privilege and exposes it to the whole network (or the internet). Ask what the application's source address and zone are, then allow only that source to that database and port, with a ticket, an owner and an expiry date. If the app cannot connect, check routing, DNS and the existing rules first; the real cause is often elsewhere. Log hits on the new rule so you can tell if it is used.

Scenario 3: the coffee shop

A salesperson works from a cafรฉ Wi-Fi and the company VPN keeps dropping. Their browser shows a certificate warning when opening the company portal. Colleagues in the office see no warning.

Think about: What attack could cause this? What should the user do? What can the company do?

A certificate warning appearing only on an untrusted network suggests someone interfering with the connection (a captive portal or a man-in-the-middle attempt). The user must not click through the warning, should disconnect and use a mobile hotspot, and report it. The company can enforce HSTS, use device-based access conditions so unmanaged connections are refused, and pin management of clients so they validate certificates strictly (TLS validation).

Scenario 4: the mail that looks like the CEO

An accounting employee receives a message from [email protected] asking for an urgent wire transfer. The header shows SPF: pass for a different domain and DKIM: none.

Think about: Why might SPF say pass? Which record would make the receiving server reject this message?

SPF passed for the attacker's own envelope domain, but that does not align with the visible From domain. A published DMARC policy of p=reject on your domain makes the receiving server reject the message because neither SPF nor DKIM aligns with the From domain (email authentication). Process controls also matter: payment changes require a second channel confirmation.

Scenario 5: the unpatched appliance

A vulnerability scan flags an old VPN appliance with a critical remote-code-execution flaw that is on the known-exploited list. The vendor patch needs a three-hour outage and the business wants to wait for the weekend.

Think about: What is your risk assessment? What can you do immediately?

An internet-facing device with a known-exploited critical flaw is an emergency; waiting days is unacceptable risk. Options now: apply the patch in an emergency window, or if impossible restrict access (allow only known source ranges), apply the vendor's mitigation or an IPS virtual patch, increase monitoring and check for indicators of compromise before and after patching (the device may already be compromised, and patching does not remove an attacker). Document the exception and its end date (patch management).

Coding exercise: a firewall rule shadow detector

A shadowed rule can never match because an earlier rule already matches all of its traffic. Shadowing makes policy confusing and can hide mistakes. Complete the function mentally, then run the solution.

Python Find shadowed firewall rules

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Rules 2 and 4 are reported. In rule 2 the more specific deny never fires because rule 1 allowed the whole 10.0.0.0/8 first, exactly the kind of bug that opens access unexpectedly. Real firewalls evaluate more fields (protocol, destination, source port) and ranges, so a real tool is bigger, but the idea is the same.

Coding exercise: classify a connection log

Write a function that flags outbound connections to ports commonly used by remote administration (22, 3389, 5900) from servers that should not initiate them.

Python Egress policy checker

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Interview-style questions

Practice answering these out loud in two or three sentences each.

  1. What is the difference between a firewall and an IPS?
  2. Explain defense in depth with an example from a web application.
  3. Why is WPA3 better than WPA2-Personal?
  4. What happens during a TLS handshake, and why do certificates exist?
  5. How would you investigate a host suspected of beaconing?
  6. What is DMARC alignment, and why do SPF and DKIM alone not stop spoofing?
  7. Why do we log denied traffic and not only allowed traffic?
  8. What does least privilege mean for network access?
  9. How do you decide which vulnerability to patch first?
  10. What do you do in the first hour of a suspected breach?

Self-check quiz

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. A server in the DMZ suddenly opens an outbound SSH connection to an unknown internet host. What is the most sensible first response?

    DMZ servers rarely initiate admin sessions outbound; this is a strong compromise indicator. Contain while keeping evidence.
  2. 2. Which control directly addresses stolen-password reuse against a VPN portal?

    MFA means a stolen password alone is not enough to authenticate.
  3. 3. A firewall policy has an early 'allow 10.0.0.0/8 to 443' and a later 'deny 10.1.0.0/16 to 443'. What is true?

    Rules are evaluated in order; the broad early allow matches first.
  4. 4. Which is the best description of 'assume breach'?

    Assume-breach designs use segmentation, least privilege and monitoring to contain intruders.
  5. 5. Why scan only systems you own or are authorized to test?

    Authorization and scope protect both you and the system owners.

Summary

  • Security work is decision making: read the evidence, consider benign explanations, choose proportionate controls.
  • Look for regularity (beaconing), unexpected egress, shadowed rules and broad allow requests.
  • Prefer scoped, time-limited access over "temporary any-any" rules.
  • Emergency flaws on exposed devices need immediate mitigation and a compromise check.
  • Practice by writing small checkers for policy mistakes and by explaining concepts aloud.

Next: Back to the Network Security track