mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
We were comparing the raw BridgePassword entry with a base64'ed
version of it, when handling a "/tor/networkstatus-bridges" directory request. Now compare correctly. Noticed by Veracode. svn:r13609
This commit is contained in:
+5
-13
@@ -2639,27 +2639,19 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
||||
connection_dir_is_encrypted(conn) &&
|
||||
!strcmp(url,"/tor/networkstatus-bridges")) {
|
||||
char *status;
|
||||
char decoded[64];
|
||||
char *secret;
|
||||
int r;
|
||||
char *secret = alloc_http_authenticator(options->BridgePassword);
|
||||
|
||||
header = http_get_header(headers, "Authorization: Basic ");
|
||||
|
||||
if (!header) {
|
||||
write_http_status_line(conn, 404, "Not found");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* now make sure the password is right */
|
||||
r = base64_decode(decoded, sizeof(decoded), header, strlen(header));
|
||||
secret = alloc_http_authenticator(options->BridgePassword);
|
||||
if (r < 0 || (unsigned)r != strlen(secret) || memcmp(decoded, secret, r)) {
|
||||
/* failed to decode, or didn't match. Refuse. */
|
||||
/* now make sure the password is there and right */
|
||||
if (!header || strcmp(header, secret)) {
|
||||
write_http_status_line(conn, 404, "Not found");
|
||||
tor_free(secret);
|
||||
tor_free(header);
|
||||
goto done;
|
||||
}
|
||||
tor_free(secret);
|
||||
tor_free(header);
|
||||
|
||||
/* all happy now. send an answer. */
|
||||
status = networkstatus_getinfo_by_purpose("bridge", time(NULL));
|
||||
|
||||
Reference in New Issue
Block a user