Persistent Cross-Site Scripting in SilverStripe CMS

Project Description

The file upload functionality of the SilverStripe CMS allows user to upload SVG files but it doesn’t sanitize output of the uploaded files which leads to persistent cross site scripting.


Vendor description

“SilverStripe is the intuitive content management system and flexible framework loved by editors and developers alike. Equip your web teams to achieve outstanding results.”

Source: https://www.silverstripe.org/

Business recommendation

SEC Consult recommends to do a proper output sanitization on uploaded SVG files. Users should upgrade to version 3.6.1 or higher. A thorough source code analysis is recommended.

Vulnerability overview/description

1) Persistent Cross Site Scripting

Due to the lack of input validation and output sanitization, an attacker can upload SVG files containing malicious JavaScript code to be executed under a victim’s browser context.

Proof of concept

1) Persistent Cross Site Scripting

Example: XSS using SVG File Upload

The file upload function in the CMS allows to upload SVG files but it doesn’t sanitize output of the file which leads to XSS.

There are 2 vulnerable instances of the same vulnerability.

  1. The “Insert Media” option in the content editor.
  2. The path “/admin/assets/add/”

During editing contents or creating a new page an attacker can upload an SVG image using the “Insert Image” button. The request below shows that an attacker can upload an SVG file with malicious payloads.
POST /admin/pages/edit/EditorToolbar/MediaForm/field/AssetUploadField/upload HTTP/1.1
Host: $host
---snip---
Cookie: PHPSESSID=esqs7da6338k0sgj7itn3tcil7; bypassStaticCache=1
Connection: close

-----------------------------969190451574
Content-Disposition: form-data; name="SecurityID"
undefined

-----------------------------969190451574
Content-Disposition: form-data; name="AssetUploadField"; filename="evilsvgfile.svg"
Content-Type: image/svg+xml

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
<polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/>
<script type="text/javascript">
alert('XSS!');
</script>
</svg>
-----------------------------969190451574--

Using the same process an attacker can also upload a malicious SVG file in the path “/admin/assets/add/”. A low privilege editor user such as a “Content Editor” can also exploit this vulnerability.

Vulnerable / tested versions

The following version is affected by the identified vulnerabilities which was the most recent version at the time of discovery:

  • Silverstripe CMS version <=3.5.3

Vendor contact timeline

2017-03-22: Contacting vendor through security@silverstripe.org
2017-03-23: Vendor provided public key certificates
2017-03-23: Sent the advisory to vendor
2017-04-17: Follow-up with vendor on the status
2017-04-17: Vendor responded work in progress
2017-05-09: Follow-up with vendor on the status, no response from the vendor
2017-05-24: Informed the vendor on releasing the advisory
2017-05-31: Vendor: vulnerability has been fixed, verified that it is not
2017-06-07: Vendor confirmed that the issue is not fixed and it will be fixed in the next release.
2017-06-27: Silverstripe Version 3.6.1 released
2017-09-14: Public release of advisory

Solution

Upgrade to SilverStripe v3.6.1 at https://www.silverstripe.org/download/

Changelog: https://docs.silverstripe.org/en/3/changelogs/3.6.1

Workaround

Do not allow uploading an SVG file.

Advisory URL

https://www.sec-consult.com/en/vulnerability-lab/advisories/index.html

 

EOF Siddhartha Tripathy / @2017

Project Details

  • TitlePersistent Cross-Site Scripting
  • ProductSilverStripe CMS
  • Vulnerable version<=3.5.3
  • Fixed version3.6.1
  • CVE number-
  • ImpactMedium
  • Homepagehttps://www.silverstripe.org
  • Found2017-03-15
  • ByS. Tripathy (Office Singapore) | SEC Consult Vulnerability Lab

Cookie Preference

Please select an option. You can find more information about the consequences of your choice at Help.

Select an option to continue

Your selection was saved!

Help

Help

To continue, you must make a cookie selection. Below is an explanation of the different options and their meaning.

  • Accept all cookies:
    All cookies such as tracking and analytics cookies.
  • Accept first-party cookies only:
    Only cookies from this website.
  • Reject all tracking cookies:
    No cookies except for those necessary for technical reasons are set.

You can change your cookie setting here anytime: Privacy Statement. Legal Notice

Back