Skip to content

Add optional read length/overrun parameter on Values#86

Merged
williballenthin merged 2 commits intowilliballenthin:masterfrom
jtang613:master
Dec 30, 2018
Merged

Add optional read length/overrun parameter on Values#86
williballenthin merged 2 commits intowilliballenthin:masterfrom
jtang613:master

Conversation

@jtang613
Copy link
Contributor

This optional parameter allows reading back arbitrary length data from a Value, including overrunning the current data length. This is useful for forensic analysis applications that may wish to examine overwritten key data. Values are non-truncating, thus will preserve old data in the slack space if overwritten by a smaller length value.

Copy link
Owner

@williballenthin williballenthin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the idea of this PR. it does seem to provide forensic value without making the code much more complex. looking forward to hearing about what you discover!

i've made some minor requests about code style, otherwise, good to go!

@jtang613
Copy link
Contributor Author

I've already had success using this technique. A client system was found to have a backdoor: C:\Windows\cfmon.bat and the slack space contained evidence of a second, previous backdoor: C:\Windows\cmdacobin\RE[B]ell.bat
C:\Windows\cfmon.bat <- sethc.exe registry key contained
C:\Windows\cmdacobin\RE[B]ell.bat <- file on disk
RE[B]ell.bat <- sethc.exe registry slack space contained

Copy link
Owner

@williballenthin williballenthin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thank you!

return decode_utf16le(d)
if overrun > 0:
# decode_utf16le() only returns the first string, but if we explicitly
# ask for overrun, let's make a best-effort to decode as much as possible.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent explanation, thanks!

@williballenthin williballenthin merged commit cc57cbc into williballenthin:master Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants