Skip to content

Commit

Permalink
fixed a security bug introduced in 3.13.0 version that lead the HTTP …
Browse files Browse the repository at this point in the history
…built-in server to bypass Basic Authentication when the option 'hosts_deny' is not defined #309
  • Loading branch information
mikaku committed Jan 27, 2021
1 parent 5f77eee commit d6816e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/HTTPServer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ sub http_header {
# check if the IP address is forced to auth
my $denied;
my $allowed = ip_validity($ENV{REMOTE_ADDR}, $hosts_allow);

# specific behavior
$hosts_deny = "all" if !$hosts_deny;

$denied = ip_validity($ENV{REMOTE_ADDR}, $hosts_deny) if !$allowed;
if(!$allowed && $denied) {
my (undef, $encoded_str) = split(' ', $ENV{HTTP_AUTHORIZATION} || "");
Expand Down

0 comments on commit d6816e2

Please sign in to comment.