在exploit-db.com上看到,小看了下
Vulnerability ID: HTB22958
Reference: http://www.htbridge.ch/advisory/xss_in_phpgraphy.html
Product: phpGraphy
Vendor: http://phpgraphy.sourceforge.net/ ( http://phpgraphy.sourceforge.net/ )
Vulnerable Version: 0.9.13b
Vendor Notification: 14 April 2011
Vulnerability Type: XSS (Cross Site Scripting)
Risk level: Medium
Credit: High-Tech Bridge SA Security Research Lab ( http://www.htbridge.ch/advisory/ )
Vulnerability Details:
User can execute arbitrary JavaScript code within the vulnerable application.
The vulnerability exists due to failure in the "/themes/default/header.inc.php" script to properly sanitize user-supplied input in "theme_dir" variable then register_globals on.
Successful exploitation of this vulnerability could result in a compromise of the application, theft of cookie-based authentication credentials, disclosure or modification of sensitive data.
The following PoC is available:
先測試下代碼,是否真實存在
可以alert,存在!
php.ini的設置爲register_globals = on
那麼分析下代碼看下
打開 themes/default/header.inc.php,看到21行開始
<link rel="stylesheet" href="<?php echo $theme_dir ?>phpgraphy.css" type="text/css" />
<link rel="icon" href="<?php echo $base_images_dir ?>favico.ico" type="image/ico" />
<link rel="shortcut icon" href="<?php echo $base_images_dir ?>favico.ico" type="image/ico" />
沒有初始化造成的
解決方案1.php.ini的設置爲register_globals = off
2.初始化$base_images_dir 和$theme_dir 還有themes/default/header.inc.php中其他的.