Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

New-StoredCredential returns object with password in plain text #13

Open
martin9700 opened this issue Dec 4, 2016 · 3 comments
Open

Comments

@martin9700
Copy link

Please remove the Password property from the object returned from New-StoredCredential. This has massive security issues and most Enterprises will not be able to use the module because of it.

@gregnorz
Copy link

The hacky workaround is to pipe the output of New-StoredCredential to Out-Null. That will keep it from appearing on screens or in log files, potentially, but it doesn't solve the main problem that the SecurePassword is getting decrypted into memory at some point.

@mabster
Copy link

mabster commented Mar 3, 2020

Ideally the New-StoredCredential cmdlet should return an actual PSCredential object (or something shaped like it). That way we could do something like:

$cred = (Get-Credential | New-StoredCredential -Target 'foo')

... and then use $cred as credentials later in the same script. The password would be a SecureString then, I think, which would resolve this issue.

The easy answer is to change PSCredentialManager.Cmdlet/Cmdlets.cs line 316 to:

WriteObject(nativeCredential);

... but I'm not sure if that would break any tests. It certainly could break some existing code. Perhaps an -AsCredentialObject switch on New-StoredCredential so people can add it if they need backwards compatibility?

@realslacker
Copy link

Is this module still being maintained, this issue was opened years ago...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants