Why is getpics.php causing an error message in cPanel?
1) Script Title: PHP Photo Album script v2.11
2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...photoalbum.htm
3) Describe problem: Even though there is no problem manifesting on the webpage itself (ie. the script is working fine), I am getting this error in the cPanel Error Log file... I can't imagine why this tiny script would be seen by ModSecurity as a "suspicious access attempt" and wonder if something needs to be updated...
Code:
[Sun Apr 25 15:08:58.894782 2021] [:error] [pid 7414:tid 47872391812864] [client 72.234.63.40:63973] [client 72.234.63.40] ModSecurity: Warning.
Pattern match "(\\\\/(images|img(s)?|pictures|upload(s)?)\\\\/[^\\\\.]{0,108}\\\\.(pht|phtml|php\\\\d?$))" at REQUEST_URI.
[file "/etc/apache2/conf.d/modsec_vendor_configs/imunify360-full-apache/004_i360_4_custom.conf"] [line "27"] [id "77140735"]
[msg "IM360 WAF: Suspicious access attempt (webshell)!||MVN:REQUEST_URI||T:APACHE||MV:/img/catering/getpics.php||
SC:/home/****/public_html/mauinuifarm.com/img/catering/getpics.php"] [tag "service_i360custom"] [tag "noshow"]
[hostname "www.mauinuifarm.com"] [uri "/img/catering/getpics.php"] [unique_id "YIXoevfhNYp8dRd51YAvvgAAAEI"],
referer: https://mauinuifarm.com/
Here is the code for getpics.php... I replaced the eregi with preg_match when eregi was deprecated...
Code:
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname=".") {
$pattern='/\.(jpg|jpeg|png|gif|bmp)$/i';
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(preg_match($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo "var galleryarray=new Array();" . "\n";
returnimages();
?>