aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-06-10 08:42:15 -0400
committerNick Mathewson <nickm@torproject.org>2021-06-10 08:42:15 -0400
commit31eaa81f59749ed7e9d4f1bad24225d23eb6f654 (patch)
tree826f7854e89bd0bb00ac2c551975f15d3282a4fe
parent7c19a4d924120f42c224ea357b388b73d05c2d89 (diff)
parentd71bf986b4faf7cb3b654192bc67d5b674cfcf02 (diff)
downloadtor-31eaa81f59749ed7e9d4f1bad24225d23eb6f654.tar.gz
tor-31eaa81f59749ed7e9d4f1bad24225d23eb6f654.zip
Merge branch 'maint-0.3.5' into maint-0.4.4
-rw-r--r--changes/bug403919
-rw-r--r--src/core/or/circuitmux.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/changes/bug40391 b/changes/bug40391
new file mode 100644
index 0000000000..e3c186275f
--- /dev/null
+++ b/changes/bug40391
@@ -0,0 +1,9 @@
+ o Major bugfixes (security):
+ - Resist a hashtable-based CPU denial-of-service attack against
+ relays. Previously we used a naive unkeyed hash function to look up
+ circuits in a circuitmux object. An attacker could exploit this to
+ construct circuits with chosen circuit IDs in order to try to create
+ collisions and make the hash table inefficient. Now we use a SipHash
+ construction for this hash table instead. Fixes bug 40391; bugfix on
+ 0.2.4.4-alpha. This issue is also tracked as TROVE-2021-005.
+ Reported by Jann Horn from Google's Project Zero.
diff --git a/src/core/or/circuitmux.c b/src/core/or/circuitmux.c
index b770e40bf2..be54ae6ec6 100644
--- a/src/core/or/circuitmux.c
+++ b/src/core/or/circuitmux.c
@@ -169,9 +169,10 @@ chanid_circid_entries_eq(chanid_circid_muxinfo_t *a,
static inline unsigned int
chanid_circid_entry_hash(chanid_circid_muxinfo_t *a)
{
- return (((unsigned int)(a->circ_id) << 8) ^
- ((unsigned int)((a->chan_id >> 32) & 0xffffffff)) ^
- ((unsigned int)(a->chan_id & 0xffffffff)));
+ uint8_t data[8 + 4];
+ set_uint64(data, a->chan_id);
+ set_uint32(data + 8, a->circ_id);
+ return (unsigned) siphash24g(data, sizeof(data));
}
/* Emit a bunch of hash table stuff */