Project: Wordpress Plugin Photo Video Store 18.05

Vulnerability: #8928885 (2018-07-26 19:03:28)

Warning

There are many false positives, or unexploitable vulnerabilities. Please create working "PoC" exploit before reporting anything to vendor!

Details:

Sink Standard::file_exists
Risk _GET
/photo-video-store/templates/download_process.php:450 (show/hide source)
430  			$dir = opendir( pvs_upload_dir() . pvs_server_url( ( int )
431  				$publication_server ) . "/" . ( int )$publication_id );
432  			while ( $file = readdir( $dir ) ) {
433  				if ( $file == $result_filename . "." . $result_extention )
434  				{
435  					unlink( pvs_upload_dir() . pvs_server_url( ( int )$publication_server ) .
436  						"/" . ( int )$publication_id . "/" . $file );
437  				}
438  			}
439  		}
440  	}
441  } else {
442  	//Collection
443  	
444  	$sql = "select id, title, price, description,types from " . PVS_DB_PREFIX . "collections where active = 1 and id = " . (int)$collection_id;
445  	$ds->open( $sql );
446  	if ( ! $ds->eof ) {	
447  		$collection_files = array();
448  		$collection_filenames = array();
449  		
450 $result_folder = pvs_upload_dir() . "/content/categories/collection-" . $ds->row["id"] . "-" . pvs_result_strict( $_GET["f"] );
451 $result_path = $result_folder . ".zip"; 452 $result_filename = "collection-" . $ds->row["id"] . "-" . pvs_result_strict( $_GET["f"] );
Threat level 1

Callstack:

@INLINE::/photo-video-store/templates/download_process.php /photo-video-store/templates/download_process.php:514 (show/hide source)
494  							
495  								$collection_files[$rs->row["id"] . '_'  . $ext_array[$i]] = $result_folder . "/" . $rs->row["id"] . "/" . $dn->row["filename1"];
496  								$collection_filenames[$rs->row["id"] . '_'  . $ext_array[$i]] = $dn->row["filename1"];
497  								$dn->movenext();
498  							}
499  						}
500  					}
501  				}
502  			} else {
503  				$sql = "select id,url from " . PVS_DB_PREFIX . "items where shipped<>1 and id_parent=" . $rs->row["id"];
504  				$dr->open( $sql );
505  				if (!$dr->eof) {
506  					if (file_exists(pvs_upload_dir() . pvs_server_url( $rs->row["server1"] ) . "/" . $rs->row["id"] . "/" . $dr->row["url"])) {
507  						$collection_files[$rs->row["id"] . '_'  . $dr->row["id"]] = pvs_upload_dir() . pvs_server_url( $rs->row["server1"] ) . "/" . $rs->row["id"] . "/" . $dr->row["url"];
508  						$collection_filenames[$rs->row["id"] . '_'  . $dr->row["id"]] = $dr->row["url"];
509  					} else {	
510  						if ( pvs_is_remote_storage() ) {
511  							$sql = "select url,filename1,filename2,width,height,item_id,filesize from " . PVS_DB_PREFIX . "filestorage_files where id_parent=" . $rs->row["id"] . " and item_id<>0";
512  							$dn->open( $sql );
513  							while ( ! $dn->eof ) {	
514 if (! file_exists ($result_folder)) {
515 mkdir( $result_folder); 516 }