-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 crypto::cng on Windows 10 x64 1909, 2004, 20H2, 21H2 #362
Conversation
…nericProcessOrServiceFromBuild ; kull_m_patch (0x00000000)) Non-exportable private key export succeeds with crypto::certificates /systemstore:local_machine /export Tested with: Win10 Pro x64 Version 1909 Build 18363.1556 (ncryptprov.dll 10.0.18362.1411) Also works on Win10 Pro x64 Version 2004 Build 19041.804 (ncryptprov.dll 10.0.19041.662)
Anybody has version working for Microsoft Windows [Version 10.0.19044.1526] ? |
…64 to enable non-exportable private key export
…19041.1202), add comments with DLL versions for last 4 Windows builds
This pull request should make crypto::cng work on all the Windows 10 x64 versions in the table below ncryptprov.dll version number was higher on my 20H2 test system than on 21H2 🤷♂️ @scerazy @juxeii grateful if you could test, contact me if you need a compiled mimikatz exe
|
Compiled exe would be appreciated Thanks |
As it was merged, You can find binaries in artifacts: https://ci.appveyor.com/project/gentilkiwi/mimikatz Thank you to @hubert3 for the work :) |
Even with the latest binary, this seems to not work on my installation of Windows 10 20H2. When I run:
I can see that it generates the pfx, however it does not actually contain the private key in it (I know because when I import it, it doesn't exist in the certificate, and also when I use openssl to extract it, it is blank). Also, when I run:
I get a I am using the latest build from AppVeyor. How can I get this to work? |
@sikhness what was the output of running crypto::cng & crypto::capi? Did you run privilege::debug first? It should look like this:
If you are still having an issue, please reply with output of 'version' and 'crypto::certificates' for the item you're trying to export (to confirm your Windows build, type of item and keystore it's using) |
Hi @hubert3,
Here is the output for the
Thanks for your help! |
@sikhness so the item you want to export is definitely using the CNG provider, so crypto::cng is the correct command (crypto::capi is not needed) crypto::cng patching succeeds, so exporting the private key should work What exactly is the output when you run:
On the lines that say Public export and Private export for the specific item? Mimikatz will try to dump everything in that key store so make sure you're looking at the output for the specific item you are interested in (there could be errors from other irrelevant items) If it says Private export : OK - 'blah.pfx' for the cert/key you want then it should have worked - Feel free to contact me by twitter DM if it's not working |
xref #413 because I found this but not that. |
Fix crypto::cng on Windows 10 x64 version 1909
Was failing with error:
ERROR kull_m_patch_genericProcessOrServiceFromBuild ; kull_m_patch (0x00000000))
I found that the version of KeyIso service (ncryptprov.dll) on my Win10 x64 1909 needs the patch sequence defined in PTRN_W10_1809_SPCryptExportKey and the existing definition for KULL_M_WIN_BUILD_10_1909 did not work.
Also added a correct patch definition for build KULL_M_WIN_BUILD_10_2004.
crypto::cng now succeeds on both Win10 x64 1909 and 2004 for me. Non-exportable CNG private key export was successfully tested on 1909 with command crypto::certificates /systemstore:local_machine /export
Tested with Win10 Pro x64 Version 1909 Build 18363.1556 (ncryptprov.dll 10.0.18362.1411)
Also works on Win10 Pro x64 Version 2004 Build 19041.804 (ncryptprov.dll 10.0.19041.662)