Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion volatility3/framework/plugins/linux/elfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _generator(self, tasks):
name,
format_hints.Hex(vma.vm_start),
format_hints.Hex(vma.vm_end),
path,
path or renderers.NotAvailableValue(),
file_output,
),
)
Expand Down
11 changes: 5 additions & 6 deletions volatility3/framework/plugins/linux/malfind.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ def _list_injections(self, task):
vollog.debug(
f"Injections : processing PID {task.pid} : VMA {vma_name} : {hex(vma.vm_start)}-{hex(vma.vm_end)}"
)
if (
vma.is_suspicious(proc_layer)
and vma.get_name(self.context, task) != "[vdso]"
):
if vma.is_suspicious(proc_layer) and vma_name != "[vdso]":
data = proc_layer.read(vma.vm_start, 64, pad=True)
yield vma, data
yield vma, vma_name, data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an internal/non-exposed function, so this change is fine, but could we get a return type in the function signature please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


def _generator(self, tasks):
# determine if we're on a 32 or 64 bit kernel
Expand All @@ -71,7 +68,7 @@ def _generator(self, tasks):
for task in tasks:
process_name = utility.array_to_string(task.comm)

for vma, data in self._list_injections(task):
for vma, vma_name, data in self._list_injections(task):
if is_32bit_arch:
architecture = "intel"
else:
Expand All @@ -88,6 +85,7 @@ def _generator(self, tasks):
process_name,
format_hints.Hex(vma.vm_start),
format_hints.Hex(vma.vm_end),
vma_name or renderers.NotAvailableValue(),
vma.get_protection(),
format_hints.HexBytes(data),
disasm,
Expand All @@ -103,6 +101,7 @@ def run(self):
("Process", str),
("Start", format_hints.Hex),
("End", format_hints.Hex),
("Path", str),
("Protection", str),
("Hexdump", format_hints.HexBytes),
("Disasm", interfaces.renderers.Disassembly),
Expand Down
2 changes: 1 addition & 1 deletion volatility3/framework/plugins/linux/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def vma_filter_function(x: interfaces.objects.ObjectInterface) -> bool:
major,
minor,
inode_num,
path,
path or renderers.NotAvailableValue(),
file_output,
),
)
Expand Down
8 changes: 7 additions & 1 deletion volatility3/framework/symbols/linux/extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ def get_page_offset(self) -> int:
parent_layer = self._context.layers[self.vol.layer_name]
return self.vm_pgoff << parent_layer.page_shift

def get_name(self, context, task):
def _do_get_name(self, context, task) -> str:
if self.vm_file != 0:
fname = linux.LinuxUtilities.path_for_file(context, task, self.vm_file)
elif self.vm_start <= task.mm.start_brk and self.vm_end >= task.mm.brk:
Expand All @@ -1072,6 +1072,12 @@ def get_name(self, context, task):
fname = "Anonymous Mapping"
return fname

def get_name(self, context, task) -> Optional[str]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there wasn't a return type defined, so theoretically you could make a case for it being ok, but I'd at least bump the PATCH number, so we know that changes were made and be able to differentiate if strange things start being reported please. Hopefully this is in line to be moved to its own separate module in the same style as the ftrace stuff at some point...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok where do I bump the PATCH number for this for now?

try:
return self._do_get_name(context, task)
except exceptions.InvalidAddressException:
return None

# used by malfind
def is_suspicious(self, proclayer=None):
ret = False
Expand Down
Loading