1

I'm not sure what is very secure about digitally signing a software or firmware to distribute. I understand the benefit in that it can let the receiver know if the data accidentally got corrupted during transfer as the hashes will not match, or if the software or firmware itself was purposely tampered with and modified.

However, What if the software/ firmware and also the digital signature gets purposely modified to suit? The transmitted hash will now match the modified software/firmware. Let's ignore the public and private keys part for now. Won't the hashes will still match on the receiving end and we have a modified software that can still be accepted?

  • You can't ignore the public and private keys, that's exactly what prevents this sort of attack. Without the private key, you can't create a valid signature (a signature is not a hash). – AndrolGenhald Sep 13 '18 at 16:28
  • You seem to understand the concept of hashes. You can then think of digital signatures as a hash + a publickey/privatekey operation. ie a digital signature is a hash that can't be forged unless you know the private key, but anybody can verify using the public key. – Mike Ounsworth Sep 13 '18 at 17:02
1

You can't ignore public keys.

Binaries are signed with code signing signatures from trusted certificate authorities and only they are trusted.

Code signing certificate example

Windows drivers are signed with certificates issued by Microsoft and only they are trusted.

Microsoft certificate example


However, What if the software/ firmware and also the digital signature gets purposely modified to suit? The transmitted hash will now match the modified software/firmware.

True, but you can't sign the binary with a trusted certificate (from trusted CA) if you don't have the certificate itself. Obviously, custom made signatures will not be trusted.

Let's ignore the public and private keys part for now. Won't the hashes will still match on the receiving end and we have a modified software that can still be accepted?

How can you ignore PKI? That's the whole point. They do not trust the signature and they do not trust the binary itself.

Like this:

not trusted

not trusted

  • Thanks for that. In the case of Windows, where would the public key or keys be stored, and could they be replaced by malware at all? – Engineer999 Sep 13 '18 at 19:03
  • @Engineer999 Of course malware can add certificates. Check: stackoverflow.com/a/12339231/10356004 – user186505 Sep 13 '18 at 22:57
1

I'll add some theory on top of @MoonsikPark's answer.

You seem to understand the concept of hashes. You can then think of digital signatures as a hash + a publickey/privatekey operation. ie a digital signature is a hash that can't be forged unless you know the private key, but anybody can verify using the public key.

Anyone can of course modify a binary file, but to compute a new signature for the modified binary. As an attacker, you won't have access to the authentic software developer's private key. You could create your own key pair, but each OS ships with a list of signing keys that they trust for installing software, so the user will get a warning like the one in @MoonsikPark's answer.

  • Ok thanks for that. Is there ever a risk that malicious software could load a new / different public key into the receiving system and then encrypt software with the matching private key and send it? – Engineer999 Sep 13 '18 at 19:01
  • 2
    I'm not much of a Windows user, but on Linux someone with root / sudo can add public keys to the OS list. See Red Hat documention. This feature exists in case you want to securely install software that didn't come from the official Red Hat repo. But if the attacker is already root, then it's already game over; just another example of "If a bad guy has admin access to your computer, then it's not your computer anymore". – Mike Ounsworth Sep 13 '18 at 19: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.