-
Notifications
You must be signed in to change notification settings - Fork 54
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
Rollback attacks and fast forward recovery #150
base: master
Are you sure you want to change the base?
Changes from all commits
0e76a17
8a20ecf
33c221b
4bceaf4
869129c
0ca0b7e
6446585
1706edf
bac0c55
7726374
3de7f6e
159c0e8
c2e206f
495370d
d9e0596
eed4388
be71c07
8652ff5
180e9db
9698015
40e3e7c
e50151d
07a46db
e5c0729
5441368
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ Title: The Update Framework Specification | |||||||||
Shortname: TUF | ||||||||||
Status: LS | ||||||||||
Abstract: A framework for securing software update systems. | ||||||||||
Date: 2021-09-07 | ||||||||||
Date: 2021-09-13 | ||||||||||
Editor: Justin Cappos, NYU | ||||||||||
Editor: Trishank Karthik Kuppusamy, Datadog | ||||||||||
Editor: Joshua Lock, VMware | ||||||||||
|
@@ -16,7 +16,7 @@ Boilerplate: copyright no, conformance no | |||||||||
Local Boilerplate: header yes | ||||||||||
Markup Shorthands: css no, markdown yes | ||||||||||
Metadata Include: This version off, Abstract off | ||||||||||
Text Macro: VERSION 1.0.25 | ||||||||||
Text Macro: VERSION 1.0.26 | ||||||||||
</pre> | ||||||||||
|
||||||||||
Note: We strive to make the specification easy to implement, so if you come | ||||||||||
|
@@ -1334,15 +1334,22 @@ it in the next step. | |||||||||
report the potential freeze attack. On the next update cycle, begin at step | ||||||||||
[[#update-root]] and version N of the root metadata file. | ||||||||||
|
||||||||||
11. **If the timestamp and / or snapshot keys have been rotated, then delete the | ||||||||||
trusted timestamp and snapshot metadata files.** This is done | ||||||||||
in order to recover from fast-forward attacks after the repository has been | ||||||||||
compromised and recovered. A *fast-forward attack* happens when attackers | ||||||||||
arbitrarily increase the version numbers of: (1) the timestamp metadata, (2) | ||||||||||
the snapshot metadata, and / or (3) the targets, or a delegated targets, | ||||||||||
metadata file in the snapshot metadata. Please see [the Mercury | ||||||||||
paper](https://theupdateframework.io/papers/prevention-rollback-attacks-atc2017.pdf) | ||||||||||
for more details. | ||||||||||
11. **Fast-forward attack recovery** A _fast-forward attack_ happens | ||||||||||
when attackers arbitrarily increase the version numbers in any of the | ||||||||||
timestamp, snapshot, targets, or delegated targets metadata. The attacker's goal | ||||||||||
is to cause clients to refuse to update the metadata later because the attacker's | ||||||||||
listed metadata version number (possibly MAX_INT) is greater than the new valid | ||||||||||
version. To recover from a fast-forward attack after the repository has been | ||||||||||
compromised and recovered, certain metadata files need to be deleted as | ||||||||||
specified in this section. If a targets file is subjected to a | ||||||||||
fast-forward attack, the snapshot role's keys should be replaced. Please see | ||||||||||
[the Mercury paper](https://ssl.engineering.nyu.edu/papers/kuppusamy-mercury-usenix-2017.pdf) | ||||||||||
for more details on fast-forward attacks. | ||||||||||
|
||||||||||
1. **Snapshot recovery** If the trusted snapshot metadata cannot be | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hosseinsia thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is clever. I like it! So at least a combination of non-revoked keys should have signed the metadata? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: we don't clearly define what a trusted metadata file is, see #179. Given the implications via this PR and the importance of that term for rollback attack protection, we should address that. |
||||||||||
validated using a threshold of snapshot keys from the new trusted root | ||||||||||
metadata, delete the trusted snapshot and timestamp metadata | ||||||||||
files. | ||||||||||
Comment on lines
+1349
to
+1352
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the core idea here is correct but I'm still not sure it makes sense to put the heuristic part into the client (that client must revoke trust on a correctly signed, valid timestamp just because snapshot is not signed). If snapshot key has been compromised and used to create snapshot version 1billion and timestamp process has accepted that into a timestamp, what prevents us from saying that the timestamp keys must then be rotated to enable rollback? The client workflow is already complicated and quite tricky to implement: much more difficult than reading the spec text implies. Every addition like this makes it more complex, and it feels like things are added to client workflow partly because the repository workflows are not defined so things can't be added there. I think the well defined ffwd recoveries are based on the repository rotating keys, and client taking care to not use untrusted metadata to do rollback checks:
For the client this creates basically no complexity: it just follows the basic rule, only believe trusted, correctly signed metadata. I don't think it puts an unfair burden on the repository either:
The second issue is a nitpick and I don't expect you to change this as it uses language already in the spec but I'll mention it: my opinion is that we should stop talking about "deleting files", or at least make that a secondary aspect: what is important is that the client should not consider the metadata trusted anymore (in practice, we might want to say out loud why exactly we do this: the existing, now untrusted, metadata should not be used to do rollback checks on the new metadata) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, how would this heuristic even work in practice:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that we should separate back out the timestamp vs snapshot recovery. Looking at it again, I actually don't think this check is in the right place in the workflow. I think the timestamp recovery should happen when the timestamp is downloaded, not as part of the root metadata workflow, and the same for snapshot. Especially as it is no longer tied to anything in the previous root metadata file. It would be great to have separate documentation for the repository workflow. Right now all the advise for managing a fast forward attack (and a lot of other pieces) is buried here in the client workflow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Friends, but this is where and what we recommend in the Mercury paper. See "5.3 Recovering from a repository compromise" on page 7. This is getting contentious enough (for good reasons) that I'm not sure that endless cycles of reviews and comments would do sufficient justice. A meeting hasn't solved the problem either. Perhaps it's time for the BDFL to step in and make a decision one way or another? @JustinCappos There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💯 I've filed #186 to track this
Added this notion of changing from "delete file" to "stop trusting" to #103
Mercury tells us "the online keys used to sign snapshot metadata can be revoked and replaced with new keys." and "The root-of-trust metadata indicates which keys can be trusted for verifying metadata files, including snapshot metadata files. This leads to a seamless and automatic recovery from fast-forward attacks after a repository compromise." This seems to state that root metadata indicates which keys can be used for verifying trusted metadata. That is, that key rotation is the correct way to recover from fast-forward attacks and that rollback protection is only provided for top-level metadata which is trusted by the current root metadata. |
||||||||||
|
||||||||||
12. **Set whether consistent snapshots are used as per the trusted** | ||||||||||
root metadata file (see [[#file-formats-root]]). | ||||||||||
|
@@ -1416,10 +1423,10 @@ it in the next step. | |||||||||
in the trusted timestamp metadata. If the versions do not match, discard the | ||||||||||
new snapshot metadata, abort the update cycle, and report the failure. | ||||||||||
|
||||||||||
5. **Check for a rollback attack**. The version number of the targets | ||||||||||
metadata file, and all delegated targets metadata files, if any, in the | ||||||||||
trusted snapshot metadata file, if any, MUST be less than or equal to its | ||||||||||
version number in the new snapshot metadata file. Furthermore, any targets | ||||||||||
5. **Check for a rollback attack**. The version number of all targets metadata | ||||||||||
files in the | ||||||||||
trusted snapshot metadata file, if any, MUST be less than or equal to their | ||||||||||
version numbers in the new snapshot metadata file. Furthermore, any targets | ||||||||||
metadata filename that was listed in the trusted snapshot metadata file, if | ||||||||||
any, MUST continue to be listed in the new snapshot metadata file. If any of | ||||||||||
these conditions are not met, discard the new snapshot metadata file, abort | ||||||||||
|
@@ -1431,7 +1438,6 @@ it in the next step. | |||||||||
file. If the new snapshot metadata file is expired, discard it, abort the | ||||||||||
update cycle, and report the potential freeze attack. | ||||||||||
|
||||||||||
|
||||||||||
7. **Persist snapshot metadata**. The client MUST write the file to | ||||||||||
non-volatile storage as FILENAME.EXT (e.g. snapshot.json). | ||||||||||
|
||||||||||
|
@@ -1475,10 +1481,9 @@ it in the next step. | |||||||||
6. **Persist targets metadata**. The client MUST write the file to | ||||||||||
non-volatile storage as FILENAME.EXT (e.g. targets.json). | ||||||||||
|
||||||||||
7. **Perform a pre-order depth-first search for metadata about the | ||||||||||
desired target, beginning with the top-level targets role.** Note: If | ||||||||||
any metadata requested in steps 5.6.7.1 - 5.6.7.2 cannot be downloaded nor | ||||||||||
validated, end the search and report that the target cannot be found. | ||||||||||
7. **Perform a preorder depth-first search for metadata about the | ||||||||||
desired target.** Let DELEGATOR refer to the current | ||||||||||
top-level targets metadata role. | ||||||||||
Comment on lines
+1485
to
+1486
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
At first I thought we were re-defining top-level targets metadata for each cycle, but then I realised by current you just mean the current trusted. I think that's implicit but either a) let's drop current or b) let's make it explicit |
||||||||||
|
||||||||||
1. If this role has been visited before, then skip this role | ||||||||||
(so that cycles in the delegation graph are avoided). Otherwise, if an | ||||||||||
|
@@ -1490,13 +1495,53 @@ it in the next step. | |||||||||
2. Otherwise, recursively search the list of delegations in | ||||||||||
order of appearance. | ||||||||||
|
||||||||||
1. If the current delegation is a terminating delegation, | ||||||||||
1. Let DELEGATEE denote | ||||||||||
the current target role DELEGATOR is delegating to. | ||||||||||
|
||||||||||
2. **Download the DELEGATEE targets metadata file**, up to either | ||||||||||
the number of bytes specified in the snapshot metadata file, or some Z | ||||||||||
number of bytes. The value for Z is set by the authors of the application | ||||||||||
using TUF. For example, Z may be tens of kilobytes. IF DELEGATEE cannot be | ||||||||||
found, end the search and report the target cannot be found. If | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be an error instead of just "not found": there was a delegation but metadata for the delegated role could not be downloaded, this sounds like a repository error to me |
||||||||||
consistent snapshots are not used (see Section | ||||||||||
[[#consistent-snapshots]]), then the filename used | ||||||||||
to download the targets metadata file is of the fixed form FILENAME.EXT | ||||||||||
(e.g., delegated_role.json). Otherwise, the filename is of the form | ||||||||||
VERSION_NUMBER.FILENAME.EXT (e.g., 42.delegated_role.json), where | ||||||||||
VERSION_NUMBER is the version number of the DELEGATEE metadata file listed | ||||||||||
in the snapshot metadata file. In either case, the client MUST write the | ||||||||||
file to non-volatile storage as FILENAME.EXT. | ||||||||||
|
||||||||||
3. **Check against snapshot role's hash.** The hashes of the new DELEGATEE | ||||||||||
metadata file MUST match the hashes, if any, listed in the trusted | ||||||||||
snapshot metadata. This is done, in part, to prevent a mix-and-match | ||||||||||
attack by man-in-the-middle attackers. If the new DELEGATEE metadata file | ||||||||||
does not match, abort the update cycle, and report the failure. | ||||||||||
|
||||||||||
4. **Check for an arbitrary software attack.** The new DELEGATEE | ||||||||||
metadata file MUST have been signed by a threshold of keys specified in the | ||||||||||
DELEGATOR metadata file. If the new DELEGATEE metadata file is not signed | ||||||||||
as required, abort the update cycle, and report the failure. | ||||||||||
|
||||||||||
5. **Check against snapshot role's version**. The version number of the new | ||||||||||
DELEGATEE metadata file MUST match the version number, if any, listed in | ||||||||||
the trusted snapshot metadata. If the versions do not match, discard it, | ||||||||||
abort the update cycle, and report the failure. | ||||||||||
|
||||||||||
6. **Check for a freeze attack.** The expiration timestamp in new | ||||||||||
DELEGATEE metadata file MUST be higher than the fixed update start time. | ||||||||||
If so, the new DELEGATEE file becomes the trusted DELEGATEE | ||||||||||
file. If the new DELEGATEE metadata file is expired, abort the update | ||||||||||
cycle, and report the potential freeze attack. | ||||||||||
|
||||||||||
7. If the current delegation is a terminating delegation, | ||||||||||
then jump to step [[#fetch-target]]. | ||||||||||
|
||||||||||
2. Otherwise, if the current delegation is a | ||||||||||
non-terminating delegation, continue processing the next delegation, if | ||||||||||
any. Stop the search, and jump to step [[#fetch-target]] as soon as a delegation | ||||||||||
returns a result. | ||||||||||
8. Otherwise, if the current delegation is a non-terminating | ||||||||||
delegation, continue processing the next delegation, if any, by repeating | ||||||||||
the preorder depth-first search with the DELEGATEE as the DELEGATOR. | ||||||||||
Stop the search, and jump to step [[#fetch-target]] as soon as a | ||||||||||
delegation returns a result. | ||||||||||
|
||||||||||
## Fetch target ## {#fetch-target} | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's link to our own copies.