what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Apache Cordova / PhoneGap Whitelist Bypass

Apache Cordova / PhoneGap Whitelist Bypass
Posted Jan 26, 2014

The whitelisting functionality in Apache Cordova/PhoneGap suffers from multiple vulnerabilities.

tags | advisory, vulnerability, bypass
SHA-256 | bf6c217f2c3f51ae1155eb33fcaa924979dee83db65e026dcd837d354f6d4dfb

Apache Cordova / PhoneGap Whitelist Bypass

Change Mirror Download
The following email was sent to Apache Cordova/PhoneGap on 12/13/2013, and again on 1/17/2014. 
As there has been no response, we are re-posting it here to alert the general public
of the inherent vulnerabilities in Apache Cordova/PhoneGap.

##############################################################################################
Dear PhoneGap contributors,


PhoneGap’s domain whitelisting for accessing native resources is
broken and can be bypassed. These vulnerabilities can be exploited by
any third-party domain loaded inside an iframe (e.g., malicious ad
scripts). Below, we give a brief summary of the vulnerabilities. You
can find more details in the paper <http://www.cs.utexas.edu/~shmat/shmat_ndss14nofrak.pdf>.


1. Domain whitelisting on Android (before API 11) and Windows Phone 7
and 8 relies on the URL interception call that does not intercept
iframe and XMLHttpRequest URLs. Consequently, it does not restrict
which domains can be loaded in iframes. Any script inside an iframe
can directly use PhoneGap’s internal JavaScript interfaces to the Java
objects and access native resources: for example, by calling execute =
cordova.require('cordova/exec'); var opts = cordova.require
('cordova/plugin/ ContactFindOptions' ); and directly operating on
these objects.


2. A malicious script running in an iframe can dynamically choose any
of PhoneGap’s vulnerable bridge mechanisms at runtime (e.g.
addJavascriptInterface or loadUrl on Android) and use it to bypass the
domain whitelist. We call this the chosen-bridge attack.


3. PhoneGap’s whitelisting check on Android is incorrect - it misses
an anchor at the end of the regular expression:
this.whiteList.add(Pattern.compile("ˆhttps?://(.*\\.)?" + origin));

For example, if foo.com is whitelisted, foo.com.evil.com will pass the check.

4. PhoneGap’s domain whitelisting on Android (API 11 or highler) and
iOS does not adhere to the same-origin policy. Third-party scripts
included using <script> tags are blocked unless their source domain is
whitelisted, even though these scripts execute in the origin of the
hosting page, not their source origin.


5. Instead of just blocking access to bridges from non-whitelisted
domains, PhoneGap completely blocks these domains from being loaded in
the browser. This prevents ad-supported apps from displaying
third-party ads and destroys the look-and-feel of many Web pages.


We have a proof-of-concept implementation (a 400-line patch for
PhoneGap 2.9.0 on Android) called NoFrak
[https://github.com/georgiev-martin/NoFrak] which fixes these
vulnerabilities. NoFrak does not allow Web content from
non-whitelisted domains to access native resources but still displays
it correctly in the browser. If you are interested in discussing how
to merge NoFrak or some parts of NoFrak to PhoneGap’s main branch,
please let us know.


Thanks,

Martin, Suman, and Vitaly

##############################################################################################
Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    0 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close