1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Allows ncat to properly process HTTP passwords that are either empty or contain colons. Fixes #984

This commit is contained in:
nnposter
2017-09-23 22:53:19 +00:00
parent 6e83dc6406
commit 1bc9f186b9
2 changed files with 6 additions and 4 deletions

View File

@@ -399,12 +399,13 @@ static char *http_connect_request_auth(char* host_str, unsigned short port, int
/* Split up the proxy auth argument. */
proxy_auth = Strdup(o.proxy_auth);
username = strtok(proxy_auth, ":");
password = strtok(NULL, ":");
username = proxy_auth;
password = strchr(proxy_auth, ':');
if (password == NULL) {
free(proxy_auth);
return NULL;
}
*password++ = '\0';
response_hdr = http_digest_proxy_authorization(challenge,
username, password, "CONNECT", sock_to_url(o.target,o.portno));
if (response_hdr == NULL) {

View File

@@ -888,12 +888,13 @@ static int check_auth(const struct http_request *request,
/* Split up the proxy auth argument. */
proxy_auth = Strdup(o.proxy_auth);
username = strtok(proxy_auth, ":");
password = strtok(NULL, ":");
username = proxy_auth;
password = strchr(proxy_auth, ':');
if (password == NULL) {
free(proxy_auth);
return 0;
}
*password++ = '\0';
ret = http_digest_check_credentials(username, "Ncat", password,
request->method, credentials);
free(proxy_auth);