Adobe Acrobat JavaScript Execution Bug SC#346
This commit is contained in:
@@ -228,6 +228,12 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=
|
||||
$lastmodified = $pathisstring ? time() : filemtime($path);
|
||||
$filesize = $pathisstring ? strlen($path) : filesize($path);
|
||||
|
||||
if ($mimetype=='application/pdf') {
|
||||
//Adobe Reader XSS prevention - please note that it prevents opening of pdfs in browser
|
||||
$mimetype = 'application/x-forcedownload';
|
||||
$forcedownload = true;
|
||||
}
|
||||
|
||||
//IE compatibiltiy HACK!
|
||||
if (ini_get('zlib.output_compression')) {
|
||||
ini_set('zlib.output_compression', 'Off');
|
||||
|
||||
@@ -1739,6 +1739,11 @@ function cleanAttributes2($htmlArray){
|
||||
}
|
||||
$arreach['value'] = preg_replace("/j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t/i", "Xjavascript", $arreach['value']);
|
||||
$arreach['value'] = preg_replace("/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n/i", "Xexpression", $arreach['value']);
|
||||
} else if ($arreach['name'] == 'href') {
|
||||
if (stripos($arreach['value'], '.pdf')) {
|
||||
//Adobe Reader XSS protection
|
||||
$arreach['value'] = preg_replace('/(\.pdf)[^a-z0-9_\.\-].*$/i', '$1', $arreach['value']);
|
||||
}
|
||||
}
|
||||
$attStr .= ' '.$arreach['name'].'="'.$arreach['value'].'" ';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user