FortiLogger - Unauthenticated Arbitrary File Upload (Metasploit)


Application Details

FortiLogger is a web-based logging and reporting software designed specifically for FortiGate firewalls, running on Windows operating systems. It contains features such as instant status tracking, logging, search / filtering, reporting and hotspot.


Vulnerability

A remote attacker could upload a malicious file under ‘Hotspot Settings’, this is caused by an improper validation of file extensions. A specially crafted request could be sent which would allow the attacker to execute code on the vulnerable system.


Identification

There is a Metasploit module available which has been written to exploit the file upload vulnerability.

By stepping through the code I was able to determine that the script performs a check for the vulnerable version before delivering the exploit:

if version <= Rex::Version.new('4.4.2.2')
 CheckCode::Vulnerable("FortiLogger version #{version}")
 else
 CheckCode::Safe("FortiLogger version #{version}")
 end

Once the script has confirmed the version number of ‘4.4.2.2’ it performs a POST request:

POST /Config/SaveUploadedHotspotLogoFile

This can be used to upload a malicious file as long as it has the content-type of ‘image/png’

Content-Disposition: form-data; name="file"; filename="b3r.asp"
Content-Type: image/png

Once successfully uploaded it can then be executed by sending a GET request:

GET /Assets/temp/hotspot/img/logohotspot.asp

Detection

By turning this into a traffic file and matching rule we are able to detect attempts to upload malicious files to the application.


Coverage

Idappcom has created signature 8020953 along with a traffic file.


References

https://nvd.nist.gov/vuln/detail/CVE-2021-3378

https://packetstormsecurity.com/files/161974


Traffic IQ

If you are concerned that your business may be at risk of this vulnerability or others why not try out our Traffic IQ software which can share your defences and report any issues. Learn more here: https://www.idappcom.co.uk/traffic-iq-professional