USB Stick that can conceal and encrypt its partitions. The project is 100% student work.
The project meets all goals and fully operational. However, during the development was proposed improvements that were not implemented. We recommend to visit category Future Improvements.
Student: Oleksandr Borysov
Project Name: USB Flash Drive with possibility to conceal information (Double Bottom USB Stick)
Organization: Portland State University
Mentor: Keith Packard
Most of the work was done in the files sd_io_controller.* and user_interface.*
The main goal of the project is the creation of USB Flash Drive with the possibility to conceal the fact that the flash drive contains hidden information. It means that hidden folders and files will not be displayed if the USB drive is connected to computer. The microcontroller of the Double Bottom USB Stick will carry the process of encryption and concealment of files and folders.
The only possibility to break protection is physically read a memory from the memory component and breaking the encryption algorithm.
- Download and install ST-Link;
- Download and install TRUEStudio;
- Download and install STM32CubeMX v4.18;
- Clone the project or download zip file;
- Open CubeMX project file
Double_Bottom_USB_Stick.ioc
; - Generate STM source code (Button with Gear);
- Open the project in the command prompt;
- Execute command:
git apply --reject --whitespace=fix Patch-for-STM-files.patch
; - Delete the directory
Double_Bottom_USB_Stick\Middlewares\Third_Party\FatFs\src\drivers
in the project; - Open TRUEStudio. Select File -> Import... -> General -> Existing Project into Workspace -> Press "Next >" button -> Browse to the project folder -> Select "Double_Bottom_USB_Stick" in the Project window -> Press "Finish";
- Connect the board to the PC;
- Select in the project explorer one of the project's files and press "Debug" (Button with Green bug)
- Test board is NUCLEO STM32F446RE;
- SDIO Micro SD Card reader module;
- FS USB 2.0 cable;
- Micro SD 4 GB class 4, HC;
- A large part of the project generated with help of STM32CubeMX v4.18 Firmware v1.14 (Cube project file);
- TRUEStudio was used for the project development;
- Dependiaces: SDIO intarface, FS USB 2.0 Mass Storage Device intaface, FatFS
The logic behind the device is to represent a part of SD Card memory as the solid memory of the device (Double Bottom USB Stick). The project present itself as regular USB Mass Storage Device (USB 2.0 Stick) and currently visible partition memory represents as USB Stick memory to the host. Zero partition is always public because this partition displays when the device physically connected to the host. Also, this partition will be demonstrated to the user if connect SD Card without the device to the host. The partitions divided into two categories: public and private. The private partitions are encrypted/decrypted by XOR cipher on the fly using the partition key. The device configurations encryption/decryption by AES cipher at the saving/loading configurations to/from the SD Card using the root key.
Currently, the device supports four commands:
- Initializes device default configurations (
InitConf - INIT_DEVICE_CONFIGURATIONS
) - Changes currently visible partition (
ChangePart - CHANGE_PARTITION
) - Shows device configurations (
ShowConf - SHOW_ROOT_CONFIGURATIONS
) - Updates device configurations (
UpdateConf - UPDATE_ROOT_CONFIGURATIONS
)
Create a file with name COMMAND_.TXT - COMMAND_FILE_NAME
in the root directory of the device and fill it with the following text.
InitConf
[Device Unique ID - DEVICE_UNIQUE_ID]
// Empty line
If device ID is correct then the command file will be deleted and the device will reconnect to the host, if ID or command not correct no action will be executed.
Create a file with name COMMAND_.TXT - COMMAND_FILE_NAME
in the root directory of the device and fill it with the following text.
ChangePart
[Device root key]
[Partition name] [Partition key]
// Empty line
If root key, partition key and partition name are correct then the command file will be deleted and the device will reconnect to the host and switch the currently visible partition. If root key not correct no action will be executed. If the partition name or key is incorrect then the command file will be renamed to COMMAND_FILE_NAME_FAILED - COMMANDF.TXT
(If the partition is public then You should write "public" as partition key).
Create a file with name COMMAND_.TXT - COMMAND_FILE_NAME
in the root directory of the device and fill it with the following text.
ShowConf
[Device root key]
[Configurations key]
// Empty line
If device root key and configuration key are correct then the command file will be deleted and the device will reconnect to the host and will create a file DEVICE_CONFIGS - CONFIGS_.TXT
with the device configurations. If the root key or configuration key is not correct then no action will be executed.
Create a file with name COMMAND_.TXT - COMMAND_FILE_NAME
in the root directory of the device and fill it with the following text.
UpdateConf
[Device root key]
[Configurations key]
[New configurations key] <--- Key for revealing device configurations
[New device root key] <--- Root Key of the device
#N___________Name___________Key___________Number of sectors
0 part0 public 3872257
1 part1 part1Key 3870000
2 part2 part2Key 2000
3 part3 part3Key 253
[New partition number] [New partition name] [New partition key] [New partition memory size]
-------------SD card available memory-------------
3965190144 <- Card capacity memory
512 <- Card block size
7744510 <- Card block sector number
// Empty line
Note: if write "public" as [New partition key] the partition will be public. Also you can delete partitions as well (Just delete it from the update configuration file).
If device root key and configuration key are correct the command file will be deleted and the device will reconnect to the host and the device configurations will be updated, also the currently visible partition will be switched to partition 0. If the root key or configuration key is not correct then no action will be executed. If update operation fails with error the command file will be renamed to COMMAND_FILE_NAME_FAILED - COMMANDF.TXT
.
Note 1: Any commands that failed with an error during execution will rename the command file to COMMAND_FILE_NAME_FAILED - COMMANDF.TXT
.
Note 2: The project has constants that created for debug mode DEBUG_MOD
and CIPHER_MOD
(Constans change behavior of the device)
At this moment each partition part of SD Card memory is allocated as a solid piece. This approach would be acceptable if the project used AES encryption for the partition but due to its performance costs the device uses XOR cipher. That is why spreading the memory of each partition across the SD Card memory will increase the level of data protection. Also, the logic BEHIND forming long XOR key must be more complex to increase XOR cipher reliability.
The project issues contains useful information related to the project.