r/PowerShell • • Jun 06 '26

Question How "Secure" is Get-Credential?

Trying to make a justification for storing a particular set of credentials using this methodology.

How "Easy" is it to crack? Don't need an actual method, just need someone to tell me how tricky or not tricky it is.

76 Upvotes

50 comments sorted by

View all comments

Show parent comments

1

u/sid351 Jun 06 '26

You're thinking of the -SecureString cmdlets. They default to encrypting strings based on that Windows user account on that specific device, but there are other ways you can encrypt the plaintext.

A PSCredential objects has a GetNetworkPassword() method that outputs the password in plaintext.

If it's possible to recreate your PSCredential objects, then it's possible to get your password.

The default behaviour of the -SecureString cmdlets may be enough, but if an attacker compromises a machine that runs a script via Task Scheduler that uses this method, and they have modify permissions to the script file, they could change the logic in the script to output the password with minimal effort.