MDL-61143 core_files: Check all A records when testing blocked IPs
This commit is contained in:
committed by
Mr. Jenkins (CiBoT)
parent
01a79b4e86
commit
cae2eb357d
@@ -144,10 +144,19 @@ class curl_security_helper extends curl_security_helper_base {
|
||||
|
||||
// Only perform a forward lookup if there are IP rules to check against.
|
||||
if ($blacklistedhosts['ipv4'] || $blacklistedhosts['ipv6']) {
|
||||
$hostip = gethostbyname($host); // DNS forward lookup - only returns IPv4 addresses!
|
||||
if ($hostip !== $host && $this->address_explicitly_blocked($hostip)) {
|
||||
$hostips = gethostbynamel($host); // DNS forward lookup - returns a list of only IPv4 addresses!
|
||||
|
||||
// If we don't get a valid record, bail (so curl is never called).
|
||||
if (!$hostips) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If any of the returned IPs are in the blacklist, block the request.
|
||||
foreach ($hostips as $hostip) {
|
||||
if ($this->address_explicitly_blocked($hostip)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user