Skip to content

security: Windows Administrator password is embedded in an AWS-RunPowerShellScript command parameter #1587

Closed

Description

@scttfrdmn

From the pre-1.0 security audit (spore-host/spore-host#649, 2026-11-11), audit id secrets-3. Verified: confirmed, severity low (reviewer said medium).

Where: pkg/aws/windows_password.go:227 (at origin/main on 2026-11-11)

Evidence

windows_password.go:203-208 generates the password, then RunPowerShell(... windowsSetAdminPasswordScript(password) ...). windows_password.go:227 is fmt.Sprintf($p = ConvertTo-SecureString "%s" -AsPlainText -Force, password). pkg/aws/ssm.go:39-43 is SendCommand{DocumentName: "AWS-RunPowerShellScript", Parameters: {"commands": {command}}}. This is the default path used by spawn connect --rdp (cmd/connect.go:465-487).

Scenario

Every spawn connect --rdp sets a fresh Administrator password, and that password stays readable for about 30 days through ssm:ListCommands by any account principal with SSM read. Such a reader can then RDP in as Administrator over the SSM port-forward or a public IP, if they also have ssm:StartSession or network reach. A command-history reader becomes a full Windows admin.

Verifier

pkg/aws/windows_password.go:227 interpolates the generated password into the PowerShell text, and pkg/aws/ssm.go:39-43 sends it as the 'commands' parameter of AWS-RunPowerShellScript. SSM keeps that parameter, and ListCommands returns it to SSM readers. Severity is overstated. A principal who can use the password usually also needs ssm:StartSession (the RDP path goes over an SSM port-forward), and StartSession or SendCommand on that instance already gives an administrative shell. The real exposure is a reader with only ssm:ListCommands who also has network reach to RDP.

Suggested fix

Deliver the password out of band: have the script read it from a SecureString SSM parameter or a KMS-encrypted blob and then delete it, or have the script generate the password itself and return it encrypted to a client-supplied RSA public key, the same scheme EC2 GetPasswordData uses.

Deployed-state check

Check whether ssm list-commands in accounts used for Windows launches shows AWS-RunPowerShellScript commands containing ConvertTo-SecureString. Count only; do not print.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:security

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions