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

Extend Authenticode signature verification #296

Merged
merged 14 commits into from Aug 9, 2021
Merged

Extend Authenticode signature verification #296

merged 14 commits into from Aug 9, 2021

Conversation

mherrmann
Copy link
Contributor

Fixes #272.

The current implementation only verifies the Authenticode signatures of update binaries in rare cases, namely code red checks and app commands. This commit adds a new registry DWORD value:

UpdateDev\AlwaysVerifyAuthenticodeSignatures

When set to a non-zero value, then update binaries are also verified in normall install / update cycles.

Any feedback would be highly appreciated.

The previous implementation only verified Authenticode signatures of
update binaries in rare cases, namely code red checks and app commands.
This commit adds a new registry DWORD value:

    UpdateDev\AlwaysVerifyAuthenticodeSignatures

When set to a non-zero value, then update binaries are also verified in
normall install / update cycles.
@sorinj
Copy link
Collaborator

sorinj commented Jul 7, 2021

I am going to look at this sometimes next week, I am currently AFK.

@mherrmann
Copy link
Contributor Author

Great, thank you ☺️ I look forward to your thoughts.

@mistychatmsn
Copy link

mistychatmsn commented Jul 16, 2021 via email

omaha/base/constants.h Outdated Show resolved Hide resolved
omaha/base/constants.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@sorinj sorinj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I have a few minor style comments. Let's discuss the naming of the feature. I don't have a strong opinion about what I suggested and I could go with your current naming.

@mherrmann
Copy link
Contributor Author

Thank you very much for your review. I am afk this week and will hopefully be able to get back to you next week.

@mherrmann
Copy link
Contributor Author

I pushed more commits and commented on your review. Would be fine for me to merge as it is now; But I would also be very happy to hear any further comments you might have. Thanks!

Copy link
Collaborator

@sorinj sorinj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, two are actionable.

@mherrmann
Copy link
Contributor Author

I pushed two commits that (I hope) address your actionable comments.

@mherrmann mherrmann requested a review from sorinj August 3, 2021 15:32
@mherrmann
Copy link
Contributor Author

From my limited perspective, I suspect the decision whether to use a runtime check or a build flag will depend on whether Google wants to use the feature. If not, then the build flag limits Google's risk. If yes, then I personally would use the runtime check to limit the risk of a roll-out. But of course, as an outsider I can only guess at the right approach for Google. If you want me to rewrite the implementation to use a build flag, let me know.

@sorinj
Copy link
Collaborator

sorinj commented Aug 4, 2021

From my limited perspective, I suspect the decision whether to use a runtime check or a build flag will depend on whether Google wants to use the feature. If not, then the build flag limits Google's risk. If yes, then I personally would use the runtime check to limit the risk of a roll-out. But of course, as an outsider I can only guess at the right approach for Google. If you want me to rewrite the implementation to use a build flag, let me know.

Right. Ganesh and I discussed the rollout scenario: who'd change the UpdateDev value to turn the feature on or off?
Then the following ideas were considered:

  • Using UpdateDev: this works in all cases but it's mostly used for developer and system admin configurations
  • Using Update instead of UpdateDev. The drawback here is that Update may be deleted on uninstall.
  • Using group policies. The drawback is that group policies are applied only for domain-joined systems.
    We realized that this is getting complicated, then we suggested the build flag.

As a compromise, this is a suggest we do. Keep the UpdateDev implementation as you have so far. But in addition to that, enable the check to occur only behind a build flag like we do for has_device_management, and have the flag turned off on trunk. People who fork the code then can turn the feature on in their forks.

@sorinj
Copy link
Collaborator

sorinj commented Aug 4, 2021

Thank you for your feedback. @sorinj raised the same concern. I already addressed it in 9477eac, where I renamed the method and registry value to VerifyPayloadAuthenticodeSignature.

To clarify, I suggested a name change to be explicit in mentioning Payload verification. Ganesh's concern is slightly different: Verify... vs ShouldVerify...

@mherrmann
Copy link
Contributor Author

Thank you for your thoughts. I'll get started on the build flag implementation you suggested. However, in this case I will make the registry flag opt-out instead of opt-in.

Previously, it was disabled and could be enabled by a registry key.
Now, it is the other way around.
@mherrmann
Copy link
Contributor Author

Thank you for your feedback. @sorinj raised the same concern. I already addressed it in 9477eac, where I renamed the method and registry value to VerifyPayloadAuthenticodeSignature.

To clarify, I suggested a name change to be explicit in mentioning Payload verification. Ganesh's concern is slightly different: Verify... vs ShouldVerify...

That's true, actually. I changed the method name to ShouldVerify... in ff44efe.

@mherrmann
Copy link
Contributor Author

I've now pushed further commits to guard the new implementation behind a build flag (248bdc2) and to make the registry key opt-out instead of opt-in (f64c29a). Could you let me know your thoughts @sorinj @GitHubGanesh?

@sorinj
Copy link
Collaborator

sorinj commented Aug 5, 2021

We could probably merge the change like it is. I wonder what you think about making one more change, as suggested below.

We are not fond of the churn introduced by conditional compilation in so many places. Would it make sense to just use
conditional compilation in the omaha/common/config_manager.cc, so that the function returns false if the feature is not
enabled at build time?

We don't mind the extra increase in code size due to the code that we don't use right now.

Thank you!

Build flag VERIFY_PAYLOAD_AUTHENTICODE_SIGNATURE was checked in too many
places. Reduce its usage to the few critical points.
@mherrmann
Copy link
Contributor Author

No problem. I applied your suggestion. What do you think @sorinj?

@sorinj
Copy link
Collaborator

sorinj commented Aug 9, 2021

Thank you!

@sorinj
Copy link
Collaborator

sorinj commented Aug 9, 2021

No problem. I applied your suggestion. What do you think @sorinj?

lgtm

@sorinj sorinj merged commit 38b7cb9 into google:master Aug 9, 2021
@mherrmann
Copy link
Contributor Author

mherrmann commented Aug 10, 2021

Thank you! This will help our customers.

sorinj pushed a commit that referenced this pull request Oct 19, 2021
* Extend Authenticode signature verification

The previous implementation only verified Authenticode signatures of
update binaries in rare cases, namely code red checks and app commands.
This commit adds a new registry DWORD value:

    UpdateDev\AlwaysVerifyAuthenticodeSignatures

When set to a non-zero value, then update binaries are also verified in
normal install / update cycles.
@Derinmasal
Copy link

@nguyenlevanduy
Copy link

[]()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pin code signing certificate
8 participants