Skip to content
Tutorials Center
My learning

Topics

Lesson 60 of 80 ยท Security Operations and Incident Response

Network and Mobile Forensics

Learn the steps of network forensics, how investigators correlate captures and logs, and how mobile devices are acquired (logical, file system, physical) and examined, with Python demos.

Digital Forensics Basics covered the general rules: preserve evidence, follow the order of volatility, keep a chain of custody and build a timeline. Two specialized branches deserve their own treatment because their evidence behaves differently. Network forensics deals with data in motion, which is gone unless someone captured it. Mobile forensics deals with phones and tablets, which are small, always connected, encrypted by default and full of personal data.

This lesson explains the steps of a network investigation, how to reconstruct events from captures and logs, and how investigators acquire and examine a mobile device without damaging the evidence. It uses small simulations in Python, and assumes you have authority to investigate (a legal order, an employer's policy, or an owner's consent), because both kinds of evidence are very sensitive (Cyber Law, Ethics and Security Policy).

Network forensics

Network forensics is the capture, recording and analysis of network events to find the source of attacks or incidents and to establish what happened. It works from two main kinds of data:

  • "Catch it as you can": record all traffic passing a point and analyze it later (full packet capture). It offers the richest evidence but needs heavy storage.
  • "Stop, look and listen": inspect each packet as it passes and keep only what looks interesting (IDS alerts, flow records, logs). It is cheaper, but anything not saved is lost.

Sources include packet captures, flow records, firewall, proxy and DNS logs, intrusion-detection alerts, router and switch logs, authentication servers and cloud logs (Network Traffic Analysis and Packet Capture, Logging, Log Analysis and SIEM).

A seven-step process

A commonly used outline for a network investigation:

  1. Identify: recognize that an incident occurred and which networks, devices and time window are relevant.
  2. Preserve and secure: protect the evidence from change, and stop log rotation or deletion. Capture volatile data (connection tables, ARP caches) first.
  3. Collect: gather packet captures, logs and device configurations from all vantage points, recording where each came from, with hashes (Hash Functions and Integrity).
  4. Examine: filter and reduce the data to relevant events, using the same techniques as in traffic analysis.
  5. Analyze: correlate sources, build a timeline, and answer who, what, when, where and how. Compare against known indicators (The Attack Lifecycle and MITRE ATT&CK).
  6. Present: write a clear report with evidence, method, limits and conclusions that a non-technical reader and a court can follow.
  7. Incident response and review: feed findings into containment, remediation and improvements (The Incident Response Process).
flowchart LR
    A["1 Identify"] --> B["2 Preserve"] --> C["3 Collect"] --> D["4 Examine"] --> E["5 Analyze"] --> F["6 Present"] --> G["7 Respond and review"]

The same shape as general forensics, adapted to evidence that exists only if you captured it in time.

Challenges unique to the network

  • Volume and speed: terabytes of data; you need filters, indexing and sampling.
  • Encryption: TLS hides content, so you rely on metadata (server names, certificates, sizes, timing) unless you have lawful access to keys or endpoint copies.
  • Clock differences: devices disagree on time, so synchronize by NTP and note offsets when correlating.
  • NAT and dynamic addresses: an IP address alone may not identify a device; use DHCP leases and NAT logs (NAT, Proxies and Network Access Control).
  • Spoofing and anonymization: source addresses can be forged, and traffic can pass through proxies, VPNs or Tor, so look for corroboration.
  • Legal and privacy limits: capturing content may need legal authority; many organizations capture metadata by default and content only under a defined process.

Correlating sources into a timeline

No single log tells the whole story. Joining several, aligned on time, usually does. This script merges synthetic firewall, DNS, authentication and proxy records, corrects one source's clock offset, and prints the story in order:

Python Merge logs into one incident timeline

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.

Without the clock correction, the proxy download would be stamped 10:05:30, three minutes late, which weakens its link to the DNS lookup that caused it and can hide the pattern from a time-window rule. Always record each source's time offset and document the correction.

Mobile forensics

Mobile forensics recovers and analyzes data from phones, tablets and other mobile devices, such as wearables. Phones hold contacts, messages, call logs, photos, location history, app data, browser history and account tokens, which makes them valuable evidence in both corporate and criminal investigations, and a major privacy concern.

What makes phones different:

  • Strong built-in security: full-disk or file-based encryption with keys tied to the device and the passcode, secure hardware, locked bootloaders and sandboxed apps.
  • Volatility and remote change: a phone can receive a remote wipe command or new network data. Investigators isolate it from the network (airplane mode, a shielded Faraday bag or box) while keeping it powered.
  • Diversity: many models, operating-system versions and apps; tools support some devices better than others.
  • Cloud copies: data also lives in backups and cloud accounts, which may be accessible with proper legal authority.

