Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/12/2013, 10:42
Avatar de patilanz
patilanz
 
Fecha de Ingreso: enero-2012
Mensajes: 880
Antigüedad: 12 años, 4 meses
Puntos: 29
Ataque xss no funciona

Hola, estoy leyendo algo sobre xss. Aunque ya habia leido y se como se hace y como defenderme hise una prueba en este archvo:

Código HTML:
Ver original
  1. <!DOCTYPE HTML>
  2. <meta charset="utf8">
  3. <link href="jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet" />
  4. <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  5. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  6.  
  7. <link href="views/index.css" rel="stylesheet" />
  8.     <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  9.         Cadena: <input type="text" name="string" />
  10.         <br />
  11.         <input type="submit" value="Buscar" />
  12.     </form>
  13. <?php
  14.     if(isset($_POST['string'])){
  15.         echo $_POST['string'];
  16.     }
  17.  
  18. ?>
  19. </body>

Pero si escribo en el campo: <script>alert();</script>
Luego me imprime en el codigo fuente <script> </script>

En cambio si pongo <b>cosa</b> funciona

Por que ??