← All Articles
Cybersecurity10 min read26 April 2026

Digital Forensics: How Investigators Recover Evidence from Digital Devices

A practical introduction to digital forensics covering evidence acquisition, file recovery, memory analysis, and how investigators trace cybercrime across devices and networks.

JM
James Maroko
Full-Stack Engineer & Cybersecurity Specialist

What is Digital Forensics?

Digital forensics is a discipline within information security concerned with the systematic collection, preservation, analysis, and presentation of digital evidence in a manner that satisfies legal and procedural standards. It finds application across criminal investigations, corporate incident response, regulatory compliance, and civil litigation.

The field demands both technical rigour and methodological discipline. Evidence must not only be found — it must be found, handled, and documented in a way that can withstand scrutiny in a court of law or formal review.

Why Digital Forensics Matters

Contemporary criminal activity almost invariably produces a digital trail. Financial fraud manifests in transaction logs and database records. Harassment and threatening communications persist within messaging platforms. Data breaches leave artefacts in server logs, authentication records, and network traffic captures. The ability to recover, interpret, and present this evidence is central to both prosecution and defence in the modern legal landscape.

The Four Phases of a Forensic Investigation

Phase 1: Identification

The investigation begins with a systematic identification of all potential evidence sources. This encompasses physical devices such as workstations, laptops, and mobile phones, as well as removable media, cloud storage accounts, and network infrastructure logs. Every relevant asset is catalogued and documented prior to any interaction, establishing a clear baseline for the investigation.

Phase 2: Acquisition

Acquisition involves the creation of a verified, bit-for-bit forensic image of the original evidence. Under no circumstances is the source device subjected to direct analysis. Write blockers are employed to ensure that the acquisition process introduces no modifications to the original media.

    # Create a forensic image using dd on Linux
    dd if=/dev/sdb of=/forensics/evidence.img bs=4096 conv=noerror,sync

    # Verify integrity with a hash
    md5sum /forensics/evidence.img
    sha256sum /forensics/evidence.img

Cryptographic hash values — typically MD5 and SHA-256 — are recorded both before and after acquisition. A match between the two confirms that the forensic image is an exact, unmodified copy of the original, satisfying the integrity requirements for admissible evidence.

Phase 3: Analysis

Analysis is conducted exclusively on the forensic image. Investigators examine the data for artefacts relevant to the investigation, including deleted files, browser history, communication records, file metadata, user activity logs, and system event records. The analytical process is guided by the specific investigative objectives and documented throughout.

Phase 4: Reporting

The findings of the investigation are consolidated into a formal forensic report suitable for presentation in legal proceedings or to organisational leadership. The report must be objective, technically accurate, and sufficiently detailed to allow independent reproduction of the findings by a qualified third party.

File Recovery: How Deleted Files Are Found

File deletion in most operating systems does not result in the immediate erasure of underlying data. The file system marks the associated storage space as available for reuse, but the data itself persists until overwritten by subsequent write operations. During this window, deleted files remain recoverable through forensic analysis.

    # List deleted files in a filesystem image
    fls -r -d /forensics/evidence.img

    # Recover a specific deleted file by inode number
    icat /forensics/evidence.img 12345 > /forensics/recovered_file.pdf

This characteristic has significant implications for both investigators and those seeking to securely dispose of sensitive data. Standard deletion operations are insufficient for permanent erasure. Secure deletion utilities that perform multiple overwrites of the target data are required to render content forensically unrecoverable.

Memory Forensics: What RAM Reveals

Volatile memory (RAM) represents one of the most information-rich sources of forensic evidence available to an investigator. A memory capture taken from a live or recently powered-down system can expose running processes, active and recent network connections, cryptographic keys, plaintext credentials, and inter-process communications that were never committed to persistent storage.

    # Capture live memory on Linux using LiME
    sudo insmod lime.ko "path=/forensics/memory.lime format=lime"

    # Analyse the memory dump with Volatility
    volatility -f /forensics/memory.lime imageinfo
    volatility -f /forensics/memory.lime --profile=LinuxUbuntu pslist
    volatility -f /forensics/memory.lime --profile=LinuxUbuntu netscan

