test_dllink
http://haik.oi21.net/index.php?haik
スクリプトの修正例
スクリプトの修正例ですが、
利用方法によっては、足りないのですが、46行目に次のような
判別を挿入。
dllink.inc.php の
if (!preg_match('/\.(pdf|jpg|png|gif|doc|docx|xls|xlxs|zip)$/i',$filename)) {
return $qm->replace('plg_dlbutton.err_bad_filetype', '');
}
dlexec.phpの70行目に以下の様な判別を挿入
if (!preg_match('/\.(pdf|jpg|png|gif|doc|docx|xls|xlxs|zip)$/i',$filename)) {
header('HTTP/1.1 404 Not Found');
error_msg('Error : bad file type1');
exit;
}
if (preg_match('/^\//',$filename)) {
header('HTTP/1.1 404 Not Found');
error_msg('Error : bad file type2');
exit;
}
if (preg_match('/\.\./',$filename)) {
header('HTTP/1.1 404 Not Found');
error_msg('Error : bad file type3');
exit;
}
pdfとzipファイルのみを許可という事なら、
if (!preg_match('/\.(pdf|jpg|png|gif|doc|docx|xls|xlxs|zip)$/i',$filename)) {
の部分を
if (!preg_match('/\.(pdf|zip)$/i',$filename)) {
等をすると、少し良くなると思いますが、まだまだでしょうか。
スキルの高い方、添削お願いします。
dllink.inc.phpからdlexec.phpを呼び出して?使うようなので、
dlexec.phpだけ対応すれば良いのかもしれません。
修正後のテスト
&dllink(/etc/passwd);
&dllink(.htaccess);
&dllink(../index.html);
&dllink(../1000-1.jpg);
&dllink(swfu/d/IMGP2089.JPG){ここに表示名、画像};
これは、
<a onClick='location.href="http://haik.oi21.net/plugin/dlexec.php?filename=swfu%2Fd%2FIMGP2089.JPG&key=2ea2ca74cc5948bb2c4f01084299a685&refer=test_dllink"' style="cursor:pointer;">ここに表示名、画像</a>