Adobe Acrobat JavaScript Execution Bug SC#346

This commit is contained in:
skodak
2007-01-04 00:05:07 +00:00
parent 6a9c63b3c4
commit 9fcb7001e6
2 changed files with 11 additions and 0 deletions
+6
View File
@@ -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');
+5
View File
@@ -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'].'" ';
}