Voilà, un peu de code tous les jours conserve le poil lisse et brillant ;-)
En ce moment ce sont quelques lignes pour pallier ce qui ressemble à une faille SSRF/XSPA :
// Check feed URL if ($this->core->settings->system->import_feed_url_control) { // Get IP from URL $bits = parse_url($this->feed_url); if (!$bits || !isset($bits['host'])) { throw new Exception(__('Cannot retrieve feed URL.')); } $ip = gethostbyname($bits['host']); if ($ip == $bits['host']) { $ip = $this->gethostbyname6($bits['host']); if (!$ip) { throw new Exception(__('Cannot retrieve feed URL.')); } } // Check feed IP $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6; if ($this->core->settings->system->import_feed_no_private_ip) { $flag |= FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; } if (!filter_var($ip,$flag)) { throw new Exception(__('Cannot retrieve feed URL.')); } // IP control (white list regexp) if ($this->core->settings->system->import_feed_ip_regexp != '') { if (!preg_match($this->core->settings->system->import_feed_ip_control,$ip)) { throw new Exception(__('Cannot retrieve feed URL.')); } } // Port control (white list regexp) if ($this->core->settings->system->import_feed_port_regexp != '') { if (!preg_match($this->core->settings->system->import_feed_port_regexp,$this->feed_url)) { throw new Exception(__('Cannot retrieve feed URL.')); } } }
C’est pas ce qu’il y a de plus fun, mais bon, ça me permet d’apprendre encore des trucs et de mettre un peu les doigts côté IPv6 et ça c’est uber-cool !