Professional Home Page Tools Guestbook 'delcookie.php'cookie存在漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1194011 漏洞类型 未知
发布时间 2006-07-25 更新时间 2006-07-25
CVE编号 CVE-2006-3837 CNNVD-ID CNNVD-200607-421
漏洞平台 N/A CVSS评分 5.0
|漏洞来源
https://www.securityfocus.com/bid/82789
https://cxsecurity.com/issue/WLB-2006070112
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200607-421
|漏洞详情
ProfessionalHomePageToolsGuestbook中的delcookie.php更改cookie的有效期而不删除cookie值,使攻击者更易于在退出后窃取cookie并获得管理员的密码hash。
|漏洞EXP
      Advisory: Professional PHP Tools Guestbook Multiple Vulnerabilities

Release Date: 2006/06/17

Last Modified: 2006/07/17

Author: Tamriel [tamriel at gmx dot net]

Application: Professional PHP Tools Guestbook

Risk: Medium

Vendor Status: contacted | no patch available

Vendor Site: www.php-tools.eu

Overview:

Quote from wwww.php-tools.eu

"Dieses einfache Gaestebuch kann auf jedem Webspace

mit PHP 5 und MySQL Unterstuetzung installiert

werden. Es sind Smilies ein BBCode integriert.

HTML ist aus Sicherheitsgruenden deaktiviert. Dem

Webmaster steht eine einfache Webadministration

zur Verfgung, mit der er alle Eintraege bequem

verwalten kann. Er ist auch in der Lage eine oder

mehrere IP Adressen fr das Gaestebuch zu sperren."

Details:

1) SQL Injection Vulnerability in class.php

(arround line 75-115)

...

$hidemail = $_POST['hidemail'];

...

mysql_query("INSERT INTO gbook ( name, mail, hidemail, datum, ip,

text ) VALUES ( '$name', '$mail', '$hidemail', '$date', '$ip', '$text' ) ");

...

Here the programer forgot something to validate.

In the complete script you can found this vulnerabilities so i

mention only one example here.

2) SQL Injection Vulnerabilities in class.php

(arround line 250 and arround line 260)

...

$name = $_POST['name'];

$mail = $_POST['mail'];

$ip = $_POST['ip'];;

$text = $_POST['text'];

mysql_query("UPDATE gbook SET name='$name', mail='$mail', ip='$ip', text='$text' WHERE id='$entry'");

...

mysql_query("DELETE FROM gbook WHERE id='$entry'");

include(config('tpl_dir').'/del.tpl');

...

As an admin you can insert enough SQL Code. Its not celver to

trust every person who has admin access.

Version note:

I havent found some information about the actual version of this script, so take a look on the

md5 hashes of my proofed files:

9f3f1e28f6a449b51bda7f57d7cfbb48 class.php

c27de7365648eb554c3a4cab83895015 delcookie.php

faca302875997b345ab4912465df06e4 setcookie.php

Note:

1) You can found some other insecure handlings, like the administration login in setcookie.php

...

include('config.php');

if ( md5(config('admin_pass')) == $_GET['pass'] )

{

setcookie('gbook', $_GET['pass'], time()+2419200);

}

...

Attackers can here easy brute the password.

2) delcookie.php

...

setcookie('gbook', $_COOKIE['gbook'], time()-2419200);

...

The logout handler does not overwrites the existence cookie, so attackers can

read out (for example on shared computer systems) the admin's password hash after logout.

Solution:

Use the php's mysql_real_escape_string, to call MySQL's library function mysql_real_escape_string,

which prepends backslashes to the following characters: x00, n, r, , ', " and x1a.

In the delcoookie.php replace "setcookie('gbook', $_COOKIE['gbook'], time()-2419200);" with

"setcookie('gbook', '', time()-2419200);".
|受影响的产品
Professional Home Page Tools Professional Home Page Tools Guestbook 0
|参考资料

来源:XF
名称:phptguestbook-setcookie-insecure-cookie(27775)
链接:http://xforce.iss.net/xforce/xfdb/27775
来源:BUGTRAQ
名称:20060717ProfessionalPHPToolsGuestbookMultipleVulnerabilities
链接:http://www.securityfocus.com/archive/1/archive/1/440421/100/0/threaded
来源:SECUNIA
名称:21102
链接:http://secunia.com/advisories/21102
来源:MISC
链接:http://artemis.abenteuer-mittelerde.de/pub/adv02-phptgb.txt
来源:SREASON
名称:1275
链接:http://securityreason.com/securityalert/1275