Maintaining the chain of custody for digital evidence is a critical challenge in forensic investigations, particularly in ensuring the confidentiality, integrity, and availability of the evidence. This research aims to present a proof of concept demonstrating that a disk storage device can accurately track its usage while preserving the confidentiality of sensitive information, maintaining the integrity of the evidence, and ensuring its availability for analysis. The proposed solution seeks to strengthen the reliability and security of digital forensic processes.
Raspberry Pi (tested on Raspberry Pi Zero 2W)
Raspberry Pi OS Python 3.11 or higher
- Download Raspberry Pi Imager.
- Select your Hardware: Choose
Raspberry Pi Zero 2W - Select OS: Choose
Raspberry Pi OS (64-bit) - Select your MicroSD Card:
- Ensure a minimum of 32GB capacity
- In Advanced Options, Enable SSH and connect it to a hotspot or home network. Set a username and password.
- Flash the Image to your microSD card and insert it into the Pi.
- Boot the Raspberry Pi and identify its IP address through your router or hotspot settings.
ssh pi@<ip_address>
sudo apt update -y && sudo apt dist-upgrade -y && sudo apt upgrade -y && sudo apt full-upgrade -y && sudo apt autoremove -y
- Install Required Dependencies for the project:
sudo apt install python3 python3-venv isc-dhcp-server -y
- Edit the file:
sudo nano /boot/firmware/config.txt
- Update the following:
max_framebuffer=2
dtoverlay=dwc2
- Edit the file:
sudo nano /etc/modules-load.d/modules.conf
- Add the following:
i2c-dev
dwc2
libcomposite
- Reboot the Raspberry Pi:
sudo reboot
- Clone the Repository
git clone https://github.com/nicsng/COC-USB.git
cd COC-USB
- Set Up the Virtual Environment:
python3 -m venv websocket-env
source websocket-env/bin/activate
- Install Dependencies
pip install -r requirements.txt
- Copy files from the repo into their respective folders Windows
sudo cp windows/composite_usb /usr/bin/composite_usb
sudo cp windows/ctf_gadget.service /etc/systemd/system/ctf_gadget.service
sudo cp windows/ctf_gadget2.service /etc/systemd/system/ctf_gadget2.service
Linux
sudo cp linux/composite_usb /usr/bin/composite_usb
sudo cp linux/ctf_gadget.service /etc/systemd/system/ctf_gadget.service
sudo cp linux/ctf_gadget2.service /etc/systemd/system/ctf_gadget2.service
- Configure
rc.local - Edit
/etc/rc.local
sudo nano /etc/rc.local
- Add the following before
Exit 0
/usr/bin/composite_usb
- Edit /etc/dhcp/dhcpd.conf:
sudo nano /etc/dhcp/dhcpd.conf
- Add:
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.2 10.0.0.10;
option routers 10.0.0.1;
}
- Edit
/etc/default/isc-dhcp-server
sudo nano /etc/default/isc-dhcp-server
- Update:
INTERFACESv4="usb0"
- Restart DHCP Server:
sudo systemctl restart isc-dhcp-server.service
Step 9.1: Create and Format the Image
- Create the CTF_Gadget directory:
mkdir /home/pi/CTF_Gadget/
- Create the disk image file:
sudo dd if=/dev/zero of=/home/pi/CTF_Gadget/usbdisk.img bs=1M count=3072
- Attach the image as a loop device:
sudo losetup -fP /home/pi/CTF_Gadget/usbdisk.img
- Format the image as FAT32:
sudo mkfs.vfat -F 32 /dev/loop0
- Detach the loop device:
sudo losetup -d /dev/loop0
-
Reboot the Raspberry Pi:
sudo reboot
-
Test the gadget functionality by connecting the Pi to a host device and ensuring it operates as intended.
-
Select Your Hardware Choose Raspberry Pi Zero 2W.
-
Download the Operating System you are targeting For Windows or Linux, select "Custom OS" and download the required OS.
Windows | Linux -
Select Your microSD Card Insert and choose the correct microSD card.
-
Flash the OS Flash the downloaded OS image to the microSD card.