summaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-11 13:40:21 -0500
committerNick Mathewson <nickm@torproject.org>2017-11-27 15:12:19 -0500
commit2834cc9c18230c36278ffa94a252abeb91b6cff9 (patch)
treea8c747864af0c52563c697e2c6ef402274182a74 /src/or/rendservice.c
parent6f8c32b7deb9f0cec6d1553aba71969c9fb6064f (diff)
downloadtor-2834cc9c18230c36278ffa94a252abeb91b6cff9.tar.gz
tor-2834cc9c18230c36278ffa94a252abeb91b6cff9.zip
Fix length of replaycache-checked data.
This is a regression; we should have been checking only the public-key encrypted portion. Fixes bug 24244, TROVE-2017-009, and CVE-2017-8819.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index d958de9df9..ba8891eade 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -1162,6 +1162,7 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
time_t now = time(NULL);
time_t elapsed;
int replay;
+ size_t keylen;
/* Do some initial validation and logging before we parse the cell */
if (circuit->base_.purpose != CIRCUIT_PURPOSE_S_INTRO) {
@@ -1245,9 +1246,10 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
}
/* check for replay of PK-encrypted portion. */
+ keylen = crypto_pk_keysize(intro_key);
replay = replaycache_add_test_and_elapsed(
intro_point->accepted_intro_rsa_parts,
- parsed_req->ciphertext, parsed_req->ciphertext_len,
+ parsed_req->ciphertext, MIN(parsed_req->ciphertext_len, keylen),
&elapsed);
if (replay) {