Skip to content

Commit d6816e2

Browse files
committed
fixed a security bug introduced in 3.13.0 version that lead the HTTP built-in server to bypass Basic Authentication when the option 'hosts_deny' is not defined #309
1 parent 5f77eee commit d6816e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/HTTPServer.pm

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ sub http_header {
139139
# check if the IP address is forced to auth
140140
my $denied;
141141
my $allowed = ip_validity($ENV{REMOTE_ADDR}, $hosts_allow);
142+
143+
# specific behavior
144+
$hosts_deny = "all" if !$hosts_deny;
145+
142146
$denied = ip_validity($ENV{REMOTE_ADDR}, $hosts_deny) if !$allowed;
143147
if(!$allowed && $denied) {
144148
my (undef, $encoded_str) = split(' ', $ENV{HTTP_AUTHORIZATION} || "");

0 commit comments

Comments
 (0)