Информационная безопасность
[RU] switch to English


Дополнительная информация

  Ежедневная сводка уязвимостей безопасности в Web-приложениях (PHP, ASP, JSP, CGI, Perl)

  aspProductCatalog Sql Injection

  Meta Cart Free Database Disclosure

  facto Database Disclosure

  ASP-CMS v.1.0 Sql Injection/Database Disclosure

From:08253_(at)_maurickcollege.nl <08253_(at)_maurickcollege.nl>
Date:14 декабря 2008 г.
Subject:Max's Guestbook (XSS) Remote Vulnerability

%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
%%
%%
%% 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)

О сайте | Условия использования
© SecurityVulns, 3APA3A, Владимир Дубровин
Нижний Новгород