{================================================================================} { [waraxe-2006-SA#044] } {================================================================================} { } { [ XSS in phpNuke 7.8 and older versions] } { } {================================================================================} Author: Janek Vind "waraxe" Date: 13. February 2006 Location: Estonia, Tartu Web: http://www.waraxe.us/advisory-44.html Target software description: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ phpNuke 6.0 - 7.8 Homepage: http://phpnuke.org/ What is phpNuke ? PHP-Nuke is a news automated system specially designed to be used in Intranets and Internet. The Administrator has total control of his web site, registered users, and he will have in the hand a powerful assembly of tools to maintain an active and 100% interactive web site using databases. Vulnerabilities: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Potentially harmful cross-site scripting bug has been found in phpNuke software. All versions from 6.0 to 7.8 are affected. Version 7.9 has not been tested against this bug, but probably it is affected too. As in case of any XSS bugs, there can be many ways to exploit this bug, for example stealing the cookies, containing username/hashed password. Details ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ So what is the cause of this XSS case? As common in phpNuke world, problem lies in uninitialized variable - "$pagetitle". This global variable is used for transfer page title from module worker-code to "head()" function in "header.php" file. Looking at source ("header.php" line ~ 28): ----------------[ from source code ]------------------ function head() { global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle; include("includes/ipban.php"); $ThemeSel = get_theme(); include("themes/$ThemeSel/theme.php"); echo "\n"; echo "\n"; echo "\n"; echo "$sitename $pagetitle\n"; include("includes/meta.php"); include("includes/javascript.php"); ----------------[ /from source code ]----------------- So we see, that "$pagetitle" is directly rendered to html code. And after searching in source code, we can see that it is not initialized by default. Hmm, what about running some tests ... Let's try "http://localhost/nuke78/?pagetitle=w00t>test" and we see, that html tags injection is really possible. Now comes the hard part - how to inject scripting code? Phpnuke is using some anti-XSS filters agaist injection, so direct attack with "