0

I have recently set up a computer with full disk encryption, and I decided not to encrypt the swap partition for performance reasons. I have been using ssh-agent on another computer to load my private keys, and was wondering if it were possible that the unencrypted keys got written to swap memory, hence risking having my private keys being unencrypted at rest.

OpenSSH version:

$ ssh -V
OpenSSH_9.6p1, LibreSSL 3.3.6
3
  • 1
    I think you meant to put your OpenSSH version in there, not OpenSSL.
    – Adam Katz
    Commented Mar 20 at 17:45
  • There's a good chance your encryption key will end up in swap as well. I would not trust such a setup, and consider the ssh keys the least of my worries.
    – vidarlo
    Commented Mar 20 at 21:12
  • The code is accessible over GitHub. From what I can tell, OpenSSH (including ssh-agent) uses plain old malloc on Linux without any attempt to prevent swapping through functions like mlock.
    – Ja1024
    Commented Mar 21 at 0:52

1 Answer 1

4

Full-system encryption is basically useless with unencrypted swap. There are ways for a program to deny swapping of its memory, but it's unreliable. All sorts of secrets could end up being swapped. The only solution to your concern is to wipe and encrypt the swap. Modern processors do AES in hardware so it's unlikely to cause performance issues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .