Adding regsecrets and dpapidump #1898
Open
+1,721
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello there, this PR includes two different scripts.
regsecrets.py
:This script is a modification of
secretsdump.py
that uses a different technique to extract registry secrets (the logic regarding DCSync operations has been removed). It does not write files on the disk and does not performreg save
like operations. This allow recovering the SAM database and the LSA secrets while being less prone to detection by security product.All required keys are accessed using registry queries. To access keys within the SAM and SECURITY hives, the
dwOption
ofBaseRegOpenKey
allows passing theREG_OPTION_BACKUP_RESTORE
value to disable any ACL checks performed, thus, allowing to access these registry keys normally restricted to the SYSTEM user.One may wonder why not integrating these changes in the original
secretsdump.py
. From my point view, the original script already integrates a high number of cases and I was afraid of making its logic even more bloated than its currently is, making testing of every case very complicated and increasing the risk of bugs. However, if the maintaining team thinks it's better to integrate this new extraction logic into the original script, I could give it a go.dpapidump.py
:This script is basically a copy of the
SystemDPAPIdump.py
from @clavoillotte in #1137 that integrates the extraction of secrets fromregsecrets.py
while integrating other small modifications:virtualapp/didlogical
, this credential has always the same file name and does not contain useful information security wise.