XMB Magic Lantern & DevBB
*************************
Date :
******
11/05/02
Produit 1 :
***********
XMB Magic Lantern forum
http://www.xmbforum.com
http://www.aventure-media.co.uk
Version :
*********
1.6b Final
Problèmes :
***********
- Récupérations de fichiers logs
- XSS
- Path Disclosure
- Récupération des comptes users/admins
- Contournement de log
Developpement :
***************
Deux fichiers .log nous permettent de récuperer quelques informations sur les visiteurs
et les admins du site.
Les fichiers sont index_log.log et cplogfile.log.
cplogfile.log est utilisé pour logger les activités admins. A l'interieur se trouve :
USER|#||#|IP|#||#|DATE|#||#|URL
index_log.log est utilisé pour loggé les activités des users et contient dans l'ordre :
REMOTE_ADDR,HTTP_CLIENT_IP,host,HTTP_USER_AGENT,HTTP_REFERER,HTTP_COOKIE,date
Les opérations pour écrire dans ce fichier se trouvent dans index_add.php, fichier
inclut dans index.php.
Voici sa source complète :
----------------------------------------------------------------
if (empty($analized)){
$agt=$HTTP_USER_AGENT;
$ip= $REMOTE_ADDR;
$host=gethostbyaddr($REMOTE_ADDR);
$ref=$HTTP_REFERER;
$cip=$HTTP_CLIENT_IP;
$cookie=$HTTP_COOKIE;
$time= date("d/m/Y H:i:s");
$from=$DOCUMENT_ROOT;
$fp=fopen("index_log.log", "r");
$raw=fgets($fp, filesize("index_log.log"));
fclose($fp);
$new=explode("|", $raw);
$nb=count($new);
$new[$nb]="
$ip $cip | $host | $agt $ref $cookie | $time |
";
$raw=implode("|", $new);
$fp1=fopen("index_log.log", "w+");
fwrite($fp1, $raw);
fclose($fp1);
setcookie("Analized", "XMB Index Log" ,time()+900);
};
?>
----------------------------------------------------------------
Comme il est dit dans /Documents/Notes For IIS.txt, le fichier add_index.php ne se trouve
pas dans les sites sous IIS, et donc index_log.log est vide.
Dans ce fichier se trouve une autre faille. Si on ne veut pas être loggé en visitant un forum
XMB, il faudra taper l'url http://www.site.com/forumpath/index.php?analized=huhu.
On peut parfois aussi avoir un path disclosure...
Si index_log.log n'est pas en chmod 777, on pourra voir sur le fichier add_index.php une
erreur du style :
--------------------------------------------------------------------------------------
Warning: fopen("index_log.log", "w+") - Permission denied in
/home/username/public_html/forums/index_add.php on line 29
Warning: Supplied argument is not a valid File-Handle resource in
/home/username/public_html/forums/index_add.php on line 30
Warning: Supplied argument is not a valid File-Handle resource in
/home/username/public_html/forums/index_add.php on line 31
Warning: Cannot add header information - headers already sent by (output started at
/home/username/public_html/forums/index_add.php :29) in
/home/username/public_html/forums/index_add.php on line 32
--------------------------------------------------------------------------------------
Voyons maintenant l'authentification. Elle se fait par cookie; on peut par exemple
voir dans member.php :
-------------------------------------------------------------------------
[...]
$password = md5($password);
[...]
setcookie("xmbuser", $username, $currtime, $cookiepath, $cookiedomain);
setcookie("xmbpw", $password, $currtime, $cookiepath, $cookiedomain);
[...]
-------------------------------------------------------------------------
Des failles cross site scripting seront donc fort interessantes.
Il y en a plusieurs non-permanentes, comme par exemple :
member.php?action=viewpro&member=
Mais le plus interessant est le permanent.
Le premier se trouve dans le profil. Dans toutes les cases à remplir, si on entre un <,
il sera affiché <, donc un '