-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix EOFError in sam plugin on empty lm/nt hash #478
Conversation
@JazzCore thank you for your contribution! As this is your first code contribution, please read the following Contributor License Agreement (CLA). If you agree with the CLA, please reply with the following information:
Contributor License Agreement
Contribution License AgreementThis Contribution License Agreement ("Agreement") governs your Contribution(s) (as defined below) and conveys certain license rights to Fox-IT B.V. ("Fox-IT") for your Contribution(s) to Fox-IT"s open source Dissect project. This Agreement covers any and all Contributions that you ("You" or "Your"), now or in the future, Submit (as defined below) to this project. This Agreement is between Fox-IT B.V. and You and takes effect when you click an “I Accept” button, check box presented with these terms, otherwise accept these terms or, if earlier, when You Submit a Contribution.
|
@@ -388,8 +388,8 @@ def sam(self) -> Iterator[SamRecord]: | |||
u_lmpw = v_data[v.lmpw_ofs : v.lmpw_ofs + v.lmpw_len] | |||
u_ntpw = v_data[v.ntpw_ofs : v.ntpw_ofs + v.ntpw_len] | |||
|
|||
lm_hash = decrypt_single_hash(f.rid, samkey, u_lmpw, almpassword).hex() | |||
nt_hash = decrypt_single_hash(f.rid, samkey, u_ntpw, antpassword).hex() | |||
lm_hash = decrypt_single_hash(f.rid, samkey, u_lmpw, almpassword).hex() if u_lmpw else '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nicer to put something like this in the decrypt_single_hash
function itself:
if not enc_hash:
return b""
That way you don't have to do this if
twice and it's more fault-tolerant for future uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, fixed
9f33dd4
to
0439b61
Compare
@DissectBot agree |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #478 +/- ##
==========================================
- Coverage 73.99% 73.99% -0.01%
==========================================
Files 260 260
Lines 21064 21066 +2
==========================================
+ Hits 15587 15588 +1
- Misses 5477 5478 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Met a strange Win10 machine with account that has LM and NTLM hashes buffers with zero size:
<user_V ... lmpw_ofs=0x1a4, lmpw_len=0x0, unknownc_1=0x0, ntpw_ofs=0x1bc, ntpw_len=0x0, unknownd_1=0x0, unknownd_2=0x1d4, unknownd_3=0x18, unknownd_4=0x0, unknownd_5=0x1ec, unknownd_6=0x18, unknownd_7=0x0, data=b'\x01\x00\x14\x80'>
target-query
throws following exception: