The All-in-One Video Gallery plugin for WordPress is vulnerable to arbitrary file downloads and blind server-side request forgery via the ‘dl’ parameter found in the ~/public/video.php file in versions up to, and including 2.6.0. This makes it possible for unauthenticated users to download sensitive files hosted on the affected server and forge requests to the server.
// Detect the file type
if(strpos($file,home_url())!==false){$is_remote_file=false;}if(preg_match('#http://#',$file)||preg_match('#https://#',$file)){$formatted_path='url';}else{$formatted_path='filepath';}if($is_remote_file){$formatted_path='url';}if($formatted_path=='url'){$file_headers=@get_headers($file);if($file_headers[0]=='HTTP/1.1 404 Not Found'){die(esc_html__('File is not readable or not found.','all-in-one-video-gallery'));exit;}}elseif($formatted_path=='filepath'){if(!@is_readable($file)){die(esc_html__('File is not readable or not found.','all-in-one-video-gallery'));exit;}}
// Fetching File Size Located in Remote Server
if($is_remote_file&&$formatted_path=='url'){$data=@get_headers($file,true);if(!empty($data['Content-Length'])){$file_size=(int)$data['Content-Length'];}else{// If get_headers fails then try to fetch fileSize with curl
$ch=@curl_init();if(!@curl_setopt($ch,CURLOPT_URL,$file)){@curl_close($ch);@exit;}@curl_setopt($ch,CURLOPT_NOBODY,true);@curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);@curl_setopt($ch,CURLOPT_HEADER,true);@curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);@curl_setopt($ch,CURLOPT_MAXREDIRS,3);@curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);@curl_exec($ch);if(!@curl_errno($ch)){$http_status=(int)@curl_getinfo($ch,CURLINFO_HTTP_CODE);if($http_status>=200&&$http_status<=300)$file_size=(int)@curl_getinfo($ch,CURLINFO_CONTENT_LENGTH_DOWNLOAD);}@curl_close($ch);}}else{if($formatted_path=='url'){$data=@get_headers($file,true);$file_size=(int)$data['Content-Length'];}elseif($formatted_path=='filepath'){$file_size=(int)@filesize($file);}}