exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

smf11-xss.txt

smf11-xss.txt
Posted Dec 6, 2006
Authored by Jessica Hope, rotwang

SMFversions 1.1 Final and below suffer from a cross site scripting vulnerability.

tags | advisory, xss
SHA-256 | c935e7021fc8cd55dad3b25ac642e258e71a8b21e3a7f1b96d775c147bb55f1a

smf11-xss.txt

Change Mirror Download
======================================================================

Advisory : SMF upload XSS vulnerability
Release Date : December 4th, 2006
Application : Simple Machines Forum
Version : SMF 1.1 Final (and earlier versions)
Platform : PHP
Vendor URL : http://www.simplemachines.org
Authors : Jessica Hope ( jessicasaulhope@googlemail.com )
: rotwang ( c.a.rotwang@googlemail.com )

=======================================================================

Overview

Due to various failures in sanitising user input, it is possible to
construct XSS attacks using files masquerading as images.

=======================================================================

Discussion

A often ignored XSS hazard sprouts from the Internet Explorer's habit
to "guess"
the type of displayed data, when mime-type and header do not match.
This is especially dangerous in software allowing image uploads; the accepted
counter-measure is to use getimagesize to guarantee that the correct mime-type
is chosen.

SMF's implementation of this check is faulty, as it can be overridden by simply
setting the parameter "image". In that case, the file will be
delivered with the
type "image/gif", regardless of the file's content or name.
Even an uploaded text file is able to carry an XSS vector.
Neither the upload function, nor the delivery code actually act upon the file's
content. The admin function "Check attachment's extension" has no
impact on that
behaviour.


Vulnerable code in Display.php

Line 1045
if (filesize($filename) != 0)
{
$size = @getimagesize($filename);
if (!empty($size) && $size[2] > 0 && $size[2] < 4)
header('Content-Type: image/' . ($size[2] != 1 ? ($size[2] != 2 ?
'png' : 'jpeg') : 'gif'));
// Errr, it's an image.... what kind? A... gif? Yeah that's it,
gif! Like JIF, the peanut butter.
elseif (isset($_REQUEST['image']))
header('Content-Type: image/gif');
}


=======================================================================

Solution

It is possible to work around the issue like so:

$size = @getimagesize($filename);
if (!empty($size) && $size[2] > 0 && $size[2] < 4) {
header('Content-Type: image/' . ($size[2] != 1 ? ($size[2] != 2 ?
'png' : 'jpeg') : 'gif'));
}
// Errr, it's not an image.... what kind? Ah, let's play it safe
else {
header('Content-Disposition: attachment; filename="' . $real_filename . '"');
header('Content-Type: application/octet-stream');

}



Moreover, the upload function should check the actual filtype. Files
with invalid
extensions should not be accepted as uploads.
The avatar function already implements such checks; they should be applied for
the attachment function as well.

=======================================================================

History:

Having dealt with SMF in the past, I know that they do not take security
seriously (have a look at my earlier IP spoofing SMF report). Thus until
I believe that SMF have shaped up in terms of security, any issues that I
come across I'll be posting a full disclosure immediately.
Incidently, the IP spoofing still exsists in the latest SMF too. They never
learn.

04th December 2006: Full disclosure


=======================================================================

Credit

This issue is to be credited to Jessica Hope ( jessicasaulhope@googlemail.com ),
and rotwang ( c.a.rotwang@googlemail.com )
Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close