Rapid7 Vulnerability & Exploit Database

DotCMS RCE via Arbitrary File Upload.

Back to Search

DotCMS RCE via Arbitrary File Upload.

Disclosed
05/03/2022
Created
06/02/2022

Description

When files are uploaded into dotCMS via the content API, but before they become content, dotCMS writes the file down in a temp directory. In the case of this vulnerability, dotCMS does not sanitize the filename passed in via the multipart request header and thus does not sanitize the temp file's name. This allows a specially crafted request to POST files to dotCMS via the ContentResource (POST /api/content) that get written outside of the dotCMS temp directory. In the case of this exploit, an attacker can upload a special .jsp file to the webapp/ROOT directory of dotCMS which can allow for remote code execution.

Author(s)

  • Shubham Shah
  • Hussein Daher
  • jheysel-r7

Platform

Linux,Windows

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/multi/http/dotcms_file_upload_rce
msf exploit(dotcms_file_upload_rce) > show targets
    ...targets...
msf exploit(dotcms_file_upload_rce) > set TARGET < target-id >
msf exploit(dotcms_file_upload_rce) > show options
    ...show and set options...
msf exploit(dotcms_file_upload_rce) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;