Acquisition levels

Mobile acquisition methods are commonly described in increasing depth:

Method What you get Notes
Manual / screen capture What is visible in the user interface Used when nothing else works; slow, and every tap alters the device
Logical acquisition Files and databases the operating system exposes through its normal backup or sync interface (contacts, messages, call logs, some app data) Fast and least intrusive, but misses deleted and protected data
File-system acquisition The full file system, including app databases and sometimes deleted-record remnants in them Needs more access and often a supported tool
Physical acquisition A bit-for-bit image of the device's storage Deepest, but modern encryption, secure hardware and flash-memory behaviour limit what is readable without the passcode; device-specific techniques may be needed
Chip-off / hardware methods Reading the memory chip directly Destructive, expensive and often defeated by hardware-backed encryption on current devices
Cloud acquisition Backups and account data held by a service provider Requires legal process or account owner consent; may include data no longer on the phone

Investigators choose the least invasive method that gets the evidence needed, document each step, and calculate hashes of what was extracted. For an unlocked, powered phone, the key priorities are: keep it powered, prevent network contact, record the screen state, and avoid locking it before a lawful extraction.

Examining mobile data

Most app data is stored in SQLite databases, files on the device that hold messages, contacts and histories in tables. A relevant fact for investigators is that when a row is deleted, the database engine often just marks the space as free, so remnants can remain in the file until overwritten (unless the app overwrites them or secure deletion is on). The next demo builds a small database, deletes a message, and shows that the raw file still holds the text.

Python Deleted records can linger in a database file

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.

Real tools parse databases, write-ahead logs and free lists, and rebuild chats, locations and timelines, while keeping the originals untouched. The same principle explains why privacy-minded apps enable secure deletion, and why deleting something in an app is not the same as erasing it. (Flash storage adds another layer: wear-levelling and TRIM can move or erase data in ways a user cannot control; see the evidence-collection section of Digital Forensics Basics.)

Verify what you collected

Whatever the acquisition level, the output must be verifiable. A hash of the extraction taken at acquisition time lets anyone prove later that it has not changed.

Python Hashing an extraction and logging custody

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.

Mobile threats and what examiners find

Typical findings include stalkerware and unwanted administrator apps (Cybercrime, Identity Theft and Cyberstalking), malicious apps and over-broad permissions (Mobile Application Security), phishing links followed in messaging apps, SIM-swap evidence, and sideloaded apps or modified (jailbroken or rooted) systems. Detection relies on app lists and permissions, unusual battery or data use, network indicators from the device's traffic, and system logs.

Best practices summary

  • Legal first: confirm authority and scope before collecting anything, particularly personal devices.
  • Preserve: isolate (but keep powered), photograph and document the state, hash everything, and never work on the original.
  • Least invasive method: start with logical acquisition when appropriate and escalate only as needed.
  • Document: tools, versions, steps, times, and chain of custody. Results must be reproducible by another examiner.
  • Validate tools on test devices; no tool recovers everything from every phone.
  • Minimize: extract and report only what the investigation needs, and protect the data under privacy law (Privacy and Data Protection).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which approach to network evidence stores everything crossing a link for later analysis?

    Full capture keeps all traffic, which gives the richest evidence at high storage cost. The alternative keeps only what looks interesting.
  2. 2. Why must you correct for clock differences when merging logs from several devices?

    Correlation depends on accurate ordering. Record every source's offset and document the correction.
  3. 3. A phone involved in an investigation is powered on and unlocked. Which action is generally recommended first?

    Isolation prevents remote wipes and changes, power keeps encryption keys available, and documentation preserves context. Browsing the phone changes evidence.
  4. 4. Which acquisition level is the least intrusive but misses deleted and protected data?

    Logical acquisition uses the system's own interfaces, so it is fast and gentle, but it only returns what the operating system exposes.

Summary

  • Network forensics reconstructs events from captures, flows and logs; the seven steps are identify, preserve, collect, examine, analyze, present and review.
  • Challenges include volume, encryption, clock skew, NAT, spoofing and privacy law; correlate several sources and correct time offsets.
  • Mobile forensics deals with encrypted, networked, sandboxed devices: isolate them but keep them powered, and choose the least invasive acquisition (logical, file system, physical, cloud).
  • App data lives in SQLite databases where deleted records can linger, while secure deletion and flash behaviour change what can be recovered.
  • Hash everything, keep a custody log, work on copies, and limit collection to what is authorized and necessary.

Next: Security Metrics and KPIs.