You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Filip Maj (JIRA)" <ji...@apache.org> on 2017/07/19 16:45:00 UTC

[jira] [Commented] (CB-11320) Security: a malicious cross origin iframe can kill the app

    [ https://issues.apache.org/jira/browse/CB-11320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16093386#comment-16093386 ] 

Filip Maj commented on CB-11320:
--------------------------------

Changed the component to cordova-android on this one, FYI [~bowserj].

> Security: a malicious cross origin iframe can kill the app
> ----------------------------------------------------------
>
>                 Key: CB-11320
>                 URL: https://issues.apache.org/jira/browse/CB-11320
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android
>         Environment: cordova 6.1.1, cordova-android 5.1.1
>            Reporter: jakub-g
>              Labels: security
>
> It is written in Cordova security guide that generally one should avoid iframes, unless they are fully in control of their contents:
> https://cordova.apache.org/docs/en/latest/guide/appdev/security/#iframes-and-the-callback-id-mechanism
> However not everyone might be familiar with this.
> In general the iframe seems to follow the Single Origin Policy and does not allow doing actions in the context of the top frame (main cordova app frame) from the third party iframe, but I found the following issue:
> 1. Create a sample cordova project, and embed a third-party iframe in it:
> {code}
>     cordova create foobar
>     cd foobar
>     cordova platform add android
>     vim www/index.html
> {code}
> 2. Insert the following in the `index.html`
> {code}
>       <meta http-equiv="Content-Security-Policy" content="default-src 'self' http://www.example.com">
>       <iframe src="http://www.example.com/evil-iframe.html"></iframe>
> {code}
> 3. Put one of the commands like below is that external iframe in a `<script>` tag
> {code}
>     parent.location.href = 'about:blank' 
>     top.location.href = 'about:blank' 
>     parent.location = 'about:blank' 
>     top.location = 'about:blank' 
>     parent.location.assign('about:blank')
>     top.location.assign('about:blank')
> {code}
> 4. `cordova run android`
> 5. Wait for the app to load and observe the app is minimized (killed).
> Tested on two devices:
> Android 6.0.1 / Chrome 50 / Samsung
> Android 4.4 / Chrome 33 / Sony



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org