0

I have recently been introduced to GPG signing as a better way of verifying data than hashing. It was described that if you posted the hash of the file, someone could hack your website, alter the hash and publish a different binary and you'd be non-the-wiser. GPG signing was a way to overcome this. I'm not entirely sure I understand the reasoning behind this.

For example, if someone were to hack your website, what is stopping them publishing a different public key registered with the same name/email as the previous key? Of course the date of the signing would be different, but how would you realistically know what it should be? This leads me to say why bother going through the process of using GPG for this purpose when hashing is much simpler? I must be missing something here as I see this practice used for large projects, e.g. SDL2 and libuv

0

As you have identified, hashing does not verify who created the data, but GPG signing does. You are also correct that an attacker could also put their own GPG keys next to the compromised download, and it would be no good to verify the download.

However, you would be protected in the following scenarios:

  1. The key fingerprint can be confirmed somewhere else; perhaps on a different website or using an out-of-band method.
  2. You previously had downloaded the correct GPG key and use it to verify.

In either scenario, you'd have the correct key, and the attacker's signature would not match, tipping you off to the potential compromise.

The key's signatures could also be examined. Perhaps you know the real keys are also signed by sponsor companies A and B. In this case, you could obtain company A and B's keys and verify that correct signatures exist. Since those companies may be separate entities, it is very unlikely that all keys were compromised simultaneously.

7
  • You would also be protected in the scenario where someone else who has the correct key notices the compromise before you download/install and raises the alarm. – nobody Sep 20 '20 at 16:50
  • @nobody true, unless it was a targeted attack somehow. – multithr3at3d Sep 20 '20 at 18:40
  • @multithr3at3d The GPG 'web-of-trust' is new to me. It seems that GPG can only 'really' work in this case, e.g. anyone could make a key registered as Tom Cruise. Without colleagues to verify you, is there a way to make your key 'usable'? I have thought of publishing your key on your website with EV SSL, however that is too expensive for the average person. – Ryan McClue Sep 21 '20 at 8:20
  • @RyanMcClue somewhat related, there are other services (e.g. Keybase) that allow you to prove/verify your public key's association with personal domains, social media accounts, etc., if that's your thing. – multithr3at3d Sep 21 '20 at 11:16
  • Your key is usable if trustworthy others have signed it, or possibly if you verify it out-of-band e.g. in person. – multithr3at3d Sep 21 '20 at 11:17

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.