Skip to content

Commit 660e8a7

Browse files
committed
Add smear checks in MFT parsing code
1 parent 483cb7e commit 660e8a7

File tree

1 file changed

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

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class MFTAttribute(objects.StructType):
2929
def get_resident_filename(self) -> str:
3030
# 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
3131
# Length as 512 as its 256*2, which is the maximum size for an entire file path, so this is even generous
32-
if self.Attr_Header.ContentOffset > 4194304 or self.Attr_Header.NameLength > 512:
32+
if (
33+
self.Attr_Header.ContentOffset > 4194304
34+
or self.Attr_Header.NameLength > 512
35+
):
3336
return None
3437

3538
# To get the resident name, we jump to relative name offset and read name length * 2 bytes of data
@@ -49,7 +52,10 @@ def get_resident_filename(self) -> str:
4952
def get_resident_filecontent(self) -> bytes:
5053
# smear observed in mass testing of samples
5154
# 4MB chosen as cutoff instead of 4KB to allow for recovery from format /L created file systems
52-
if self.Attr_Header.ContentOffset > 4194304 or self.Attr_Header.ContentLength > 4194304:
55+
if (
56+
self.Attr_Header.ContentOffset > 4194304
57+
or self.Attr_Header.ContentLength > 4194304
58+
):
5359
return None
5460

5561
# To get the resident content, we jump to relative content offset and read name length * 2 bytes of data

0 commit comments

Comments
 (0)