ダウンロードプラグインに任意のファイルがダウンロード可能な脆弱性あり

15 views
Skip to first unread message

いしまる

unread,
Dec 6, 2016, 7:50:22 PM12/6/16
to PukiWikiETC
plugin/dlexec.php
plugin/dllink.inc.php
に任意のファイルがダウンロード可能な脆弱性あり、修正されるまで、上記のファイルは
名前を変更するなどして機能を無効にすることが推奨される。

通常のWEBサーバーの設定では、それぞれのファイルの拡張子をcgiにするとPHPとしては実行出来なくなる。

いしまる

unread,
Dec 8, 2016, 11:08:29 PM12/8/16
to pukiw...@googlegroups.com
open-QHMのVer4.73にはこのファイルはありませんでした。

スクリプトの修正例ですが、
利用方法によっては、足りないのですが、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だけ対応すれば良いのかもしれません。
Reply all
Reply to author
Forward
0 new messages