-
Notifications
You must be signed in to change notification settings - Fork 15
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
Improve credssp credentials handling #173
Conversation
955325d
to
f4cf01e
Compare
ffi/src/sec_winnt_auth_identity.rs
Outdated
use windows_sys::Win32::Security::Authentication::Identity::SspiIsAuthIdentityEncrypted; | ||
use winapi::um::wincred::{CredUIPromptForWindowsCredentialsW, CREDUI_INFOW}; |
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.
Note that the winapi
crate is abandoned, and we should only use the windows
crate from now on
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.
done
Should we create an issue (task) to replace all winapi
usage with the windows crate?
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.
Because we have a lot of winapi
crate usage
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.
Yes, you are right 👍
Do you think you could open this issue?
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.
yes, I can do it
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.
Do you think you could open this issue?
8610f84
to
5d971fa
Compare
Hi, I wrote a fix for the #152 issue.
When we try to connect using the
mstsc
we have two options for the source of the credentials: enter them manually ormstsc
will use the saved credentials. Themstsc
passes theCredsspSubmitBufferBothOld
(51) only when we try to log in using the saved credentials. Moreover, it also sets thecredssp_cred.p_spnego_cred
pointer to NULL. So, in this case, we don't even have any actual credentials to use.Why we can't read the saved creds:
Because they are saved as
CRED_TYPE_DOMAIN_PASSWORD
. If we try to read them using theCredRead
function then we'll get an empty password blob (even when the function succeeded)."The credentials exposed here do not have to be manipulated in user applications, but by the Windows authentication manager ( LSASS), so there is no reason for them to be accessible in the user area." (src)
"Also, for CRED_TYPE_DOMAIN_PASSWORD, this member can only be read by the authentication packages." (src)
Workaround:
The TSSSP security package is supported only in Windows. So, we can just ask the user to re-enter the credentials and then use them for the authentication. This is what I've implemented in this fix.
Doc & references:
closes #152