diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-14 09:13:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-14 09:13:28 -0400 |
commit | fde18fed60929a73dae8349222b2d7c3cd02a22b (patch) | |
tree | 401e3ae2311d1a2cb6b7cb6a2c2fd357c28c57a4 /src/or/hs_common.c | |
parent | 63af663b8c83d771ed8fd29802e9a4c5cb074c70 (diff) | |
parent | 0ac2afad0dc99ff6ce15f4cf63dcd2b9b3c6b637 (diff) | |
download | tor-fde18fed60929a73dae8349222b2d7c3cd02a22b.tar.gz tor-fde18fed60929a73dae8349222b2d7c3cd02a22b.zip |
Merge branch 'bug23019_squashed'
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r-- | src/or/hs_common.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c index f10fc4d5a4..6fe6b82f5e 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -918,22 +918,31 @@ hs_address_is_valid(const char *address) uint8_t version; uint8_t checksum[HS_SERVICE_ADDR_CHECKSUM_LEN_USED]; uint8_t target_checksum[DIGEST256_LEN]; - ed25519_public_key_t key; + ed25519_public_key_t service_pubkey; /* Parse the decoded address into the fields we need. */ - if (hs_parse_address(address, &key, checksum, &version) < 0) { + if (hs_parse_address(address, &service_pubkey, checksum, &version) < 0) { goto invalid; } /* Get the checksum it's suppose to be and compare it with what we have * encoded in the address. */ - build_hs_checksum(&key, version, target_checksum); + build_hs_checksum(&service_pubkey, version, target_checksum); if (tor_memcmp(checksum, target_checksum, sizeof(checksum))) { log_warn(LD_REND, "Service address %s invalid checksum.", escaped_safe_str(address)); goto invalid; } + /* Validate that this pubkey does not have a torsion component. We need to do + * this on the prop224 client-side so that attackers can't give equivalent + * forms of an onion address to users. */ + if (ed25519_validate_pubkey(&service_pubkey) < 0) { + log_warn(LD_REND, "Service address %s has bad pubkey .", + escaped_safe_str(address)); + goto invalid; + } + /* Valid address. */ return 1; invalid: |