-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Volatility2's linux_recover_filesystem
capabilities to linux.pagecache
plugin
#1468
Comments
Attributes are really hard for a couple reasons, such as:
The best option would be to write a metadata file with all the permissions that the plugin knows how to parse. |
These are valid points, the metadata file could simply be plugin's stdout, allowing users to save it as Files should be assigned R permissions only (analysts should copy files before modifying them if needed), no SUID or X bits, like you pointed out. Timestamps should also be set to the current time of extraction, giving full power to the "metadata file" for this, preventing crazy smear timestamps on disk. I will work on it if no one else is available currently. Anyone, please feel free to share ideas to enhance its relevance :) |
Another thing to consider is that you will definitely run into file path length restrictions when trying to preserve directory structure. This plagues basically every forensics/IR software. For example, NTFS is limited to 255 characters total in a file path. So then you will have where the analyst does:
pointing to their NTFS formatted external drive or it can be someone running Vol3 from Windows and saving to somewhere under their
We could do a mix where people run this new plugin to get the full directory structure listed, along with the detailed metadata of every file, and then explore with grep or sqlite explorer or anything else.. then for files of interest, they use the current Thoughts on the dual approach? I am definitely open to all suggestions and not trying to shut the idea down - just trying to avoid a bunch of inevitable headaches for you. |
I think the dual approach loses the initial benefit of having not to manually extract everything (making file exploration tedious). Instead of dealing with host filesystem, I though of approaching the directory problem with an ISO. There is a Python library out there named I made a small initial PoC: try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO
# pip3 install pycdlib
import pycdlib
# https://clalancette.github.io/pycdlib/example-creating-udf-iso.html
iso = pycdlib.PyCdlib()
iso.new(udf='2.60')
PATH_MAX = 4096
NAME_MAX = 255
# Directory and file to add
dir_path = ""
# TEST MAX LENGTH
# Create a "/<A*NAME_MAX>/<B*NAME_MAX>/<A*NAME_MAX>" etc. directory path
for i in range(0, PATH_MAX//(NAME_MAX+1)):
dir_path += "/" + chr(65 + i%2)*(NAME_MAX-1)
# Create (sub-)directories iteratively, as it is not supported by default in pycdlib
path_parts = dir_path.strip('/').split('/')
current_path = ''
for part in path_parts:
current_path += '/' + part
iso.add_directory(udf_path=current_path)
# Add a file at the deepest level
foo_content = b'foo\n'
file_path = current_path + '/testfile.txt'
iso.add_fp(BytesIO(foo_content), len(foo_content), udf_path=file_path)
# Write and close the ISO
iso.write('new.iso')
iso.close() This will abort if a file name exceeds the What do you think about it @atcuno (@gcmoreira maybe, as you worked on the pagecache) ? Of course, we would have to do some sanity checks, but everything else will be handled by the software opening the ISO, which should be able to handle and backup edge cases ? |
So what happens with file paths over 255? it just doesn't add them or does it work with them? |
The Python module raises an exception (not added to the ISO), so you have to catch it and decide what to do (skip with a debug message for example). A file path over 255 mostly indicates memory smear, as it is a limitation on ext2/3/4. |
Ah I see, so the the 255 limit is solely within the ISO and the ISO path doesn't take up any characters towards the 255? |
Yes, the module will refuse to create a file in the ISO with a name longer than 255. This only applies to name parts, as |
We could generate a tarball, using the Python standard tarfile module, which I think supports everything you mentioned, permissions, links, etc. It supports raw or gzip, bzip2 and xz compression |
Good point, and it doesn't require additional imports. I found out:
ISO mounting inherits path lengths limit from the host system, and from the early tests it won't block entire archive content because of one "problematic" element. The FS will be simply mounted to a disk letter and that's it (+ robust read-only). I was also able to mount an ISO with very long paths on Windows (disregarding Windows limits) when a Of course, we could restrict to a certain path length, but this could be leveraged to prevent certain files from being extracted by creating path lengths greater than 4096 ? |
Got a first plugin PoC, which dumps I'd be happy to hear if anyone has a solution to circumvent the The major downside of the ISO way is the external dependency needed, apart from this it is in my sense a good candidate to solve the problem expressed by atcuno. In fact, it seems that the host filesystem restrictions doesn't apply as we aren't technically writing the file (virtual filesystem representation). edit: A tool named |
It would be awesome to integrate capabilities from https://github.com/volatilityfoundation/volatility/blob/master/volatility/plugins/linux/recover_filesystem.py into the
pagecache
extraction and parsing system.The following user parameters could be added as well:
.trunc
at the end of impacted files on diskIdeas:
/forensics/vol3_output/dumped_fs/symlink_to_etc_passwd
points to host's/etc/passwd
instead of/forensics/vol3_output/dumped_fs/etc/passwd
)The text was updated successfully, but these errors were encountered: