Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:28029
HistoryMay 01, 2012 - 12:00 a.m.

DIY CMS v1.0 Poll - Multiple Web Vulnerabilities

2012-05-0100:00:00
vulners.com
30

Title:

DIY CMS v1.0 Poll - Multiple Web Vulnerabilities

Date:

2012-04-26

References:

http://www.vulnerability-lab.com/get_content.php?id=518

VL-ID:

518

Introduction:

Do It Yourslef Content Management System is a feature-rich, php-built, mysql-based, opensource and free CMS.
It is suitable to manage any kind of contents. It is modular, extensible and easliy skinnable. Build your own modules for specific
purposes, add certain functionalites to suit your needs and design a theme that represents the content of your website.

(Copy of the Vendor Homepage: http://diy-cms.com)

Abstract:

A Vulnerability Laboratory researcher discovered multiple web vulnerabilities in DIY v1.0 Content Management System.

Report-Timeline:

2012-04-16: Public or Non-Public Disclosure

Status:

Published

Exploitation-Technique:

Remote

Severity:

High

Details:

1.1
A SQL Injection vulnerability is detected in DIY v1.0 Content Management System.
The vulnerability allows an attacker (remote) or local low privileged user account to inject/execute own sql commands
on the affected application dbms. Successful exploitation of the vulnerability results in dbms & application compromise.

Vulnerable Module(s):
[+] Mod - Poll

1.2
Multiple non persistent cross site scripting vulnerability is detected in DIY v1.0 Content Management System.
The vulnerability allows remote attackers to hijack website customer, moderator or admin sessions with high required
user inter action or local low privileged user account. Successful exploitation can result in account steal, phishing
& client-side content request manipulation.

Vulnerable Module(s):
[+] Poll - Question & Answer Input/Output

1.3
A cross site request forgery vulnerability is detected in DIY v1.0 Content Management System. The bugs allow remote
attackers with high required user inter action to edit user accounts. Successful exploitation can lead to account access.
To exploit the issue the attacker need to create a manipulated copy the edit user mask/form. Inside of the document the
remote can implement his own values for the update because of no form or token protection. When admin get now forced to
execute the script via link he is executing the new value on the update of the application if his session is not expired.

Vulnerable Module(s):
[+] &modfile=add

Proof of Concept:

1.1
The sql injection vulnerabilities can be exploited by remote attackers without user inter action.
Exploitation requires the possibility to allow an attacker to add or config a poll.
For demonstration or reproduce …

PoC:
diy-cms/mod.php?mod=poll&start=`[SQL-INJECTION]–

1.2
The cross site vulnerabilities can be exploited by remote attackers with medium required user inter action.
For demonstration or reproduce …

PoC:
diy-cms/modules/poll/add.php[Cross Site Scripting]

1.3
The cross site request forgery vulnerabilities can be exploited by remote attackers with high required user inter action.
For demonstration or reproduce …

<form action="http://127.0.0.1/diy/mod.php?mod=poll&amp;modfile=add&quot; method="post" name="add_poll" enctype="multipart/form-data">
<input type="hidden" name='polltype' value='1'>

<input type="hidden" name="question" value="<script>alert(1)</script>">
<input type="hidden" name="answer1" value="<script>alert(1)</script>">
<input type="hidden" name="answer2" value="<script>alert(1)</script>">

<input type="hidden" name='active' value='1' checked>
<input type=submit name='submit' value=XSS></td>
</form>

Solution:

1.1

In file /diy-cms/modules/poll/index.php
line: 50 - 55

$ppp = $mod->setting(/`polls_per_page/`);
if(!isset($_GET[/`start/`]))
{$start = /`0/`;
}else{
$start = $_GET[/`start/`];
}

we edit to:

$ppp = $mod->setting(/`polls_per_page/`);
if(!isset($_GET[/`start/`]))
{$start = /`0/`;
}else{
$start = (int)$_GET[/`start/`];
}

1.2

In file /diy-cms/modules/poll/add.php
line: 53 - 84

     if&#40;$submit&#41;
    {
       extract&#40;$_POST&#41;;
       $type  = $_POST[/&#96;&#96;polltype/&#96;&#96;];
       $question = $_POST[/&#96;&#96;question/&#96;&#96;];
       $status = $_POST[/&#96;&#96;active/&#96;&#96;];
       $date = time&#40;&#41;;

       $arr_post_vars = array&#40;$type,  $question&#41;;
                                                    
       if &#40;!required_entries&#40;$arr_post_vars&#41;&#41;
       {
           error_message&#40;$lang[/&#96;LANG_ERROR_VALIDATE/&#96;]&#41;;
       }

       if&#40;$status == /&#96;1/&#96;&#41;
       {
          $result = $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_questions set status=/&#96;0/&#96;/&#96;&#96;&#41;;
      }
     
      $result = $diy_db-&gt;query&#40;/&#96;&#96;INSERT INTO diy_poll_questions VALUES &#40;/&#96;/&#96;,/&#96;$question/&#96;,/&#96;$type/&#96;,/&#96;$status/&#96;,/&#96;$date/&#96;&#41;/&#96;&#96;&#41;;
      $qid = $diy_db-&gt;insertid&#40;&#41;;

we edit to:

     if&#40;$submit&#41;
     {
     extract&#40;$_POST&#41;;
     $type  = $_POST[/&#96;&#96;polltype/&#96;&#96;];
     $question = $_POST[/&#96;&#96;question/&#96;&#96;];
     $status = $_POST[/&#96;&#96;active/&#96;&#96;];
     $date = time&#40;&#41;;

     $arr_post_vars = array&#40;$type, $question&#41;;
                                                    
     if &#40;!required_entries&#40;$arr_post_vars&#41;&#41;
     {
         error_message&#40;$lang[/&#96;LANG_ERROR_VALIDATE/&#96;]&#41;;
     }

     if&#40;$status == /&#96;1/&#96;&#41;
     {
         $result = $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_questions set status=/&#96;0/&#96;/&#96;&#96;&#41;;
     }
     $question = htmlspecialchars&#40;strip_tags&#40;$question&#41;&#41;;    
     $result = $diy_db-&gt;query&#40;/&#96;&#96;INSERT INTO diy_poll_questions VALUES &#40;/&#96;/&#96;,/&#96;$question/&#96;,/&#96;$type/&#96;,/&#96;$status/&#96;,/&#96;$date/&#96;&#41;/&#96;&#96;&#41;;
     $qid = $diy_db-&gt;insertid&#40;&#41;;

In file /diy-cms/modules/poll/edit.php
line: 69 - 76

     $result = $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_questions set question=/&#96;$question/&#96;, type=/&#96;$type/&#96;, status=/&#96;$status/&#96; where qid=/&#96;$qid/&#96;/&#96;&#96;&#41;;

     foreach &#40;$_POST[/&#96;answer/&#96;] as $answer&#41;
     {
            $answer = $answer;
            if &#40;!empty&#40;$answer&#41;&#41; {
            $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_answers set answer=/&#96;$answer/&#96; where aid=/&#96;$aid/&#96; /&#96;&#96;&#41;;
     }

we edit to:

     $question = htmlspecialchars&#40;strip_tags&#40;$question&#41;&#41;;    
     $result = $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_questions set question=/&#96;$question/&#96;, type=/&#96;$type/&#96;, status=/&#96;$status/&#96; where qid=/&#96;$qid/&#96;/&#96;&#96;&#41;;

     foreach &#40;$_POST[/&#96;answer/&#96;] as $answer&#41;
     {
            $answer = htmlspecialchars&#40;strip_tags&#40;$answer&#41;&#41;;
            if &#40;!empty&#40;$answer&#41;&#41; {
            $diy_db-&gt;query&#40;/&#96;&#96;update diy_poll_answers set answer=/&#96;$answer/&#96; where aid=/&#96;$aid/&#96; &#96;&#96;&#41;;
     }

Risk:

1.1
The security risk of the sql injection vulnerabilities are estimated as high(+).

1.2
The security risk of the persistent input validation vulnerability is estimated as medium(-).

1.2
The security risk of the persistent input validation vulnerability is estimated as low(+).

Credits:

Vulnerability Laboratory [Research Team] - snup ([email protected])

Disclaimer:

The information provided in this advisory is provided as it is without any warranty. Vulnerability-Lab disclaims all warranties,
either expressed or implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability-
Lab or its suppliers are not liable in any case of damage, including direct, indirect, incidental, consequential loss of business
profits or special damages, even if Vulnerability-Lab or its suppliers have been advised of the possibility of such damages. Some
states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation
may not apply. Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability-
Lab. Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of
other media, are reserved by Vulnerability-Lab or its suppliers.

                                            Copyright © 2012 Vulnerability-Lab


VULNERABILITY RESEARCH LABORATORY TEAM
Website: www.vulnerability-lab.com
Mail: [email protected]