summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-19 08:03:17 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-19 08:03:17 -0500
commitf9f1e3c94b6758e794abac8517474515101a6fd3 (patch)
tree2e18ec06c5c992e8c4be8680ea1c0786637e0f6d
parent2dc522664420163eeea87b8a5bdab5eaabd9b2e2 (diff)
parentde656474611c43f24dd5fff430de945b34b738bf (diff)
downloadtor-f9f1e3c94b6758e794abac8517474515101a6fd3.tar.gz
tor-f9f1e3c94b6758e794abac8517474515101a6fd3.zip
Merge branch 'maint-0.2.9'
-rw-r--r--changes/bug2101811
-rw-r--r--src/or/parsecommon.c2
-rw-r--r--src/or/rendcache.c4
-rw-r--r--src/or/routerparse.c4
4 files changed, 17 insertions, 4 deletions
diff --git a/changes/bug21018 b/changes/bug21018
new file mode 100644
index 0000000000..49a8b47a25
--- /dev/null
+++ b/changes/bug21018
@@ -0,0 +1,11 @@
+ o Major bugfixes (parsing, security):
+
+ - Fix a bug in parsing that could cause clients to read a single
+ byte past the end of an allocated region. This bug could be
+ used to cause hardened clients (built with
+ --enable-expensive-hardening) to crash if they tried to visit
+ a hostile hidden service. Non-hardened clients are only
+ affected depending on the details of their platform's memory
+ allocator. Fixes bug 21018; bugfix on 0.2.0.8-alpha. Found by
+ using libFuzzer. Also tracked as TROVE-2016-12-002 and as
+ CVE-2016-1254.
diff --git a/src/or/parsecommon.c b/src/or/parsecommon.c
index 6622d7d671..ec2cec69f7 100644
--- a/src/or/parsecommon.c
+++ b/src/or/parsecommon.c
@@ -326,7 +326,7 @@ get_next_token(memarea_t *area,
if (tok->tp == ERR_) {
/* No keyword matched; call it an "K_opt" or "A_unrecognized" */
- if (**s == '@')
+ if (*s < eol && **s == '@')
tok->tp = A_UNKNOWN_;
else
tok->tp = K_OPT;
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index bf43407289..12c23ea87c 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -908,7 +908,9 @@ rend_cache_store_v2_desc_as_client(const char *desc,
if (n_intro_points <= 0) {
log_warn(LD_REND, "Failed to parse introduction points. Either the "
"service has published a corrupt descriptor or you have "
- "provided invalid authorization data.");
+ "provided invalid authorization data, or (maybe!) the "
+ "server is deliberately serving broken data in an attempt "
+ "to crash you with bug 21018.");
goto err;
} else if (n_intro_points > MAX_INTRO_POINTS) {
log_warn(LD_REND, "Found too many introduction points on a hidden "
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 068e226f61..d763a63d84 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -5250,7 +5250,7 @@ rend_decrypt_introduction_points(char **ipos_decrypted,
crypto_cipher_free(cipher);
len = ipos_encrypted_size - 2 - client_entries_len - CIPHER_IV_LEN;
- dec = tor_malloc(len);
+ dec = tor_malloc_zero(len + 1);
declen = crypto_cipher_decrypt_with_iv(session_key, dec, len,
ipos_encrypted + 2 + client_entries_len,
ipos_encrypted_size - 2 - client_entries_len);
@@ -5282,7 +5282,7 @@ rend_decrypt_introduction_points(char **ipos_decrypted,
"small.");
return -1;
}
- dec = tor_malloc_zero(ipos_encrypted_size - CIPHER_IV_LEN - 1);
+ dec = tor_malloc_zero(ipos_encrypted_size - CIPHER_IV_LEN - 1 + 1);
declen = crypto_cipher_decrypt_with_iv(descriptor_cookie, dec,
ipos_encrypted_size -