The transient nature of RAM means that memory acquisition must be prioritised early in a live investigation. Evidence present in volatile memory is irretrievably lost once the system is powered off, making the order of acquisition a critical investigative decision.

Network Forensics: Tracing Activity Across the Wire

Network forensics involves the systematic capture and analysis of network traffic to reconstruct the sequence of events during a security incident. It enables investigators to attribute communications, identify data exfiltration, detect lateral movement, and establish timelines with a high degree of precision.

    # Capture network traffic on a specific interface
    tcpdump -i eth0 -w /forensics/capture.pcap

    # Filter for HTTP traffic in the capture
    tcpdump -r /forensics/capture.pcap port 80

Packet capture data is typically analysed in conjunction with server-side logs, DNS records, and firewall telemetry to construct a comprehensive picture of network activity during the period under investigation.

Mobile Device Forensics

Mobile devices represent a particularly dense source of forensic evidence. They routinely store call records, SMS and application-based communications, location history, browsing data, and photographs embedded with EXIF metadata — including GPS coordinates that can precisely identify where and when an image was captured.

    from PIL import Image
    from PIL.ExifTags import TAGS, GPSTAGS

    def get_gps_info(image_path: str):
        image    = Image.open(image_path)
        exifdata = image._getexif()
        gps_info = {}
        for tag, value in exifdata.items():
            tag_name = TAGS.get(tag)
            if tag_name == "GPSInfo":
                for gps_tag, gps_value in value.items():
                    gps_info[GPSTAGS.get(gps_tag)] = gps_value
        return gps_info

    print(get_gps_info("photo.jpg"))

The geolocation data embedded in images published to social media or shared in communications has proven evidentially significant in numerous investigations, often corroborating or contradicting a subject's stated whereabouts.

The Chain of Custody

The chain of custody is a formal, unbroken record of every individual who has had access to a piece of evidence, along with the time, purpose, and circumstances of that access. It is a foundational principle of forensic practice. Any discontinuity in the chain — an undocumented transfer, an unwitnessed handling — creates grounds for a challenge to the admissibility of the evidence in legal proceedings. Forensic investigators maintain meticulous custody logs from the moment of collection through to presentation in court.

Anti-Forensics: What Attackers Do to Cover Their Tracks

Sophisticated threat actors actively attempt to impede forensic investigation through a range of counter-forensic techniques. These include timestamp manipulation to corrupt event timelines, selective or wholesale deletion of system and application logs, full-disk encryption to prevent access to file system content, and living-off-the-land tactics that leverage legitimate system utilities to avoid the creation of readily attributable artefacts.

    # An attacker might manipulate timestamps to confuse timelines
    touch -t 202001010000 /path/to/malicious/file

    # Or clear bash history to remove command traces
    history -c && cat /dev/null > ~/.bash_history

Awareness of these techniques informs both investigative methodology and defensive architecture. Systems designed with forensic readiness in mind — through centralised, tamper-resistant logging and integrity monitoring — are substantially more resilient to anti-forensic interference.

Tools Used in Digital Forensics

The discipline is supported by a well-established toolset. Autopsy is a widely used open-source platform for disk analysis and file recovery. Volatility is the de facto standard for volatile memory forensics. Wireshark provides comprehensive network packet capture and analysis capabilities. The Sleuth Kit offers a suite of command-line filesystem examination tools. FTK Imager is commonly used for forensic image acquisition and hash-based verification.

Careers in Digital Forensics

Demand for qualified digital forensics practitioners is strong across law enforcement agencies, corporate security functions, legal firms, and government and intelligence organisations. Professional certification is an important differentiator in this field. Widely recognised credentials include the CHFI (Certified Hacking Forensic Investigator), GCFE (GIAC Certified Forensic Examiner), and EnCE (EnCase Certified Examiner).

Conclusion

Digital forensics occupies a critical intersection of law, technology, and investigative practice. Effective forensic readiness is not a reactive measure — it is a design principle. Organisations that embed proper logging architectures, audit trails, and data integrity controls at the system design stage are substantially better positioned to respond to incidents and satisfy evidentiary requirements when they arise.

Work With James

Need help with your project?

Whether it’s M-Pesa integration, a full web application, or a performance audit — reach out and let’s build something great.

Get In Touch →