Cross Site Scripting Vulnerability in phpBB2's [IMG] tag and remote avatar

From: Martijn Boerwinkel (xim@xs4all.nl)
Date: 05/26/02


From: Martijn Boerwinkel <xim@xs4all.nl>
To: bugtraq@securityfocus.com
Date: 26 May 2002 17:59:33 +0200


phpBB2 Cross Site Scripting Vulnerability
--------------------------------------------

Affected Program: phpBB2 version 2.0.0
  (possibly earlier versions too, but not tested)
Vendor: http://www.phpbb.com
Vendor Status: informed on 24/04/2002, fixed issued on 20/05/2002
Discovery Date: 24/04/2002
Release Date: 26/05/2002
Vulnerability Class: Cross Site Scripting

Severity
--------
Malicious users can steal other user's and admin's cookies, allowing
them to impersonate other users on the board and access to the
administration panel.

Problem
-------
The problem is very similar to SQL injection.
phpBB2 uses a user provided string (through the [IMG] tag)
in the following HTML tag:

<img src="$user_provided" border="0" />

While there is a check to force the string to begin with "http://" it
doesn't disallow ". That means a malicious user can escape the src="" in
the HTML tag and insert his own html code.
This same problem also exists in the remote avatar part of the user
profile.

Example
-------
Enter the following anywhere in a message:

[img]http://a.a/a"onerror="javascript:alert(document.cookie)[/img]

When reading that message it should popup an alert box with your
cookies.

Solutions
---------
* Upgrade to 2.0.1

-- 
XiM 
(#icerealm on irc.icerealm.net)