Skip to content

Commit 4fd0f20

Browse files
authored
Merge pull request #1739 from volatilityfoundation/fix_thrdscan_checks
Fix checks in thrdscan that broke tests
2 parents 2ebda44 + 444305a commit 4fd0f20

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

test/plugins/windows/windows.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ def test_windows_generic_thrdscan(self, volatility, python, image):
189189
"windows.thrdscan.ThrdScan", image, volatility, python
190190
)
191191
assert rc == 0
192-
assert out.find(b"\t4\t8") != -1
193-
assert out.find(b"\t4\t12") != -1
194-
assert out.find(b"\t4\t16") != -1
192+
assert out.find(b"\t1812\t2768\t0x7c810856") != -1
193+
assert out.find(b"\t840\t2964\t0x7c810856") != -1
194+
assert out.find(b"\t2536\t2552\t0x7c810856") != -1
195195

196196

197197
class TestWindowsPrivileges:

volatility3/framework/plugins/windows/thrdscan.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ def gather_thread_info(
110110
vollog.debug(f"Thread invalid address {ethread.vol.offset:#x}")
111111
return None
112112

113-
if vads_cache is not None:
113+
# don't look for VADs in kernel threads, just let them get reported with empty paths
114+
if (
115+
owner_proc_pid != 4
116+
and owner_proc.InheritedFromUniqueProcessId != 4
117+
and vads_cache is not None
118+
):
114119
vads = pe_symbols.PESymbols.get_vads_for_process_cache(
115120
vads_cache, owner_proc
116121
)
117-
# no vads = terminated/smeared, pid 4 = kernel = don't check VADs
118-
if (
119-
owner_proc_pid != 4
120-
and owner_proc.InheritedFromUniqueProcessId != 4
121-
and (not vads or len(vads) < 5)
122-
):
122+
if not vads or len(vads) < 5:
123123
vollog.debug(
124-
f"No vads for process at {owner_proc.vol.offset:#x}. Skipping thread at {ethread.vol.offset:#x}"
124+
f"Not enough vads for process at {owner_proc.vol.offset:#x}. Skipping thread at {ethread.vol.offset:#x}"
125125
)
126126
return None
127127

0 commit comments

Comments
 (0)