Closed smashery closed 4 days ago
So I looked into this and I think the root cause is actually that our definition for the structure is incorrect because it doesn't take the following into account:
When there are zero USER_PROPERTY elements in the UserProperties field, this field MUST be omitted; the resultant USER_PROPERTIES structure has a constant size of 0x6F bytes.
I proposed a fix for this in rapid7/ruby_smb#280. I think with that in place, the array will just be empty and the IOError should no longer be raised.
Yeah, that's a much cleaner solution I think - closing this one.
This fixes an issue in the
windows_secrets_dump
module, wherein it fails after certain password change APIs.To reproduce this issue (and verify the fix):
changepasswd.py -reset -newpass Pass123123$ domain/user@192.168.1.1 -altuser administrator -altpass Password1!
windows_secrets_dump
module with appropriate credentials:This occurs because the particular API being used there clears the Kerberos keys. Then, when it tries to parse the
UserProperties
object, it's not of the right structure. The value we receive in thesupplementalCredentials
lookup is something like:b'\x00\x00\x00\x00b\x00\x00\x00\x00\x00\x00\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00P\x00\x00'
. I have no idea what this is. MSDN doesn't seem to help us either - the docs (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/0705f888-62e1-4a4c-bac0-b4d427f396f8) don't mention anything about alternative structures.Impacket's
secretsdump.py
just catches a parse exception and moves on with its life: https://github.com/fortra/impacket/blob/835e17550b57606ee3c681ae1c3f0edea096ec19/impacket/examples/secretsdump.py#L2275-L2278With this fix, I do similar - catch the parse error, add a verbose warning message.