]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix TROVE-2021-006: Out-of-bounds read on v3 desc parsing
authorGeorge Kadianakis <desnacked@riseup.net>
Tue, 18 May 2021 14:06:57 +0000 (17:06 +0300)
committerNick Mathewson <nickm@torproject.org>
Thu, 10 Jun 2021 16:11:10 +0000 (12:11 -0400)
changes/bug40392 [new file with mode: 0644]
src/feature/hs/hs_descriptor.c

diff --git a/changes/bug40392 b/changes/bug40392
new file mode 100644 (file)
index 0000000..4dffa50
--- /dev/null
@@ -0,0 +1,4 @@
+  o Major bugfixes (security, denial of service, onion services):
+  - Fix an out-of-bounds memory access in v3 descriptor parsing. Fixes bug
+    40392; bugfix on 0.3.0.1-alpha. This issue is also tracked as
+    TROVE-2021-006. Reported by Sergei Glazunov from Google's Project Zero.
\ No newline at end of file
index b6abf14a112de86343d12b2d9184080933e15812..f74bb97ee26e0ad8aad03f7b3aa1660fe9741c7e 100644 (file)
@@ -135,7 +135,7 @@ static token_rule_t hs_desc_superencrypted_v3_token_table[] = {
 /* Descriptor ruleset for the encrypted section. */
 static token_rule_t hs_desc_encrypted_v3_token_table[] = {
   T1_START(str_create2_formats, R3_CREATE2_FORMATS, CONCAT_ARGS, NO_OBJ),
-  T01(str_intro_auth_required, R3_INTRO_AUTH_REQUIRED, ARGS, NO_OBJ),
+  T01(str_intro_auth_required, R3_INTRO_AUTH_REQUIRED, GE(1), NO_OBJ),
   T01(str_single_onion, R3_SINGLE_ONION_SERVICE, ARGS, NO_OBJ),
   END_OF_TABLE
 };
@@ -2312,6 +2312,7 @@ desc_decode_encrypted_v3(const hs_descriptor_t *desc,
   /* Authentication type. It's optional but only once. */
   tok = find_opt_by_keyword(tokens, R3_INTRO_AUTH_REQUIRED);
   if (tok) {
+    tor_assert(tok->n_args >= 1);
     if (!decode_auth_type(desc_encrypted_out, tok->args[0])) {
       log_warn(LD_REND, "Service descriptor authentication type has "
                         "invalid entry(ies).");