Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit a55be9c

Browse files
author
Oliver Old
authored
Add fix for missing cookie value when using a Windows 10 profile
Use YARA and the DiscontigYaraScanner from malfind to find the address of nt!ObGetObjectType. This fix only applies to 64-bit profiles since I don't have the signature for 32-bit Windows.
1 parent 5f685e5 commit a55be9c

File tree

1 file changed

+28
-4
lines changed
  • volatility/plugins/overlays/windows

1 file changed

+28
-4
lines changed

volatility/plugins/overlays/windows/win10.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
except ImportError:
4040
has_distorm = False
4141

42+
try:
43+
import yara
44+
import volatility.plugins.malware.malfind as malfind
45+
has_yara = True
46+
except ImportError:
47+
has_yara = False
48+
4249
class _HMAP_ENTRY(obj.CType):
4350

4451
@property
@@ -212,10 +219,28 @@ def findcookie(self, kernel_space):
212219
debug.warning("Cannot find NT module")
213220
return False
214221

222+
model = meta.get("memory_model")
223+
215224
addr = nt_mod.getprocaddress("ObGetObjectType")
216225
if addr == None:
217-
debug.warning("Cannot find nt!ObGetObjectType")
218-
return False
226+
if not has_yara or model == "32bit":
227+
debug.warning("Cannot find nt!ObGetObjectType")
228+
return False
229+
# Did not find nt!ObGetObjectType, trying with YARA instead.
230+
# TODO: Need signature for 32-bit.
231+
s = "48 8D 41 D0 0F B6 49 E8"
232+
rules = yara.compile(sources = {
233+
'n': 'rule r1 {strings: $a = {' + s + '} condition: $a}'
234+
})
235+
scanner = malfind.DiscontigYaraScanner(
236+
address_space = kernel_space,
237+
rules = rules)
238+
first_match = next(scanner.scan(), None)
239+
if not first_match:
240+
debug.warning("Cannot find nt!ObGetObjectType")
241+
return False
242+
_, addr = first_match
243+
addr -= nt_mod.DllBase
219244

220245
# produce an absolute address by adding the DLL base to the RVA
221246
addr += nt_mod.DllBase
@@ -224,7 +249,6 @@ def findcookie(self, kernel_space):
224249
return False
225250

226251
# in theory...but so far we haven't tested 32-bits
227-
model = meta.get("memory_model")
228252
if model == "32bit":
229253
mode = distorm3.Decode32Bits
230254
else:
@@ -1120,4 +1144,4 @@ class Win10x64_18362(obj.Profile):
11201144
_md_minor = 4
11211145
_md_build = 18362
11221146
_md_vtype_module = 'volatility.plugins.overlays.windows.win10_x64_18362_vtypes'
1123-
_md_product = ["NtProductWinNt"]
1147+
_md_product = ["NtProductWinNt"]

0 commit comments

Comments
 (0)