Remote DNS (dns_zone_get_id): Getting zone ID for example.de returned example.dev
If both example.de and example.dev are present in the DNS, there's a chance that querying example.de will actually return example.dev.
This happens because the SQL query uses LIKE 'example.de%'.
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(!preg_match('/^[\w\.\-]{1,64}\.[a-zA-Z0-9\-]{2,63}$/', $origin)){
throw new SoapFault('no_domain_found', 'Invalid domain name.');
return false;
}
$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like ?", $origin."%");
if(isset($rec['id'])) {
return $app->functions->intval($rec['id']);
} else {
throw new SoapFault('no_domain_found', 'There is no domain ID with informed domain name.');
return false;
}
}
Proposed fix
$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like ?", $origin);