Skip to content

Commit

Permalink
Add None checks around read_sid (#989)
Browse files Browse the repository at this point in the history
JSCU-CNI authored Jan 15, 2025
1 parent 3df28eb commit bc0b9b8
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dissect/target/plugins/os/windows/credential/credhist.py
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ def _parse(self) -> Iterator[CredHistEntry]:
yield CredHistEntry(
version=entry.dwVersion,
guid=UUID(bytes_le=entry.guidLink),
user_sid=read_sid(entry.pSid),
user_sid=read_sid(entry.pSid) if entry.pSid else None,
hash_alg=HashAlgorithm.from_id(entry.algHash),
cipher_alg=cipher_alg,
sha1=None,
3 changes: 2 additions & 1 deletion dissect/target/plugins/os/windows/generic.py
Original file line number Diff line number Diff line change
@@ -611,11 +611,12 @@ def sid(self) -> Iterator[ComputerSidRecord]:

try:
key = self.target.registry.key("HKLM\\SECURITY\\Policy\\PolMachineAccountS")
raw_sid = key.value("(Default)").value

yield ComputerSidRecord(
ts=key.timestamp,
sidtype="Domain",
sid=read_sid(key.value("(Default)").value),
sid=read_sid(raw_sid) if raw_sid else None,
_target=self.target,
)
except (RegistryError, struct.error):

0 comments on commit bc0b9b8

Please sign in to comment.