GO KALI FREE

Foremost

Forensics

Beginnerlow risk

Foremost is a forensic data recovery program that recovers files based on their headers, footers, and internal data structures.

Installation

sudo apt install foremost

Basic Syntax

foremost -i <input> -o <output>

Quick Facts

Full Name
Foremost File Carving Tool
License
Public Domain
Author
United States Air Force
Written In
C
Platforms
Linux, macOS, Windows (Cygwin)
Category
File Carving / Data Recovery
First Release
2001
Key Feature
Header/Footer Based File Recovery

Tool Overview

Foremost is a forensic file carving tool originally developed by the United States Air Force Office of Special Investigations. It recovers files from disk images by scanning for known file headers, footers, and internal data structures.

Foremost works by reading through a raw disk image or partition dump and identifying file boundaries based on signature matching. Once a file header is found, Foremost carves the data until the corresponding footer is reached or a maximum file size limit is hit.

While Foremost is fast and lightweight, it is limited to recovering contiguous file data and cannot handle fragmented files. For more comprehensive recovery, tools like PhotoRec or Scalpel may be more appropriate.

Common Commands

foremost image.ddCarve files from an image using the default config, writing to ./output
foremost -i image.dd -o outputExplicitly set the input file and output directory
foremost -t jpg -i image.ddRecover only JPEG files from the image
foremost -t jpg,pdf,doc -i image.dd -o recoveredCarve a comma-separated list of file types into a custom directory
foremost -t all -i image.dd -o outputAttempt to recover every file type known to foremost
foremost -i /dev/sdb -o carvedCarve directly from a raw block device
foremost -v -t png -i image.ddVerbose mode: log all messages to the screen while carving PNGs
foremost -T -t jpg -i image.ddAppend a timestamp to the output directory so it is not overwritten
foremost -c /etc/foremost.conf -i image.ddUse a specific configuration file defining headers/footers
foremost -w -i image.dd -o audit_onlyOnly write the audit.txt file; do not extract files to disk
foremost -a -t jpg -i image.ddWrite all headers and perform no error detection (recover corrupted files)
foremost -q -i image.ddQuick mode: search only on 512-byte boundaries for speed
foremost -Q -i image.dd -o outputQuiet mode: suppress on-screen output messages
foremost -d -i image.ddTurn on indirect block detection (for UNIX file systems)
foremost -b 1024 -i image.ddSet the block size used during the search (default 512)

Step-by-Step Guide

  1. 1Secure a forensic copy of the target storage media
  2. 2Launch the carving process specifying your input image and output directory
  3. 3Navigate to the newly populated output folders
  4. 4Examine the carved files to see what was recovered
  5. 5Log your findings for evidence documentation

Warnings

Use Cases

Deleted File Recovery

Recover files that have been deleted from storage media by carving them based on file signatures.

Disk Image Analysis

Extract files from forensic disk images created with dd or other imaging tools.

Evidence Collection

Salvage files from damaged or corrupted storage media for forensic investigation.

Data Loss Investigation

Recover accidentally lost files from formatted or corrupted partitions.

Key Features

Related Tools

Autopsy

Forensics

Digital forensics platform with comprehensive file analysis and timeline capabilities.

ExifTool

Forensics

Metadata extraction tool for analyzing file properties and timestamps.

Binwalk

Forensics

Firmware analysis and binary extraction tool.

Frequently Asked Questions

What is Foremost used for?

Foremost is a forensic file carving tool used to recover deleted or lost files from disk images based on their headers, footers, and internal data structures. It is commonly used in incident response and digital forensics.

Can Foremost recover fragmented files?

No, Foremost recovers only contiguous file data. Fragmented files may be partially recovered or not recovered at all. For fragmented file recovery, consider tools like PhotoRec or Scalpel.

What file types does Foremost support?

Foremost supports dozens of file types including JPG, GIF, PNG, PDF, DOC, ZIP, RAR, MP3, MP4, ELF, and more. The full list is configurable in the foremost.conf configuration file.

Is Foremost the same as PhotoRec?

Both are file carving tools, but Foremost focuses on header/footer matching while PhotoRec uses a more comprehensive approach including journal-based recovery and filesystem-aware carving.

Tags

#forensics#data-carving#recovery

Output Explanation

Generates a folder structure containing the salvaged files, automatically sorted into subdirectories based on their file extensions.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.