Skip to content

Commit 2f8ab29

Browse files
committed
Checking version after verifying signatures
In section 5.3.1 and section 5.4.1 of the spec, the first part of verifying a new snapshot, targets, and delegated targets role requires checking the new role's version number before we've checked that these new roles were signed by the root role. This exposes TUF clients to potential parser bugs which allows an attacker to potentially compromise the system. For example, consider a man-in-the-middle attacker that has a parser bug which allows for executing arbitrary code, such as [CVE-2017-18349]. An attacker could exploit this in a few manners: 1. [POUF-1] inlines the metadata signatures in with the role JSON metadata file. While snapshot, targets, and delegated targets can have their hashes listed in trusted metadata (and thus be validated before parsing), the timestamp role must be parsed in order to verify it was signed by the trusted root role. 2. TUF-1.0.5 Section 5.3.1 of the workflow states the snapshot should be verified by hash and version number before checking the signature. While we could verify the hash before parsing, the spec doesn't state that the hash should be checked first. It's possible then for a conformant TUF client to check the version number before hash, which would expose the client to the parser bug. 3. TUF-1.0.5 Section 4.4 and 5.4.1 make it optional for the snapshot role to contain the hashes of the targets and any delegated targets role. If left out, we need to still parse these files to check the version number before validating the signatures. This patch addresses (2) and (3) by moving the verification of the version number to after we've verified a role was properly signed by the trusted root role. This would enable a future POUF that's addressed (1) to avoid future parser exploits. [POUF-1]: https://github.com/theupdateframework/taps/blob/master/POUFs/reference-POUF/pouf1.md [CVE-2017-18349]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-18349
1 parent c6ec4fc commit 2f8ab29

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

tuf-spec.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# <p align="center">The Update Framework Specification
22

3-
Last modified: **26 August 2020**
3+
Last modified: **15 September 2020**
44

5-
Version: **1.0.5**
5+
Version: **1.0.6**
66

77
We strive to make the specification easy to implement, so if you come across
88
any inconsistencies or experience any difficulty, do let us know by sending an
@@ -1188,26 +1188,31 @@ VERSION_NUMBER is the version number of the snapshot metadata file listed in
11881188
the timestamp metadata file. In either case, the client MUST write the file to
11891189
non-volatile storage as FILENAME.EXT.
11901190

1191-
* **3.1**. **Check against timestamp metadata.** The hashes and version
1192-
number of the new snapshot metadata file MUST match the hashes (if any) and
1193-
version number listed in the trusted timestamp metadata. If hashes and
1194-
version do not match, discard the new snapshot metadata, abort the update
1195-
cycle, and report the failure.
1191+
* **3.1**. **Check against timestamp role's snapshot hash.** The hashes
1192+
number of the new snapshot metadata file MUST match the hashes (if any)
1193+
listed in the trusted timestamp metadata. If hashes and do not match,
1194+
discard the new snapshot metadata, abort the update cycle, and report the
1195+
failure.
11961196

11971197
* **3.2**. **Check signatures.** The new snapshot metadata file MUST have
11981198
been signed by a threshold of keys specified in the trusted root metadata
11991199
file. If the new snapshot metadata file is not signed as required, discard
12001200
it, abort the update cycle, and report the signature failure.
12011201

1202-
* **3.3**. **Check for a rollback attack.**
1202+
* **3.3**. **Check against timestamp role's snapshot version.** The version
1203+
number of the new snapshot metadata file MUST match the version number listed
1204+
in the trusted timestamp metadata. If version version do not match, discard
1205+
the new snapshot metadata, abort the update cycle, and report the failure.
12031206

1204-
* **3.3.1**. The version number of the trusted snapshot metadata file, if
1207+
* **3.4**. **Check for a rollback attack.**
1208+
1209+
* **3.4.1**. The version number of the trusted snapshot metadata file, if
12051210
any, MUST be less than or equal to the version number of the new snapshot
12061211
metadata file. If the new snapshot metadata file is older than the trusted
12071212
metadata file, discard it, abort the update cycle, and report the potential
12081213
rollback attack.
12091214

1210-
* **3.3.2**. The version number of the targets metadata file, and all
1215+
* **3.4.2**. The version number of the targets metadata file, and all
12111216
delegated targets metadata files (if any), in the trusted snapshot metadata
12121217
file, if any, MUST be less than or equal to its version number in the new
12131218
snapshot metadata file. Furthermore, any targets metadata filename that was
@@ -1216,7 +1221,7 @@ non-volatile storage as FILENAME.EXT.
12161221
not met, discard the new snapshot metadadata file, abort the update cycle,
12171222
and report the failure.
12181223

