Skip to content

SSH remoting Credential objects from OSX can hard-lock Powershell #8723

@Hobadee

Description

@Hobadee

Steps to reproduce

From an OSX client to a Windows host:

PS /Users/myuser> $cred = Get-Credential

PowerShell credential request
Enter your credentials.
User: domain\user
Password for user domain\user: ************

PS /Users/myuser> $session = New-PSSession -HostName "windows.host" -UserName "domain\user" -KeyFilePath "/Users/myuser/.ssh/id_rsa"
PS /Users/myuser> Invoke-Command -Session $session -ScriptBlock {param($c) $Global:Credential = $c} -ArgumentList $cred

#### PowerShell locks up here and doesn't respond.  It must be killed externally. ####

Expected behavior

The Invoke-Command command should return and set a global parameter on the remote session.

Actual behavior

PowerShell freezes and must be terminated externally.

Additional Notes

I came across this issue because I was unable to run Get-Credential directly on the remote machine. I suspect the issues are related. When attempting to run Get-Credential directly on the remote machine, it hangs for a little bit, then returns an error:

[domain\user@windows.host]: PS C:\Users\myuser> $cred = Get-Credential

PowerShell Credential Request: PowerShell credential request
Warning: A script or application on the remote computer WINDOWS.HOST is requesting your credentials. Enter your credentials only if you trust the remote computer and the application or script that is requesting them.

Enter your credentials.
User: domain\user
Password for user domain\user: ************

At this point, the system hangs until you press "ctrl-c" to terminate it. Once you press "ctrl-c" it outputs the following before dumping you back into a shell.

Unable to load shared library 'api-ms-win-security-cryptoapi-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libapi-ms-win-security-cryptoapi-l1-1-0.dll, 1): image not found
+ CategoryInfo          : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException

Environment data

OSX Client:

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Darwin 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


Windows Host:

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Microsoft Windows 6.1.7601 S
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productOS-macOSResolution-FixedThe issue is fixed.WG-RemotingPSRP issues with any transport layer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions