When using GnuPG with a Yubikey 4 on a Laptop for e-mail communication: Can a trojan extract any secret key or sensitive information?

If so, what information would that be?

  • Would sensitive information include the data you are encrypting? Jan 3 '16 at 4:30
  • @NeilSmithline Yes. But my concern is the rest of the e-mails and data files on the laptop. Are they are all compromised, if a trojan "records" 1 time when I'm using GnuPG + Yubikey for 1 data or 1 e-mail? Jan 3 '16 at 11:43
  • 1
    @user3200534: you should start selecting answers as accepted when one actually answered your questions, have a look at the FAQ.
    – Jens Erat
    Jan 3 '16 at 22:44

You could wrap up the rest of the answer with "The YubiKeys implements the cryptographic smart card protocol using a programmable microcontroller". So what does this imply?

Cryptographic Smart Cards

The idea behind cryptographic smart cards is that they're equipped with their own crypto processor, and are able to perform several operations:

  • create keys for public/private key cryptography
  • alternatively load such keys
  • sign documents (hashes) using these keys
  • encryption session keys for symmetric encryption

An operation not supported is extracting keys, the idea of OpenPGP smart cards is limiting impact on breaches to the time the card/key is connected to the machine. This also means that if you want a backup copy, you'd have to create the key on a computer and then load it to the smart card/YubiKey.

All this is explained in Yubico's blog entry YubiKey NEO and OpenPGP:

WARNING: You cannot backup the secret keys – so if you lose the YubiKey NEO, re-generate another key pair or other lose the key pair there is no way to retrieve it! When you encrypt a file, make sure you have a plain text backup.

Sensible Information Beyond Private Keys

You can (but do not have to) store some personal information on OpenPGP smart cards, also the vendor could do so (for example, the FSFE signs the key's original contents with their own key, including some personal information they pre-programmed). I'm not sure whether the YubiKey implements the whole OpenPGP smart card standard and I don't have my YubiKey with me right now, but I'd guess it does. Information that is always stored are the serial number and as soon as keys are created their fingerprints and creation dates. There is a signature counter that might indicate key/card usage. Furthermore, you can (but do not have to) set the card holder's name, language, sex, public key's URI and some login data.

Programmable Microcontrollers

The YubiKey actually is a full computer, and all the smart card operations are implemented in software. There might be bugs and other issues, and you cannot really verify the software, on non-development products you cannot even install your own software (which of course also applies to hardware tokens, which also could include bugs and backdoors, where you also need to trust the vendor, but software is usually more complex, less well understood and more likely to have issues).

The YubiKey (Neo) was already affected by an issue, allowing to perform crypto operations without knowledge of the user's PIN. Extracting keys was not possible because of this issue.

A very sophisticated attacker might even be able to crack open the device and read the stored information (which also applies to "dedicated" smart cards for OpenPGP and other protocols, of course).

An alternative claiming to be open source hardware and software (which would in theory enable verification, while producing your own device is probably out of scope) is the Nitrokey. I'm not sure though how to verify the software running on the device and whether you could exchange the whole software with the self-compiled (and assessed?) source code, at least you should be able to do so for the individual applications (like OpenPGP).

  • So, even if a trojan is on the laptop monitoring the RAM, keyboard, etc. and I encrypt or decrypt only 1 e-mail or 1 file - Can the attacker obtain any secret-key to decrypt all the other e-mails and files, because of this one time? Jan 3 '16 at 11:50
  • 1
    The attacker can never obtain the secret key; but as long as the key is connected, he will be able to use it (from your machine). The private key never leaves the key, but the key can be commanded to use it. So while an attacker might be able to perform some cryptographic operations while the stick is connected and the attacker got access to the machine, this access will be revoked as soon as the trojan is removed/YubiKey is unplugged.
    – Jens Erat
    Jan 3 '16 at 13:00
  • 1
    Jens - I think that the information in your comment is the most important. Specifically, while the attacker has access to your machine with active Yubikey, they can decrypt and exfiltrate all of your data. Perhaps you should move it into the answer? Jan 3 '16 at 15:44
  • I agree this is something to be contained, I slightly edited the answer.
    – Jens Erat
    Jan 3 '16 at 22:48
  • 1
    @JensErat (1) Could a trojan get such data that could decrypt ALL emails/files encrypted by the same key? -- (2) I just read that the Yubikey 4 has a new feature that can be enabled - allowing crypto operations to take place only after pressing the button on the Yubikey 4. Would this prevent malicious BULK decryption while the stick is plugged in and the trojan attacker got the PIN? Jan 4 '16 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.