1219-
* **3.4**. **Check for a freeze attack.** The latest known time should be
1224+
* **3.5**. **Check for a freeze attack.** The latest known time should be
12201225
lower than the expiration timestamp in the new snapshot metadata file. If
12211226
so, the new snapshot metadata file becomes the trusted snapshot metadata
12221227
file. If the new snapshot metadata file is expired, discard it, abort the
@@ -1233,48 +1238,54 @@ VERSION_NUMBER is the version number of the targets metadata file listed in the
12331238
snapshot metadata file. In either case, the client MUST write the file to
12341239
non-volatile storage as FILENAME.EXT.
12351240

1236-
* **4.1**. **Check against snapshot metadata.** The hashes and version
1237-
number of the new targets metadata file MUST match the hashes (if any) and
1238-
version number listed in the trusted snapshot metadata. This is done, in
1239-
part, to prevent a mix-and-match attack by man-in-the-middle attackers. If
1240-
the new targets metadata file does not match, discard it, abort the update
1241-
cycle, and report the failure.
1241+
* **4.1**. **Check against snapshot role's targets hash.** The hashes
1242+
of the new targets metadata file MUST match the hashes (if any) listed in the
1243+
trusted snapshot metadata. This is done, in part, to prevent a mix-and-match
1244+
attack by man-in-the-middle attackers. If the new targets metadata file does
1245+
not match, discard it, abort the update cycle, and report the failure.
12421246

12431247
* **4.2**. **Check for an arbitrary software attack.** The new targets
12441248
metadata file MUST have been signed by a threshold of keys specified in the
12451249
trusted root metadata file. If the new targets metadata file is not signed
12461250
as required, discard it, abort the update cycle, and report the failure.
12471251

1248-
* **4.3**. **Check for a freeze attack.** The latest known time should be
1252+
* **4.3**. **Check against snapshot role's targets version.** The version
1253+
number of the new targets metadata file MUST match the version number listed
1254+
in the trusted snapshot metadata. This is done, in part, to prevent a
1255+
mix-and-match attack by man-in-the-middle attackers. If the new targets
1256+
metadata file does not match, discard it, abort the update cycle, and report
1257+
the failure.
1258+
1259+
* **4.4**. **Check for a freeze attack.** The latest known time should be
12491260
lower than the expiration timestamp in the new targets metadata file. If so,
12501261
the new targets metadata file becomes the trusted targets metadata file. If
12511262
the new targets metadata file is expired, discard it, abort the update cycle,
12521263
and report the potential freeze attack.
12531264

1254-
* **4.4**. **Perform a preorder depth-first search for metadata about the
1265+
* **4.5**. **Perform a preorder depth-first search for metadata about the
12551266
desired target, beginning with the top-level targets role.** Note: If
12561267
any metadata requested in steps 4.4.1 - 4.4.2.3 cannot be downloaded nor
12571268
validated, end the search and report that the target cannot be found.
12581269

1259-
* **4.4.1**. If this role has been visited before, then skip this role (so
1270+
* **4.5.1**. If this role has been visited before, then skip this role (so
12601271
that cycles in the delegation graph are avoided). Otherwise, if an
12611272
application-specific maximum number of roles have been visited, then go to
12621273
step 5 (so that attackers cannot cause the client to waste excessive
12631274
bandwidth or time). Otherwise, if this role contains metadata about the
12641275
desired target, then go to step 5.
12651276

1266-
* **4.4.2**. Otherwise, recursively search the list of delegations in order
1277+
* **4.5.2**. Otherwise, recursively search the list of delegations in order
12671278
of appearance.
12681279

1269-
* **4.4.2.1**. If the current delegation is a multi-role delegation,
1280+
* **4.5.2.1**. If the current delegation is a multi-role delegation,
12701281
recursively visit each role, and check that each has signed exactly the
12711282
same non-custom metadata (i.e., length and hashes) about the target (or
12721283
the lack of any such metadata).
12731284

1274-
* **4.4.2.2**. If the current delegation is a terminating delegation,
1285+
* **4.5.2.2**. If the current delegation is a terminating delegation,
12751286
then jump to step 5.
12761287

1277-
* **4.4.2.3**. Otherwise, if the current delegation is a non-terminating
1288+
* **4.5.2.3**. Otherwise, if the current delegation is a non-terminating
12781289
delegation, continue processing the next delegation, if any. Stop the
12791290
search, and jump to step 5 as soon as a delegation returns a result.
12801291

0 commit comments

Comments
 (0)