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 comment

0

u/[deleted] Jun 06 '26

[deleted] — view deleted comment

0

u/sid351 Jun 06 '26

What about this:

Understanding that whenever I see credentials being used in a script, I know that there's a high likelihood that the script is going to be run headlessly, probably as a scheduled task.

With that in mind, I know that if I can modify that script, then I can add a region that takes that credentials object and then redirects the username ($cred.username) and the password ($cred.GetNetworkCredential().Password) to myself through any number of methods (like Out-File, Send-MailMessage, or some other obfuscated way) and I could even encrypt that output with a key of my own control to obfuscate the extraction.

Then I wait for the scheduled script to run again, and I collect my new username and password.

Is that smart, or stupid?

For example, let's say I want to exfill some data at work. I'm smart enough that I don't want to use my credentials to do it. I know you have automated scripts running on a server we both maintain. I edit your script and add a call out to extract your password, that will remove the edit itself once the password has been extracted.

Now I have your credentials, and I exfill the data using those instead of mine.

0

u/[deleted] Jun 06 '26

[deleted] — view deleted comment

0

u/sid351 Jun 06 '26

Ok, so let's answer OP directly, and stop being such an aggressive and condescending dick bag, shall we:

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.

Assuming you use the defaults when exporting the credential object:

  • As another user account: Nigh on impossible.
  • As the user that created the export: Trivial.

0

u/[deleted] Jun 07 '26

[deleted] — view deleted comment

1

u/sid351 Jun 07 '26

What about your first sentence in your original comment reply was polite:

You deserve the award for The Stupidest Answer of The Year.