-
Notifications
You must be signed in to change notification settings - Fork 275
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
ngclient: improve rollback protection #1498
Comments
This sounds good with the caveat that expired timestamp or snapshot should not be used to check for rollback attacks if the snapshot or timestamp keys have been replaced (for fast forward attack recovery). The spec changes might fit as part of theupdateframework/specification#150, or maybe as a separate pr once we finalize that one. |
Yes, as I said all validity checks should be done except expiry. If metadata is not signed correctly it does not get used for anything. |
There's one more rollback case we handle worse than we should:
I think the solution here is the same as with expiry: consider the specs intention that old snapshot can be used for rollback checks, but not for anything else. In practice for ngclient:
|
If hashes/length are included for metadata, then we can't check those either for the purpose of rollback checks -- we can check for them once we have the "final" snapshot but not before. EDIT: this is actually a slightly (but for ngclient meaningfully) different case: hashes/length check is a security measure to prevent parsing data we don't trust, while the various rollback cases are for data that is "correct" (signed). For these signed cases there is effectively no difference between data downloaded from the network and data loaded from local disk but in the hashes/length case the difference is real... I'll file a different issue for this: #1523 |
I believe ngclient implements the spec as its written... but fails to follow the spirit of the spec in one aspect: as the spec does not explicitly say that expired snapshot and timestamp can be used to do the rollback checks of new snapshot and timestamp (while it does explicitly allow this for root), ngclient does not use expired snapshot and timestamp and instead considers those expired versions invalid. This means a rollback attack (giving the client an older version of the metadata file) is easier as long as the local metadata versions have had time to expire.
Spec (client workflow) could be improved:
I believe it makes sense to work on the ngclient improvements at the same time. I think this should do it:
TrustedMetadataSet.update_*()
as now, except do not check expiry: this allows updating TrustedMetadataSet first with a local (possibly expired) file and then updating with a new downloaded oneroot_update_finished()
as the expiry check is now done consistently as described aboveThe text was updated successfully, but these errors were encountered: