Learn › Part 4 ยท Forensics, attack graphs and blockchain security

File forensics and EnCase

Magic numbers, metadata, deletion and file carving, steganography, write-blocking, E01 images and the EnCase workflow.

Magic numbers

Extensions can lie; the first bytes of a file usually do not.

TypeSignature (hex)ASCII
Windows executable4D 5AMZ
PDF25 50 44 46%PDF
JPEGFF D8 FF … footer FF D9
PNG89 50 4E 47.PNG
ZIP / DOCX / XLSX / PPTX50 4B 03 04PK..

Metadata

System metadata is kept by the file system: modified/accessed/created times, permissions, owner, sizes. Application metadata lives inside the file: EXIF camera settings and GPS, document author, templates and revisions.

Deletion and carving

Deleting a file on NTFS marks its MFT record as not in use (flag 0x01 → 0x00) and frees the clusters; the content stays until overwritten. Carving tools (Scalpel, Foremost) ignore the file system, scan raw sectors for a header (FF D8 FF) and read to the footer (FF D9). Size = last offset − first offset + 1.

Steganography

Steganography hides the existence of data. LSB insertion changes the lowest bit of colour values (an 800 × 600 RGB image holds 800 × 600 × 3 bits = 180,000 bytes at 1 bit per channel). Append-hiding puts data after a JPEG's FF D9, where viewers stop rendering but a hex editor shows it.

EnCase workflow

  1. Write-block the media (hardware blocker, or FastBloc SE in software). Golden rule: never change the original.
  2. Create a case (number, examiner, description) with separate volumes for evidence (read-only), processing cache and outputs.
  3. Acquire an .E01/.Ex01 image: case header, data in 64-sector (32 KiB) chunks each carrying a checksum (Adler-32/CRC), and one MD5/SHA-1 (or SHA-256) hash of the whole acquisition for verification.
  4. Process: signature analysis (extension mismatches), keyword indexing, entropy (0–8 bits per byte; near 8 suggests encryption or compression), deleted-file recovery, GREP searches such as \d{4}-\d{4}-\d{4}-\d{4}.
  5. Registry artefacts: HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR (USB devices and serials) and UserAssist (program runs, names ROT13-encoded: “abgrcnq.rkr” = notepad.exe).
  6. Bookmark, report and preserve chain of custody.

Common pitfalls

  • DOCX starting with PK is normal, not a mismatch.
  • Browsing original media changes access times.
  • E01 does not hash every chunk cryptographically; chunks get checksums, the image gets the hash.