Ghost in the file system
Ghost-fs to protect and hide your secrets files
Last updated
Ghost-fs to protect and hide your secrets files
Last updated
Casper-fs is a custom Linux Kernel Module generator to work with resources to protect or hide a custom list of files. Each LKM has resources to protect or hide files following a custom list in the YAML rule file. Yes, not even the root has permission to see the files or make actions like edit and remove. The files only can be caught, edited, and deleted if the user sends a proper key to the custom device to liberate the action in the file system.
The first point, the user sends input to the Casper-FS the YAML file with rules to generate a custom LKM(Linux kernel module). Each generated module works in the file system to protect and hide secret files (Not even the root has permission to see the file, it only can view it with a proper sending key to the custom device). This program has two principal functions: turning private files hidden. The second function is to protect confidential files to prevent reading, writing and removal.
The motivation: An attacker can read every file in your machine in a bad situation(if he got root). But if you have a Casper-fs custom module, the attacker will not find the hidden kernel module that has functions to protect your private data files, such as logs and password vaults.
My beginning purpose in this project is to protect my server, which is to protect my friends' machines. When I talk to friends, I say peoples that don't know how to write low-level code. Using the Casper-fs, you can generate your custom kernel module to protect your secret files. The low-level programmer can write new templates for modules etc.
Tool to interpret YAML file and generate a C language file "Linux kernel module".
YAML context is a white screen to create your custom module in kernel land. Yes is not hard when you use Casper-fs.
The resource to generate the hidden kernel module, yes, is invisible; not even the root user can see it.
The resource to turn the Linux kernel module visible, passing a key to enable the context.
The resource to turn any file into a file system is invisible(not even the root can see it).
The resource to turn to visible any invisible file.
The resource to protect any file in the file system to prevent writing and removal.
The resource to unprotect any file writing and remove proper permission.
Persistence recipes with scripts to always up Casper-fs when you boot the system.
Communication by device char (different from other Rootkits that use signal and ioctl)
Static random junk code injection in the generated LKM turns each binary signature unique during the compilation.
Verify if the kernel version is 3.x, 4.x, or 5.x:
Clone the repository
Enter the folder and install python3 modules:
Edit your file rules in directory module_generator/rules/fs-rules.yaml, the python scripts, use that file to generate a new casper-fs custom module.
The array is hidden and array protected. You can insert a lot of the elements of another file on context, for example:
If you want to study the static code to generate, look at the directory "templates" content.
If you want to generate a kernel module following your YAML file of rules, follow that command:
This action can generate a generic module with the fs-rules.yaml.
If you use Fedora Linux, install kernel packages for the developer:
On Ubuntu Linux:
To test module:
The password to turn casper-fs module visible for lsmod is the key "Shazam".
The password to turn the casper-fs invisible is "AbraKadabra".
The password to turn the secret files in hidden is "Alakazam", the same to turn to unhidden.
The password to protect files or unprotect is "Sesame".
You need to send the password for your fake device, "usb15" for example, to test hidden and unhidden resources on the file system:
So this is an example of trying to remove a protected file by Casper-fs:
Note You need to turn casperfs visible at the "lsmod" command. Need this action before removing module
Tested on ubuntu 16 and fedora 29 at kernels "3.x","4.x" and "5.x".
Follow this tip for more information: https://github.com/CoolerVoid/casper-fs/blob/main/module_generator/scripts/README.md
This tool aims to use in the hardening system context. Pay attention if you have proper authorization before using that. I do not have responsibility for your actions. You can use a hammer to construct a house or destroy it, choose the law path, don't be a bad guy, remember.
Wikipedia Netfilter https://en.wikipedia.org/wiki/Netfilter
Linux Device Drivers http://lwn.net/Kernel/LDD3/
M0nad's Diamorphine https://github.com/m0nad/Diamorphine/
Thank you for reading.
Cheers!