Skip to content

Commit 745e148

Browse files
authored
Merge pull request #1770 from volatilityfoundation/shimcachemem/bugfixes
ShimcacheMem: Various bugfixes
2 parents 4e0beda + 62bd419 commit 745e148

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

volatility3/framework/plugins/windows/shimcachemem.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ def find_shimcache_win_xp(
174174
vad.get_start() + SHIM_NUM_ENTRIES_OFFSET,
175175
)
176176

177+
vollog.debug(f"Found {num_entries} shimcache entries")
178+
177179
if num_entries > SHIM_MAX_ENTRIES:
178180
continue
179181

@@ -204,7 +206,6 @@ def find_shimcache_win_xp(
204206

205207
if physical_addr in seen:
206208
continue
207-
seen.add(physical_addr)
208209

209210
shim_entry = proc_layer.context.object(
210211
shimcache_symbol_table + constants.BANG + "SHIM_CACHE_ENTRY",
@@ -216,6 +217,8 @@ def find_shimcache_win_xp(
216217
if not shim_entry.is_valid():
217218
continue
218219

220+
seen.add(physical_addr)
221+
219222
yield shim_entry
220223

221224
@classmethod

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Dict, Optional, Tuple, Union
99

1010
from volatility3.framework import constants, exceptions, interfaces, objects, renderers
11+
from volatility3.framework.objects.utility import address_to_string
1112
from volatility3.framework.symbols.windows.extensions import conversion
1213

1314
vollog = logging.getLogger(__name__)
@@ -56,12 +57,14 @@ def exec_flag(self) -> Union[bool, interfaces.renderers.BaseAbsentValue]:
5657
blob_offset, blob_size
5758
):
5859
self._exec_flag = renderers.UnparsableValue()
60+
return self._exec_flag
5961

6062
raw_flag = self._context.layers[self.vol.native_layer_name].read(
6163
blob_offset, blob_size
6264
)
6365
if not raw_flag:
6466
self._exec_flag = renderers.UnparsableValue()
67+
return self._exec_flag
6568

6669
try:
6770
self._exec_flag = bool(struct.unpack("<I", raw_flag)[0])
@@ -71,6 +74,7 @@ def exec_flag(self) -> Union[bool, interfaces.renderers.BaseAbsentValue]:
7174
else:
7275
# Always set to true for XP/2K3
7376
self._exec_flag = renderers.NotApplicableValue()
77+
7478
return self._exec_flag
7579

7680
@property
@@ -117,6 +121,8 @@ def last_update(self) -> Union[datetime, interfaces.renderers.BaseAbsentValue]:
117121
)
118122
except AttributeError:
119123
self._last_updated = renderers.NotApplicableValue()
124+
except exceptions.InvalidAddressException:
125+
self._last_updated = renderers.UnreadableValue()
120126

121127
return self._last_updated
122128

@@ -126,8 +132,12 @@ def file_path(self) -> Union[str, interfaces.renderers.BaseAbsentValue]:
126132
return self._file_path
127133

128134
if not hasattr(self.Path, "Buffer"):
129-
return self.Path.cast(
130-
"string", max_length=self.Path.vol.count, encoding="utf-16le"
135+
return address_to_string(
136+
self._context,
137+
self.Path.vol.layer_name,
138+
self.Path.vol.offset,
139+
self.Path.vol.count,
140+
encoding="utf-16le",
131141
)
132142

133143
try:

volatility3/framework/symbols/windows/shimcache/shimcache-xp-sp2-x86.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,23 +331,23 @@
331331
"LastModified": {
332332
"type": {
333333
"kind": "union",
334-
"name": "LARGE_INTEGER"
334+
"name": "_LARGE_INTEGER"
335335
},
336-
"offset": 4
336+
"offset": 528
337337
},
338338
"FileSize": {
339339
"type": {
340340
"kind": "base",
341341
"name": "long long"
342342
},
343-
"offset": 8
343+
"offset": 536
344344
},
345345
"LastUpdate": {
346346
"type": {
347347
"kind": "union",
348-
"name": "LARGE_INTEGER"
348+
"name": "_LARGE_INTEGER"
349349
},
350-
"offset": 12
350+
"offset": 544
351351
}
352352
},
353353
"kind": "struct",

0 commit comments

Comments
 (0)