Skip to content

Commit 6803bf3

Browse files
authored
Merge pull request #1249 from volatilityfoundation/mft_size_smear_fix
Mft size smear fix
2 parents a40ac64 + 9c05893 commit 6803bf3

File tree

1 file changed

+20
-2
lines changed
  • volatility3/framework/symbols/windows/extensions

1 file changed

+20
-2
lines changed

volatility3/framework/symbols/windows/extensions/mft.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
33
#
44

5+
from typing import Optional
6+
57
from volatility3.framework import objects, constants, exceptions
68

79

@@ -26,7 +28,15 @@ def get_full_name(self) -> str:
2628
class MFTAttribute(objects.StructType):
2729
"""This represents an MFT ATTRIBUTE"""
2830

29-
def get_resident_filename(self) -> str:
31+
def get_resident_filename(self) -> Optional[str]:
32+
# 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
33+
# Length as 512 as its 256*2, which is the maximum size for an entire file path, so this is even generous
34+
if (
35+
self.Attr_Header.ContentOffset > 0x400000
36+
or self.Attr_Header.NameLength > 512
37+
):
38+
return None
39+
3040
# To get the resident name, we jump to relative name offset and read name length * 2 bytes of data
3141
try:
3242
name = self._context.object(
@@ -41,7 +51,15 @@ def get_resident_filename(self) -> str:
4151
except exceptions.InvalidAddressException:
4252
return None
4353

44-
def get_resident_filecontent(self) -> bytes:
54+
def get_resident_filecontent(self) -> Optional[bytes]:
55+
# smear observed in mass testing of samples
56+
# 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
57+
if (
58+
self.Attr_Header.ContentOffset > 0x400000
59+
or self.Attr_Header.ContentLength > 0x400000
60+
):
61+
return None
62+
4563
# To get the resident content, we jump to relative content offset and read name length * 2 bytes of data
4664
try:
4765
bytesobj = self._context.object(

0 commit comments

Comments
 (0)