We help IT Professionals succeed at work.

Security Concern | WMI Connection to Remote Computer

seshuakella
seshuakella asked
on
Hi Experts,

Please help me understand how the authentication happens when I invoke a WMI connection on remote computer using User Credentials. I am expecting WMI to encrypt credentials when a connection is made to the remote computer.

The code snippet section has the .NET 4.0 Code that is trying to establish a connection to the remote computer to query some Registry Information.

The user would key-in his Domain User Name and Password in the front-end and the code segment below would establish a WMI connection to Remote Computer.

Key Questions that I have are?
1. Is this the secure way of passing user name and password while connecting to Remote WMI?
2. Does this connection to Remote Computer in anyway is Encrypted? (I expected it to be)
3. Is there a possibility for an eves dropper to get hold of the user credentials?
Dim objManagementClass As ManagementClass
Dim ObjManagementBaseObject As ManagementBaseObject
Dim connection As New ConnectionOptions

connection = New ConnectionOptions
connection.Username = txtUID.Text
connection.Password = txtPassword.Text
connection.Authority = "ntlmdomain:" + Domain.SelectedValue ‘ Updating User Domain 
Scope = New ManagementScope("\\" + StrServer + "\root\Default", connection) ‘Connecting to default namespace on remote server
Scope.Options.EnablePrivileges = True
Scope.Options.Impersonation = ImpersonationLevel.Impersonate
Scope.Connect()
                ..
Perform the WMI Query
..
Connection = Nothing
txtUID.text = “”
txtPassword.text = “”

Open in new window

Comment
Watch Question

Most Valuable Expert 2012
Top Expert 2014

Commented:
Most Valuable Expert 2012
Top Expert 2014
Commented:
Check the last option in enum

http://msdn.microsoft.com/en-us/library/windows/desktop/aa393972(v=vs.85).aspx


Set the authentication level to RPC_C_AUTHN_LEVEL_PKT_PRIVACY or 6 if the namespace to which you are connecting on the remote computer requires an encrypted connection before it will return data. You can also use this authentication level, even if the namespace does not require it. This ensures that data is encrypted as it crosses the network.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa389290(v=vs.85).aspx#specifying_credentials_and_an_authentication_level_for_the_remote_connection

http://msdn.microsoft.com/en-us/library/windows/desktop/ms695984(v=vs.85).aspx#remoteAlternative

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.