Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using smartcards PINs are stored in the registry by ssh-agent #2341

Open
3 tasks done
hpgarethd opened this issue Mar 19, 2025 · 0 comments
Open
3 tasks done

When using smartcards PINs are stored in the registry by ssh-agent #2341

hpgarethd opened this issue Mar 19, 2025 · 0 comments

Comments

@hpgarethd
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Using smartcards to hold private keys for ssh, I pondered how ssh-agent was able to reload the keys after a reboot.
It seems that when using the OpenSC opensc-pkcs11.dll to load the key to ssh-agent, the call to https://github.com/PowerShell/openssh-portable/blob/0096029101a77a9b6b45c8351d46dc9b081b5756/contrib/win32/win32compat/ssh-agent/keyagent-request.c#L106 ends up storing the entered card pin in the registry.
This is then easily extracted from the registry using an elevated shell.

There is no expectation that ssh-agent should be able to hold keys over a reboot or logout, and I definitely didn't expect ssh-agent to stash my PIN away in a fairly insecure way.

Expected behavior

ssh-agent should not store entered smartcard PINs in the registry

Actual behavior

ssh-agent stores entered PINs in the registry

Error details

Environment data

> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.22621.4391
PSEdition                      Desktop

> ssh -V
OpenSSH_for_Windows_9.8p1 Win32-OpenSSH-GitHub, LibreSSL 3.9.2

Version

OpenSSH_for_Windows_9.8p1

Visuals

@tgauth tgauth transferred this issue from PowerShell/openssh-portable Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants