Skip to content

Commit 5e654b1

Browse files
committed
added mechanism for deleted exe
1 parent 143062c commit 5e654b1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

volatility3/framework/plugins/linux/process_spoofing.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class ProcessSpoofing(plugins.PluginInterface):
2121
"""Detects process spoofing by comparing executable path to cmdline & comm fields"""
2222

2323
_required_framework_version = (2, 0, 0)
24-
_version = (1, 0, 0)
24+
_version = (1, 1, 0)
25+
deleted = " (deleted)"
2526

2627
@classmethod
2728
def get_requirements(cls):
@@ -64,10 +65,17 @@ def _get_executable_path(
6465
return None
6566

6667
exe_file = mm.exe_file
68+
6769
if not exe_file or not exe_file.is_readable():
6870
return None
71+
72+
exe_inode = exe_file.dereference().f_path.dentry.d_inode
6973
exe_path = linux.LinuxUtilities.path_for_file(self.context, task, exe_file)
7074

75+
# If the inode link count is 0, the process image has been deleted
76+
if exe_inode.i_nlink == 0:
77+
exe_path += self.deleted
78+
7179
return exe_path if exe_path else None
7280

7381
except (exceptions.InvalidAddressException, AttributeError):
@@ -176,6 +184,11 @@ def _detect_spoofing(
176184
1 for name in [exe_basename, cmdline_basename, comm] if name
177185
)
178186

187+
is_deleted = exe_basename.endswith(self.deleted)
188+
if is_deleted:
189+
notes.append(f"'Potential Process image deletion: exe_file={exe_basename}'")
190+
exe_basename = exe_basename[: len(self.deleted) * -1]
191+
179192
if available_sources < 2:
180193
return None
181194

0 commit comments

Comments
 (0)